Device detection
SDBP device detection
SDBP devices should be detected using the RESTful API.
Low-level detection is possible via /sys/class/sdbp/ path.
USB device detection
For plug & play detection of USB based modules the USB descriptors should be used.
The USB standard specifies that every device must register itself using a standardized generic descriptor.
This descriptor should be used to select the device driver.
The Linux tool “lsusb” or the sysfs path (e.g: /sys/bus/usb/devices/1-1/) can be used to access the descriptor fields.
The “idVendor” and “idProduct” fields contain identifiers which are typically set by the usb chip vendor and may be used for driver selection.
Some devices, such as usb-to-serial converters, are very application specific and cannot be selected reliable by using the idVendor/idProduct fields.
For these devices the USB specification allows the implementation of optional USB “manufacturer”, “product” and “serial” fields.
Modules with our firmware
Modules running our customized firmware must be selected using the “manufacturer”, “product” and “serial” fields.
The “manufacturer” field contains the manufacturer name (e.g: “NOREYA”) which should be used for filtering.
The “product” field contains the product name including the hardware version (e.g: “NEXUS HUB V04.01.01”) and must be used for selection and compatibility check.
The “serial” field is set on most devices and contains the serial number.
The specific module page should be checked for details.
Modules with third party firmware
Modules with third party firmware should be selected by “idVendor/idProduct” fields.
Some of them may also have the “manufacturer/product/serial” fields which should be preferred if available.
The specific module page should be checked for details.
How to query devices
Libudev
The recommended way of querying devices for selection is to use “libudev”.
There are several bindings (Python, Java, Rust…) available for the C-library.
It allows to pre-filter for specific device classes (e.g: serial devices) and supports device add/removal events.
The udev fields use different names for the descriptor fields:
Descriptor | Udev |
---|---|
idVendor | ID_VENDOR_ID |
idProduct | ID_MODEL_ID |
manufacturer | ID_VENDOR |
product | ID_MODEL |
serial | ID_SERIAL_SHORT |
Sysfs
If the “libudev” library cannot be used the Linux “sysfs” can be parsed.
The root entry point is “/sys/bus/usb/devices/”.
Example:
Descriptor | Sysfs file |
---|---|
idVendor | /sys/bus/usb/devices/1-1/idProduct |
idProduct | /sys/bus/usb/devices/1-1/idVendor |
manufacturer | /sys/bus/usb/devices/1-1/manufacturer |
product | /sys/bus/usb/devices/1-1/product |
serial | /sys/bus/usb/devices/1-1/serial |