Is it technically possible to send directx button inputs using a keyboard?

Started by
2 comments, last by Ravyne 12 years, 6 months ago
Ok, this may sound really weird to you guys but I'll explain in more details what I'm trying to achieve if I get positive feedback...


Not sure exactly how game device drivers works yet, I'm reading on that since a little while, but I was wondering if it was possible to either write a custom keyboard driver that would make the keyboard detected as a gaming device in windows or, if not possible, to make they keyboard sends dx inputs, by maybe using a driver filter of some kind...


To make a long story short, I'm trying to use a USB keyboard controller card to build a customized joystick and would like the thing to be seen as a joystick OR to send "joystick inputs" to windows.


Thanks for helping!


Fred
Advertisement
I'm not an expert on this by any stretch, so this is just some speculation to help you in your research :-)

  • I believe that USB devices provide an identification of their general type to the OS when they are connected. I don't know the specifics of this, though.
  • I do know that there are devices (e.g. some Arduino variants) that can be configured to tell the OS they are different types of USB device.
  • As far as I know, DirectX looks for a particular device type category for treating things as joysticks. This is just a guess, though.
  • If your controller is programmable in any way, you should be able to tell it to self-identify as anything you like; if it is not, you might be stuck unless you change hardware.
  • I'm almost positive I've seen Arduino-based joystick setups on the web, so you might explore that as a possible source of inspiration.


Sounds like a cool project, hope you get it figured out! :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


I'm not an expert on this by any stretch, so this is just some speculation to help you in your research :-)

  • I believe that USB devices provide an identification of their general type to the OS when they are connected. I don't know the specifics of this, though.
  • I do know that there are devices (e.g. some Arduino variants) that can be configured to tell the OS they are different types of USB device.
  • As far as I know, DirectX looks for a particular device type category for treating things as joysticks. This is just a guess, though.
  • If your controller is programmable in any way, you should be able to tell it to self-identify as anything you like; if it is not, you might be stuck unless you change hardware.
  • I'm almost positive I've seen Arduino-based joystick setups on the web, so you might explore that as a possible source of inspiration.


Sounds like a cool project, hope you get it figured out! :-)


Hey thanks a lot for your input, that will give me some leads to go after.

Regarding bullet #1, I'm pretty sure you're right, the device IC is most probably programmed to provides that info when you connect it to the computer. I also found some device that does what you describe, i.e. identifies their inputs either as a game button, key press and other things (the U-HID board does that) and it does so by programming the device IC, but I can't flash my keyboard controller so this isn't an option for me.

The device I need to build is basically a panel with toggle switches and pushbuttons - no axis. The problem with using a keyboard card with a toggle switch is that when on, it will repeat the keypress over and over. My plan B is to try to write a keyboard filter driver that would set the Typematic_rate to none, that would eliminate the repeat problem. I also have to try and break the 4 simulataneous keypress limit in case I need to have more than 4 switches on at the same time. So the idea would be to send one keypress event only and then one key_release when the switch is turned off... if it's ever possible to do so.


Anyways, I might have to try and get some info from the MSDN forum for that part, I've never really worked with driver and filters programming.


Thanks a lot again for the input, I'll continue my research. If anyone has any ideas, please let me know.



Cheers!
It ought to be possible to do what you're asking, and there may even be existing software available, but if you're inclined towards some light embedded development, it would be fairly feasible to grab a microcontroller that supports USB and write firmware for it to identify and act as a HID joystick. Certain models of Arduino would make a decent choice, but there's also a product called a bitwacker which SparkFun sells here: 8-bit and 32-bit that might be a little more turn-key.

How unique of a device are we talking here? How many buttons? The path of least resistance might be to tear apart a PC or game console controller and use that as your basis.

Another really good option if you just need a handful of digital buttons would be one of these parts from RetroZone.

throw table_exception("(? ???)? ? ???");

This topic is closed to new replies.

Advertisement