I am in the progress of implementing a service which will detect usb plugin/removal using usbdi callback functions. Callback function has a parameter “usbd_device_instance_t * usbInstance” from which i can get device vendor id,product id and the device class information. But how do i get a mount point in case of a mass storage device and a device path in case of a HID device?
usblauncher does more than publishing information. It also manages the plug&play when USB devices are connected.
The rules file associated with USB launcher allows to launch a specific driver with/without specific options when a USB device is connected.
That’s the case for mass storage.
For HID devices, this is different. io-hid is in charge of their management. io-hid connects to the USB stack.
However, some HID devices are still managed by usb-launcher to launch a specific driver (iPod).
Yes. In my case, my application should handle all the USB Devices plugin/removal activities (which you described that usb launcher and io-hid takes care in qnx). My application should take the control over all the USB devices attached to the system(USB detection, loading a driver, mounting usb mass storage, etc). Is it possible to do all those things?
You can subscribe to a PPS directory.
With
fd_usb_device = open("/pps/qnx/device/.all?wait,delta", O_RDONLY);
your code gets notified when a device is connected/unconnected.
When reading the opened file, you immediately receive :
@usb_ctrl
When a device is connected, you get (just an example) :
This one Makes sense. One more idea stroked in my mind. Is it possible to identify the device object of the connected/disconnected device with the details returned by usbdi callback function?
How to identify the PID of the device object? so that i will be able identify the driver object belongs to the device object. How the device object, driver object and mount objects are related? Is there any way to identify the driver object and mount object of a device object without reading each file inside it?