当前位置: 技术问答>linux和unix
linux中/dev/找不到设备
来源: 互联网 发布时间:2017-03-17
本文导语: android4.0系统,在/dev/目录下没有,i2c-0 ,i2c-1...只有个i2c-dev,设备号是10,貌似不是我的i2c设备 root@android:$ ls -l /dev/i2c-dev crw------- root root 10, 54 2012-09-28 08:26 i2c-dev 以下是另外一个设备的/dev/目录,这个...
android4.0系统,在/dev/目录下没有,i2c-0 ,i2c-1...只有个i2c-dev,设备号是10,貌似不是我的i2c设备
root@android:$ ls -l /dev/i2c-dev
crw------- root root 10, 54 2012-09-28 08:26 i2c-dev
以下是另外一个设备的/dev/目录,这个有i2c-0, i2c-1,主设备号为89,这才是我想要的,
/********************************************************************/
/ # ls -l /dev
crw------- root root 89, 1 2020-09-28 14:42 i2c-1
crw------- root root 89, 0 2020-09-28 14:42 i2c-0
/ # ls -l /sys/bus/i2c/devices/
lrwxrwxrwx root root 2012-09-28 10:42 0-0001 -> ../../../devices/i2c-0/0-0001
lrwxrwxrwx root root 2012-09-28 10:42 0-0021 -> ../../../devices/i2c-0/0-0021
lrwxrwxrwx root root 2012-09-28 10:42 1-0018 -> ../../../devices/i2c-1/1-0018
lrwxrwxrwx root root 2012-09-28 10:42 2-0034 -> ../../../devices/i2c-2/2-0034
lrwxrwxrwx root root 2012-09-28 10:42 i2c-0 -> ../../../devices/i2c-0
lrwxrwxrwx root root 2012-09-28 10:42 i2c-1 -> ../../../devices/i2c-1
lrwxrwxrwx root root 2012-09-28 10:42 i2c-2 -> ../../../devices/i2c-2
/********************************************************************/
但在我的设备上为什么没有呢?
查看bus总线:
root@android:$ ls -l /sys/bus/i2c
drwxr-xr-x root root 2012-09-28 10:23 devices
drwxr-xr-x root root 2012-09-28 10:23 drivers
-rw-r--r-- root root 4096 2012-09-28 10:23 drivers_autoprobe
--w------- root root 4096 2012-09-28 10:23 drivers_probe
--w------- root root 4096 2012-09-28 10:23 uevent
root@android:$ ls -l /sys/bus/i2c/devices
lrwxrwxrwx root root 2012-09-28 10:23 0-001a -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-001a
lrwxrwxrwx root root 2012-09-28 10:23 0-001c -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-001c
lrwxrwxrwx root root 2012-09-28 10:23 0-004c -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-004c
lrwxrwxrwx root root 2012-09-28 10:23 1-0033 -> ../../../devices/platform/rk29_i2c.1/i2c-1/1-0033
lrwxrwxrwx root root 2012-09-28 10:23 2-0001 -> ../../../devices/platform/rk29_i2c.2/i2c-2/2-0001
lrwxrwxrwx root root 2012-09-28 10:23 2-0051 -> ../../../devices/platform/rk29_i2c.2/i2c-2/2-0051
lrwxrwxrwx root root 2012-09-28 10:23 i2c-0 -> ../../../devices/platform/rk29_i2c.0/i2c-0
lrwxrwxrwx root root 2012-09-28 10:23 i2c-1 -> ../../../devices/platform/rk29_i2c.1/i2c-1
lrwxrwxrwx root root 2012-09-28 10:23 i2c-2 -> ../../../devices/platform/rk29_i2c.2/i2c-2
lrwxrwxrwx root root 2012-09-28 10:23 i2c-3 -> ../../../devices/platform/rk29_i2c.3/i2c-3
从上面看出有i2c-0, i2c-1...为什么在/dev/目录下面就没有呢?怎样才能read/write这个i2c-0呢?
root@android:$ ls -l /dev/i2c-dev
crw------- root root 10, 54 2012-09-28 08:26 i2c-dev
以下是另外一个设备的/dev/目录,这个有i2c-0, i2c-1,主设备号为89,这才是我想要的,
/********************************************************************/
/ # ls -l /dev
crw------- root root 89, 1 2020-09-28 14:42 i2c-1
crw------- root root 89, 0 2020-09-28 14:42 i2c-0
/ # ls -l /sys/bus/i2c/devices/
lrwxrwxrwx root root 2012-09-28 10:42 0-0001 -> ../../../devices/i2c-0/0-0001
lrwxrwxrwx root root 2012-09-28 10:42 0-0021 -> ../../../devices/i2c-0/0-0021
lrwxrwxrwx root root 2012-09-28 10:42 1-0018 -> ../../../devices/i2c-1/1-0018
lrwxrwxrwx root root 2012-09-28 10:42 2-0034 -> ../../../devices/i2c-2/2-0034
lrwxrwxrwx root root 2012-09-28 10:42 i2c-0 -> ../../../devices/i2c-0
lrwxrwxrwx root root 2012-09-28 10:42 i2c-1 -> ../../../devices/i2c-1
lrwxrwxrwx root root 2012-09-28 10:42 i2c-2 -> ../../../devices/i2c-2
/********************************************************************/
但在我的设备上为什么没有呢?
查看bus总线:
root@android:$ ls -l /sys/bus/i2c
drwxr-xr-x root root 2012-09-28 10:23 devices
drwxr-xr-x root root 2012-09-28 10:23 drivers
-rw-r--r-- root root 4096 2012-09-28 10:23 drivers_autoprobe
--w------- root root 4096 2012-09-28 10:23 drivers_probe
--w------- root root 4096 2012-09-28 10:23 uevent
root@android:$ ls -l /sys/bus/i2c/devices
lrwxrwxrwx root root 2012-09-28 10:23 0-001a -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-001a
lrwxrwxrwx root root 2012-09-28 10:23 0-001c -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-001c
lrwxrwxrwx root root 2012-09-28 10:23 0-004c -> ../../../devices/platform/rk29_i2c.0/i2c-0/0-004c
lrwxrwxrwx root root 2012-09-28 10:23 1-0033 -> ../../../devices/platform/rk29_i2c.1/i2c-1/1-0033
lrwxrwxrwx root root 2012-09-28 10:23 2-0001 -> ../../../devices/platform/rk29_i2c.2/i2c-2/2-0001
lrwxrwxrwx root root 2012-09-28 10:23 2-0051 -> ../../../devices/platform/rk29_i2c.2/i2c-2/2-0051
lrwxrwxrwx root root 2012-09-28 10:23 i2c-0 -> ../../../devices/platform/rk29_i2c.0/i2c-0
lrwxrwxrwx root root 2012-09-28 10:23 i2c-1 -> ../../../devices/platform/rk29_i2c.1/i2c-1
lrwxrwxrwx root root 2012-09-28 10:23 i2c-2 -> ../../../devices/platform/rk29_i2c.2/i2c-2
lrwxrwxrwx root root 2012-09-28 10:23 i2c-3 -> ../../../devices/platform/rk29_i2c.3/i2c-3
从上面看出有i2c-0, i2c-1...为什么在/dev/目录下面就没有呢?怎样才能read/write这个i2c-0呢?
|
使用mknod命令手工创建设备文件,或者修改驱动源程序自动创建设备文件。
|
mdev
|
楼上两位都正解
|
在/sys/devices/目录下也没有吗?