Keyboard simulation within a userspace component

More
8 years 3 months ago #114237 by DaOne
I am trying to create a custom keypad using an arduino to matrix the 130 key membrane keypad. I got the arduino side done sending each key as a code via serial. I plan to use the component that ArcEye created a while back as a base. I think I have all the pins figured as hal pins but I want the standard keyboard part to work as an actual keyboard for input. Is the a way in the .comp file to send a keystroke like if it was a real keyboard? Also if there is how would I handle "shift" commands? I can manage the shift key on the arduino side and just give every uppercase key a different key code.

Please Log in or Create an account to join the conversation.

  • AnnoyingMutt
  • New Member
  • New Member
More
8 years 3 months ago #114241 by AnnoyingMutt
Replied by AnnoyingMutt on topic Keyboard simulation within a userspace component
Why not go with USB ?

Free USB Stack, one I've used myself, www.fourwalledcubicle.com/LUFA.php

Please Log in or Create an account to join the conversation.

More
8 years 3 months ago - 8 years 3 months ago #114243 by DaOne
Did you happen to have any more information on your previous use? Not against using another method. I really want hal pins from all the keys other than the actual keyboard and number pad. Maybe this can be done in python?

Here is what I am working with...


Last edit: 8 years 3 months ago by DaOne.

Please Log in or Create an account to join the conversation.

  • AnnoyingMutt
  • New Member
  • New Member
More
8 years 3 months ago #114247 by AnnoyingMutt
Replied by AnnoyingMutt on topic Keyboard simulation within a userspace component
Best idea would be to look at the LUFA frame work, you maybe able to create a composite device eg Keyboard & joystick, Keyboard would be handled as per normal, and use hal_input for joysyick side.
linuxcnc.org/docs/2.7/html/man/man1/hal_input.1.html

There is also this:
generichid.sourceforge.net/
Makefile needs a bit of faffing around with, nothing too serious.

The code I wrote is for a joystick device,pretty much just extending the lufa example, it appears as a standard joystick, I used the hidcomp component from franksworkshop. I used a Arduino micro, but I have a Teensy floating around as I want a more complete panel.
I'd have to fire up the old Thinkpad & Beaglebone to look at the code but it's pretty boiler plate.

Please Log in or Create an account to join the conversation.

  • AnnoyingMutt
  • New Member
  • New Member
More
8 years 3 months ago #114255 by AnnoyingMutt
Replied by AnnoyingMutt on topic Keyboard simulation within a userspace component
I just had a thought, maybe there is a python library or code example you could use to send key events.

I found this, haven't given it a try, not too sure if it can be used at all.
github.com/boppreh/keyboard

Please Log in or Create an account to join the conversation.

More
8 years 3 months ago #114374 by andypugh
I did do this once. At one point the matrix_kb HAL component could be configured to send keystrokes. (so it would generate scan codes and also send key strokes via a system call).
linuxcnc.org/docs/2.7/html/man/man9/matrix_kb.9.html
However I removed this feature as it was concluded that the system call to generate key strokes wasn't thread-safe.

However, it ought to be possible to pass the scan-code to a user-space module written in Python.
stackoverflow.com/questions/13564851/how...ard-events-in-python
The second answer seems to suggest some very simple ways to do what you want.

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum