我在Raspberry Pi上连接了2个相同的蓝牙接收器,
我需要监视房间不同部分的蓝牙信号。
不幸的是,这两个设备具有相同的idVendor和idProduct,所以我
希望使用utr {serial},希望udev可以
区分两者。
问题是,我创建了udev规则(使用新的SYMLINK)之后,
仅一个蓝牙接收器显示正确名称的DEVLINK
我在规则中提供了。另一个蓝牙接收器DEVLINK名称是
从未显示。我尝试了很多事情:重新启动,重新加载udev
规则,重新启动udevadm。控制台提供以下错误
在dm测试中时(下面提供了完整的输出-我认为
可能是此输出后半部分的权限问题?):
udev_event_execute_rules: no node name set, will use kernel supplied
name 'bus/usb/001/006'
udev_node_add: creating device node '/dev/bus/usb/001/006',
devnum=189:5, mode=01664, uid=0, gid=0
udev_node_mknod: preserve file '/dev/bus/usb/001/006', because it has
correct dev_t
udev_node_mknod: preserve permissions /dev/bus/usb/001/006, 021664, uid=0, gid=0
node_symlink: preserve already existing symlink '/dev/char/189:5' to
'../bus/usb/001/006'
udev_device_update_db: unable to create temporary db file
'/run/udev/data/c189:5.tmp': Permission denied
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/006
如果有帮助,这是我为创建规则所做的工作,并且
执行测试:
首先,我运行udevadm信息以识别
2个接收器。
1个设备上的idVendor,序列号和idProduct如下:
ATTR{idVendor}=="0a5c"
ATTR{serial}=="0002723FAE6C"
ATTR{idProduct}=="21e8"
在另一台设备上...
ATTR{idVendor}=="0a5c"
ATTR{serial}=="5CF37067320A"
ATTR{idProduct}=="21e8"
我创建了一个名为“ 00-my-usb-device.rules”的新规则文件
如下所示:
SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c",
ATTRS{serial}=="5CF37067320A", SYMLINK+="driverBT"
然后,我创建了一个单独的规则文件,名为“ 01-my-usb-device.rules”
(本来我将两个规则都放在一个文件中,但想尝试全部
可能性。该文件如下所示:
SUBSYSTEM=="USB", ATTR{serial}=="0002723FAE6C",
ATTR{idVendor}=="0a5c", SYMLINK+="rearBT"
在序列号为“ 5CF37067320A”的第一个端口上运行devadm(也
是我设定的第一条规则):
udevadm测试/devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5.2
run_command:调用:测试
adm_test:版本175
该程序仅用于调试,不运行任何程序,
由RUN键指定。它可能显示错误的结果,因为
一些值可能不同,或者在模拟运行中不可用。
parse_file: reading '/etc/udev/rules.d/00-my-usb-device.rules' as rules file
parse_file: reading '/etc/udev/rules.d/01-my-usb-device.rules' as rules file
parse_file: reading '/lib/udev/rules.d/10-local-rpi.rules' as rules file
parse_file: reading '/etc/udev/rules.d/40-scratch.rules' as rules file
parse_file: reading '/lib/udev/rules.d/42-qemu-usb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-udev-default.rules' as rules file
parse_file: reading '/lib/udev/rules.d/55-dm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-cdrom_id.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-fuse.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-gnupg.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-gpsd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-i2c-tools.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-ifplugd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-libgphoto2-2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-alsa.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-dm.rules'
as rules file
parse_file: reading
'/lib/udev/rules.d/60-persistent-storage-tape.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as
rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-python-pifacecommon.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/60-python3-pifacecommon.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/60-triggerhappy.rules' as rules file
parse_file: reading '/lib/udev/rules.d/61-accelerometer.rules' as rules file
parse_file: reading '/run/udev/rules.d/61-dev-root-link.rules' as rules file
parse_file: reading '/lib/udev/rules.d/64-xorg-xkb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-uaccess.rules' as rules file
add_rule: IMPORT found builtin 'usb_id', replacing
/lib/udev/rules.d/70-uaccess.rules:13
parse_file: reading '/lib/udev/rules.d/70-udev-acl.rules' as rules file
parse_file: reading '/lib/udev/rules.d/71-seat.rules' as rules file
add_rule: IMPORT found builtin 'path_id', replacing
/lib/udev/rules.d/71-seat.rules:23
parse_file: reading '/lib/udev/rules.d/73-seat-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/75-net-description.rules' as rules file
parse_file: reading
'/lib/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-probe_mtd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-tty-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/78-sound-card.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-networking.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-udisks.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-hwclock.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-usbmuxd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-alsa-restore.rules' as rules file
parse_file: reading '/lib/udev/rules.d/91-permissions.rules' as rules file
parse_file: reading
'/lib/udev/rules.d/95-keyboard-force-release.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keymap.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-udev-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-hid2hci.rules' as rules file
parse_file: reading '/etc/udev/rules.d/99-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/99-systemd.rules' as rules file
udev_rules_new: rules use 145392 bytes tokens (12116 * 12 bytes),
24358 bytes buffer
udev_rules_new: temporary index used 39920 bytes (1996 * 20 bytes)
udev_device_new_from_syspath: device 0x18b5748 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5.2'
udev_device_new_from_syspath: device 0x18b2258 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5.2'
udev_device_read_db: device 0x18b2258 filled with db file data
udev_rules_apply_to_event: LINK 'driverBT'
/etc/udev/rules.d/00-my-usb-device.rules:1
udev_device_new_from_syspath: device 0x18b3188 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1/1-1.5'
udev_device_new_from_syspath: device 0x18b3640 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1'
udev_device_new_from_syspath: device 0x18b3ae8 has devpath
'/devices/platform/bcm2708_usb/usb1'
udev_device_new_from_syspath: device 0x18b3f88 has devpath
'/devices/platform/bcm2708_usb'
udev_device_new_from_syspath: device 0x18b42d8 has devpath '/devices/platform'
udev_rules_apply_to_event: IMPORT builtin 'usb_id'
/lib/udev/rules.d/60-libgphoto2-2.rules:11
udev_builtin_add_property: ID_VENDOR=Broadcom_Corp
udev_builtin_add_property: ID_VENDOR_ENC=Broadcom\x20Corp
udev_builtin_add_property: ID_VENDOR_ID=0a5c
udev_builtin_add_property: ID_MODEL=BCM20702A0
udev_builtin_add_property: ID_MODEL_ENC=BCM20702A0
udev_builtin_add_property: ID_MODEL_ID=21e8
udev_builtin_add_property: ID_REVISION=0112
udev_builtin_add_property: ID_SERIAL=Broadcom_Corp_BCM20702A0_5CF37067320A
udev_builtin_add_property: ID_SERIAL_SHORT=5CF37067320A
udev_builtin_add_property: ID_BUS=usb
udev_builtin_add_property: ID_USB_INTERFACES=:ff0101:ffffff:fe0101:
udev_rules_apply_to_event: MODE 0664 /lib/udev/rules.d/91-permissions.rules:36
udev_event_execute_rules: no node name set, will use kernel supplied
name 'bus/usb/001/009'
udev_node_add: creating device node '/dev/bus/usb/001/009',
devnum=189:8, mode=01664, uid=0, gid=0
udev_node_mknod: preserve file '/dev/bus/usb/001/009', because it has
correct dev_t
udev_node_mknod: preserve permissions /dev/bus/usb/001/009, 021664, uid=0, gid=0
node_symlink: preserve already existing symlink '/dev/char/189:8' to
'../bus/usb/001/009'
link_find_prioritized: found 'c189:8' claiming '/run/udev/links/driverBT'
link_update: creating link '/dev/driverBT' to '/dev/bus/usb/001/009'
node_symlink: preserve already existing symlink '/dev/driverBT' to
'bus/usb/001/009'
udev_device_update_db: unable to create temporary db file
'/run/udev/data/c189:8.tmp': Permission denied
ACTION=add
BUSNUM=001
DEVLINKS=/dev/driverBT
DEVNAME=/dev/bus/usb/001/009
DEVNUM=009
DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5.2
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=BCM20702A0
ID_MODEL_ENC=BCM20702A0
ID_MODEL_ID=21e8
ID_REVISION=0112
ID_SERIAL=Broadcom_Corp_BCM20702A0_5CF37067320A
ID_SERIAL_SHORT=5CF37067320A
ID_USB_INTERFACES=:ff0101:ffffff:fe0101:
ID_VENDOR=Broadcom_Corp
ID_VENDOR_ENC=Broadcom\x20Corp
ID_VENDOR_ID=0a5c
MAJOR=189
MINOR=8
PRODUCT=a5c/21e8/112
SUBSYSTEM=usb
TYPE=255/1/1
UDEV_LOG=6
USEC_INITIALIZED=465479898
在第二个端口上运行udevadm测试(DEVLINK在此处不存在,因为
与其他设备相比):
udevadm测试/devices/platform/bcm2708_usb/usb1/1-1/1-1.5
run_command:调用:测试
adm_test:版本175
该程序仅用于调试,不运行任何程序,
由RUN键指定。它可能显示错误的结果,因为
一些值可能不同,或者在模拟运行中不可用。
parse_file: reading '/etc/udev/rules.d/00-my-usb-device.rules' as rules file
parse_file: reading '/etc/udev/rules.d/01-my-usb-device.rules' as rules file
parse_file: reading '/lib/udev/rules.d/10-local-rpi.rules' as rules file
parse_file: reading '/etc/udev/rules.d/40-scratch.rules' as rules file
parse_file: reading '/lib/udev/rules.d/42-qemu-usb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-udev-default.rules' as rules file
parse_file: reading '/lib/udev/rules.d/55-dm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-cdrom_id.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-fuse.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-gnupg.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-gpsd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-i2c-tools.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-ifplugd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-libgphoto2-2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-alsa.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-dm.rules'
as rules file
parse_file: reading
'/lib/udev/rules.d/60-persistent-storage-tape.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as
rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-python-pifacecommon.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/60-python3-pifacecommon.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/60-triggerhappy.rules' as rules file
parse_file: reading '/lib/udev/rules.d/61-accelerometer.rules' as rules file
parse_file: reading '/run/udev/rules.d/61-dev-root-link.rules' as rules file
parse_file: reading '/lib/udev/rules.d/64-xorg-xkb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-uaccess.rules' as rules file
add_rule: IMPORT found builtin 'usb_id', replacing
/lib/udev/rules.d/70-uaccess.rules:13
parse_file: reading '/lib/udev/rules.d/70-udev-acl.rules' as rules file
parse_file: reading '/lib/udev/rules.d/71-seat.rules' as rules file
add_rule: IMPORT found builtin 'path_id', replacing
/lib/udev/rules.d/71-seat.rules:23
parse_file: reading '/lib/udev/rules.d/73-seat-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules'
as rules file
parse_file: reading '/lib/udev/rules.d/75-net-description.rules' as rules file
parse_file: reading
'/lib/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-probe_mtd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-tty-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/78-sound-card.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-networking.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-udisks.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-hwclock.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-usbmuxd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-alsa-restore.rules' as rules file
parse_file: reading '/lib/udev/rules.d/91-permissions.rules' as rules file
parse_file: reading
'/lib/udev/rules.d/95-keyboard-force-release.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keymap.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-udev-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-hid2hci.rules' as rules file
parse_file: reading '/etc/udev/rules.d/99-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/99-systemd.rules' as rules file
udev_rules_new: rules use 145392 bytes tokens (12116 * 12 bytes),
24358 bytes buffer
udev_rules_new: temporary index used 39920 bytes (1996 * 20 bytes)
udev_device_new_from_syspath: device 0x17a748 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1/1-1.5'
udev_device_new_from_syspath: device 0x177258 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1/1-1.5'
udev_device_read_db: device 0x177258 filled with db file data
udev_device_new_from_syspath: device 0x177db8 has devpath
'/devices/platform/bcm2708_usb/usb1/1-1'
udev_device_new_from_syspath: device 0x178260 has devpath
'/devices/platform/bcm2708_usb/usb1'
udev_device_new_from_syspath: device 0x1786d8 has devpath
'/devices/platform/bcm2708_usb'
udev_device_new_from_syspath: device 0x178a28 has devpath '/devices/platform'
udev_rules_apply_to_event: IMPORT builtin 'usb_id'
/lib/udev/rules.d/60-libgphoto2-2.rules:11
udev_builtin_add_property: ID_VENDOR=050d
udev_builtin_add_property: ID_VENDOR_ENC=050d
udev_builtin_add_property: ID_VENDOR_ID=050d
udev_builtin_add_property: ID_MODEL=0234
udev_builtin_add_property: ID_MODEL_ENC=0234
udev_builtin_add_property: ID_MODEL_ID=0234
udev_builtin_add_property: ID_REVISION=3298
udev_builtin_add_property: ID_SERIAL=050d_0234
udev_builtin_add_property: ID_BUS=usb
udev_builtin_add_property: ID_USB_INTERFACES=:090001:090002:
udev_rules_apply_to_event: MODE 0664 /lib/udev/rules.d/91- permissions.rules:36
udev_event_execute_rules: no node name set, will use kernel supplied
name 'bus/usb/001/006'
udev_node_add: creating device node '/dev/bus/usb/001/006',
devnum=189:5, mode=01664, uid=0, gid=0
udev_node_mknod: preserve file '/dev/bus/usb/001/006', because it has
correct dev_t
udev_node_mknod: preserve permissions /dev/bus/usb/001/006, 021664, uid=0, gid=0
node_symlink: preserve already existing symlink '/dev/char/189:5' to
'../bus/usb/001/006'
udev_device_update_db: unable to create temporary db file
'/run/udev/data/c189:5.tmp': Permission denied
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/006
DEVNUM=006
DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.5
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=0234
ID_MODEL_ENC=0234
ID_MODEL_ID=0234
ID_REVISION=3298
ID_SERIAL=050d_0234
ID_USB_INTERFACES=:090001:090002:
ID_VENDOR=050d
ID_VENDOR_ENC=050d
ID_VENDOR_ID=050d
MAJOR=189
MINOR=5
PRODUCT=50d/234/3298
SUBSYSTEM=usb
TYPE=9/0/2
UDEV_LOG=6
USEC_INITIALIZED=200440100
最佳答案
需要内核。 2个BT适配器挂接到4端口集线器中。一旦我在2条规则中都指定了内核,一切就正常了。
产品和串行也用于区分这两种设备(产品可能不是必需的,因为它与其他BT设备匹配,但是肯定需要串行)。