hidview and usb data in applications

I have a USB Logitech Rumblepad that seems to work fine w/QNX6. When I use ‘hidview -d2 -a’ (ie. because it is device #2 on my computer), I can see all of the beautiful data from the joysticks and buttons. Now I just want to get this same data from within a QNX application. I have been looking at the USB DDK and trying to decipher this problem from that end. But, it seems that using the HIDDI library (which does not seem to be documented anywhere, other than the header file at: sys/hiddi.h) would be so much easier since this is what hidview seems to be using. Can some USB guru advise me, or someone at least tell me a good way to use the shell ‘hidview’ command from within a QNX app (maybe send the ‘hidview’ output to a buffer or something?). This latter seems like a bad work around, but I’d really like to get this thing working sooner rather than later, so this project can move on. Thanks, -AM


Since you downloaded the DDK, why don’t you just use the mouse.c code and rename that you joystick.c.

That should work because the joystick/mouse are essentially the same trivial input devices.

In the mouse_resmgr_attach() function just change the /dev/mouse to /dev/joystick

In the mouse_start_driver function change the interest = {} so that the first 2 parameters are set to your joystick parameters (which you can obtain via a usb -vvv command) so this driver only gets run when the joystick is detected.

The mouse.c code is essentially a resource manager. So your app code can open /dev/joystick and then you can wait on data being available the same way you would with serial data.


That was my first approach, I figured out the vendor and product numbers, and did a case-sensitive Find/Replace for any mouse references. But, upon observation in the debugger, I was not getting any reaction upon insertion, removal, button presses, etc. The app made it successfully thru the joystick_start_driver (formerly ‘mouse’) function call, with no errors, and went into the joystick_signal_handler(), and just sat at: while( SignalWaitinfo( &set, &info ) == -1 ) , while I insert, remove, press buttons, etc.

I feel that I am pretty close from both the HID direction and the USB DDK direction, but there is just something I may not be doing right. There is clear evidence that Logitech joysticks can work:
ece.clemson.edu/crb/students … /index.htm
I’ve tried modifying this for my needs also (changing the product id), but still no response on insertion, removal, etc. No error codes from any calls that I’ve monitored here either, just a status of “Waiting for joystick” in this example.

I am using a USB keyboard and mouse for general computing in Photon, so are there any special things that I should be doing to hand over USB control to these applications when I start them?


I think I’ve made some headway using the (undocumented) HID functions and the Logitech Wingman example from Clemson. Using wildcard connection flags, combined with device# exclusion changes made all the difference. If anyone wants specifics, let me know, otherwise no need to followup unless I post again.



The undocumented HID functions are actually documented in a HID DDK document.

It’s never been released apparently (I assumed it would have been by now). In 2006 I was able to get a copy of the document from my QNX rep/QNX tech support because I was trying to interface with a HID I/O device for controlling digitial I/O.

The document was in beta format at that point. So can probably obtain a copy of the document the same way I did. Just be aware that support is minimal and the document isn’t polished.

I guess a joystick HID interface is a lot easier than a complex I/O device because I struggled for a long time trying to get things to work because there were over a dozen different report structures to be supported both incoming and outgoing.