OpenQNX :: The QNX Community Portal

Jul 05, 2008 - 12:16 AM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 46 unlogged users and 0 registered users online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amc
Post subject: hidview and usb data in applications  PostPosted: Mar 13, 2008 - 10:29 PM
Active Member


Joined: Sep 19, 2007
Posts: 12

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
 
 View user's profile Send private message  
Reply with quote Back to top
Tim
Post subject:   PostPosted: Mar 14, 2008 - 02:14 PM
Senior Member


Joined: Mar 10, 2004
Posts: 536

AMC,

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.

Tim
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
amc
Post subject:   PostPosted: Mar 14, 2008 - 03:47 PM
Active Member


Joined: Sep 19, 2007
Posts: 12

Tim,
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:
http://www.ece.clemson.edu/crb/students/vilas/projects/wingman3d/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?

Thanks,
-Arthur
 
 View user's profile Send private message  
Reply with quote Back to top
amc
Post subject:   PostPosted: Mar 14, 2008 - 09:20 PM
Active Member


Joined: Sep 19, 2007
Posts: 12

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.

Thanks,
AM
 
 View user's profile Send private message  
Reply with quote Back to top
Tim
Post subject:   PostPosted: Mar 17, 2008 - 01:58 PM
Senior Member


Joined: Mar 10, 2004
Posts: 536

AM,

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.

Tim
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.