Kobboi l33t
Joined: 29 Jul 2005 Posts: 672 Location: Belgium
|
Posted: Mon Mar 23, 2009 1:42 pm Post subject: Finding devices of a certain type with HAL |
|
|
A script I wrote needs to list all serial devices available on my system. I tried to give it a go with HAL (first time use).
One of my machines has two PCI cards that provide extra serial interfaces, one card sold by Moxa, one by Digi.
1) The Moxa one has in-kernel drivers. The devices are referred to as /dev/ttyMI<index>.
Code: | # hal-find-by-capability --capability serial
/org/freedesktop/Hal/devices/pci_8086_29b7_serial_platform_1
/org/freedesktop/Hal/devices/pnp_PNP0501_serial_platform_0
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_7
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_6
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_5
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_4
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_3
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_2
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_1
/org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_0 |
and, for example,
Code: | hal-get-property --udi /org/freedesktop/Hal/devices/pci_1393_1680_serial_unknown_2 --key serial.device
/dev/ttyMI2
|
Neat!
2) The Digi one I compiled some beta drivers for that I found lying around on the Digi server. The devices are referred to as /dev/tty_dgdm_G<index>.
Code: | # hal-find-by-capability --capability serial
/org/freedesktop/Hal/devices/pci_8086_29b7_serial_platform_1
/org/freedesktop/Hal/devices/pnp_PNP0501_serial_platform_0 |
Alas, the devices are not listed, I only see the parent device.
Code: | 55: udi = '/org/freedesktop/Hal/devices/pci_114f_40'
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1e.0/0000:03:02.0' (string)
pci.vendor = 'Digi International' (string)
info.subsystem = 'pci' (string)
info.parent = '/org/freedesktop/Hal/devices/pci_8086_244e' (string)
info.vendor = 'Digi International' (string)
info.product = 'AccelePort Xp' (string)
pci.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1e.0/0000:03:02.0' (string)
pci.product = 'AccelePort Xp' (string)
info.udi = '/org/freedesktop/Hal/devices/pci_114f_40' (string)
info.linux.driver = 'dgdm' (string)
pci.subsys_vendor = 'Digi International' (string)
pci.product_id = 64 (0x40) (int)
linux.hotplug_type = 2 (0x2) (int)
pci.vendor_id = 4431 (0x114f) (int)
linux.subsystem = 'pci' (string)
pci.subsys_product_id = 68 (0x44) (int)
pci.subsys_vendor_id = 4431 (0x114f) (int)
pci.device_class = 7 (0x7) (int)
pci.device_subclass = 128 (0x80) (int)
pci.device_protocol = 0 (0x0) (int) |
What is missing in my setup/configuration/... for this to behave like the Moxa card/devices? |
|