01-24-2013 04:48 AM
Just wanted to share this discovery and wonder if anyone can shed any light on it...
Usually I build response buttons for running psychology programs using the excellent joystick-emulating chips from www.codemercs.de, but I was wondering if there was a cheap wireless solution out there. I came across the Logic3 media remote control:
http://www.logic3.com/pc-media-remote-control.html
This device appears to windows as a HID-compliant consumer control device. I was a bit dismayed at first because when I looked into accessing a HID device using Windows API calls it looks horrendously complicated; there is nothing as straightforward as a HID_ReadButtons function!
Out of curiosity and a bit of desperation I wondered if it would appear to Labview as a keyboard, because keyboards sometimes have media control buttons. It doesn't. In Query Input Devices.vi it pops up as two joysticks! One has 3 buttons and is called "Wireless USB", the other has 26 buttons and is also called "Wireless USB". The buttons on the device map to some of the higher-numbered buttons on the second joystick.
Is this behaviour in any way expected or predictable? Does Labview label anything that is not a keyboard or a mouse as a joystick?
If anyone has a media control device from a different manufacturer I would be curious to know whether it behaves in a similar way.
Anyway, I have found a cheap and easy to use wireless response / control device. I thought other folks might be interested in that.
- Chris
01-24-2013 04:56 AM - edited 01-24-2013 05:01 AM
LabVIEW has no part in this at all! It simply shows you whatever the OS has determined as being a joystick, and that again depends on how the device announces itself when the host controller enumerates all attached USB devices. Lucky for you that the device manufacturer decided to emulate an USB joystick (and that LabVIEW has the joystick API). The manufacture could have chosen to announce its device as generic HID device and then there is nothing you could do besides digging into the HID specifications and accessing the Windows HID APIs in some ways (or have somone else do it and access that driver as DLL, ActiveX component or .Net assembly). Or he could have decided to announce it as keyboard with some arbitrary button to letter mapping. Whatever the manufacturer does, there is no way LabVIEW could enumerate arbitrary USB devices out of the box and definitely not translating them into something else itself.
01-24-2013 05:08 AM
Thanks Rolf,
I'm not sure that's true, because:
(1) The device does not show up as a joystick in Windows Device Manager
(2) When the device is plugged in it is immediately able to control the functions of Windows Media Player (play, stop, etc.) without installing any driver or any other intervention from the user, which means that Windows knows it is a media controller; it does not think it is a joystick.
01-24-2013 06:00 AM - edited 01-24-2013 06:02 AM
Or Windows Media Controller also allows to use Joysticks for control.
Or the device somehow announces two different devices at the same time.
Or Windows itself does some Joystick<>Media Controller mapping. They often do such things especially with Media devices.
01-28-2013 10:05 AM
Addendum:
I bought a cheap IR media controller on Ebay. Labview recognises it too as a joystick. One with 573 buttons!
On this one I can't read any of the buttons using the get joystick data vi. I presume that's becausethe various functions are allocated to button numbers higher than the 32 that the vi returns. Which raises some more questions: The new controller shares some button functions with the old one (play, stop, etc.) so why doesn't it use the same "pseudo-joystick" button numbers for those functions? Could it be that the function to button number mapping is somehow defined in the USB device itself?