Я аквалангист и гордый владелец 2 компьютеров для дайвинга. Эти два устройства могут быть подключены к USB-порту, и с помощью программы Linus SubSurface divinglog я могу импортировать из них журнал погружений. Один из них - атомный водный кобальт, а другой - Suunto D4i. Теперь я хочу создать dev-файлы с udev для каждого из них, чтобы я мог подключить их к любому USB-порту и при этом использовать тот же dev-файл в программном обеспечении регистрации. (Например, /dev /my_cobalt и /dev /my_d4i)
Одна и та же (вид) конфигурация используется для обоих.
Для D4i использование dev-файла блокируется автоматически созданным /dev /ttyUSB0.
Для обоих дайвинг-компьютеров создается dev-файл, а для Cobalt все работает, как хотелось, но не для D4i.
Я могу использовать /dev /ttyUSB0, но не /dev /my_d4i.
Почему-то кажется (я не уверен), что это вызвано различием в том, как они представляются на USB-шине. Смотрите вывод команды lsusb ниже.
Если кто-нибудь может сказать мне, что вызывает эту разницу и / или как решить эту проблему, я буду очень признателен. (Почему при подключении d4i также создается dev-файл ttyUSB?)
Ниже приведена некоторая информация о выводах / настройках.
/etc/udev/rules.d/dive-computers.rules
# My Cobalt2 DiveComputer
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", ATTR{idProduct}=="0888", SYMLINK+="my_cobalt", GROUP="dialout", MODE="0660"
# My Suunto D4i DiveComputer
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK+="my_d4i", GROUP="dialout", MODE="0660"
dev-файлы после подключения кобальта
lrwxrwxrwx 1 root root 15 mei 16 23:13 my_cobalt -> bus/usb/003/007
# no ttyUSB0 created
dev-файлы после подключения d4i
lrwxrwxrwx 1 root root 15 mei 16 23:15 my_d4i -> bus/usb/003/009
crw-rw---- 1 root dialout 188, 0 mei 16 23:15 ttyUSB0
lsusb -v -D /dev /bus /usb /003/007 (Cobalt)
Device: ID 0471:0888 Philips (or NXP) Hantek DDS-3005 Arbitrary Waveform Generator
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 220 Diagnostic
bDeviceSubClass 1 Reprogrammable Diagnostics
bDeviceProtocol 1 USB2 Compliance
bMaxPacketSize0 16
idVendor 0x0471 Philips (or NXP)
idProduct 0x0888 Hantek DDS-3005 Arbitrary Waveform Generator
bcdDevice 0.02
iManufacturer 1 ATOMIC AQUATICS
iProduct 2 COBALT
iSerial 3 123456789ABCDEF
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 Console
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 220 Diagnostic
bInterfaceSubClass 160
bInterfaceProtocol 176
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0101
Self Powered
lsusb -v -D /dev /bus /usb / 003/009 (D4i)
Device: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0403 Future Technology Devices International, Ltd
idProduct 0x6001 FT232 USB-Serial (UART) IC
bcdDevice 6.00
iManufacturer 1 Smartinterface
iProduct 2 USB Serial Cable
iSerial 3 DiYISDGK
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 2 USB Serial Cable
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
регистрация программного обеспечения (для чего оно стоит)
Starting download from /dev/my_d4i Starting the thread 0 [0.000126] ERROR: Inappropriate ioctl for device (25) [in ../../src/serial_posix.c:308 (dc_serial_open)] [0.000156] ERROR: Failed to open the serial port. [in ../../src/suunto_d9.c:155 (suunto_d9_device_open)] INFO: dc_deveice_open error value of -6 Finishing the thread Unable to open %s %s (%s) dives downloaded 0 Starting download from /dev/ttyUSB0 Starting the thread 0 INFO: dc_deveice_open error value of 0 Finishing the thread dives downloaded 0
