Keyboard simulation within a userspace component
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
23 Jul 2018 23:01 #114726
by InMyDarkestHour
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
I'm working on a user component using libevdev that may just be the answer.
Please Log in or Create an account to join the conversation.
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
24 Jul 2018 11:05 - 24 Jul 2018 11:12 #114739
by InMyDarkestHour
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
See this new thread for a proof of concept:
forum.linuxcnc.org/10-advanced-configura...m-via-userspace-comp
forum.linuxcnc.org/10-advanced-configura...m-via-userspace-comp
Last edit: 24 Jul 2018 11:12 by InMyDarkestHour.
Please Log in or Create an account to join the conversation.
24 Jul 2018 11:36 #114742
by rodw
Replied by rodw on topic Keyboard simulation within a userspace component
I have not written any userspace components but just wondering if the while(1) blocks execution at all?
Please Log in or Create an account to join the conversation.
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
24 Jul 2018 20:57 #114767
by InMyDarkestHour
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
From the docsFrom that I guess some form of loop is needed. (my basic understanding)
A While loop is used here
forum.linuxcnc.org/forum/18-computer/225...pendant-for-linuxcnc
option userspace yes - (default: no) If specified, this file describes a userspace (ie, non-realtime) component, rather than a regular (ie, realtime) one. A userspace component may not have functions defined by the function directive. Instead, after all the instances are constructed, the C function void user_mainloop(void); is called. When this function returns, the component exits. Typically, user_mainloop() will use FOR_ALL_INSTS() to perform the update action for each instance, then sleep for a short time. Another common action in user_mainloop() may be to call the event handler loop of a GUI toolkit.
A While loop is used here
forum.linuxcnc.org/forum/18-computer/225...pendant-for-linuxcnc
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
01 Aug 2018 01:15 #115273
by InMyDarkestHour
This company has some interesting products
www.hagstromelectronics.com/usb-asc232-shp.html
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
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.
This company has some interesting products
www.hagstromelectronics.com/usb-asc232-shp.html
Please Log in or Create an account to join the conversation.
01 Aug 2018 03:54 #115276
by dm17ry
Replied by dm17ry on topic Keyboard simulation within a userspace component
i did a membrane keyboard controller using a STM32 as a USB HID. it emulates a standard keyboard plus a bunch of other keys which were handled by hal_input comp. rotary encoder and analog joystick can switch between being a mouse with a wheel and linuxcnc's MPG and joystick. 24-pos rotary switch is handled by an ADC. drives a chain of RGB addressable LEDs. also has a few hardware buttons for cycle start/stop etc...
if someone interested can share the code, but it is a bit more than a little messy, i think...
if someone interested can share the code, but it is a bit more than a little messy, i think...
The following user(s) said Thank You: silopolis
Please Log in or Create an account to join the conversation.
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
01 Aug 2018 08:11 #115287
by InMyDarkestHour
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
Ok that is cool.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19202
- Thank you received: 6436
01 Aug 2018 09:01 #115291
by tommylight
Replied by tommylight on topic Keyboard simulation within a userspace component
+1Ok that is cool.
Please Log in or Create an account to join the conversation.
- InMyDarkestHour
- Offline
- User is blocked
Less
More
- Posts: 701
- Thank you received: 111
01 Aug 2018 11:08 #115298
by InMyDarkestHour
Replied by InMyDarkestHour on topic Keyboard simulation within a userspace component
I've just been playing around with some userspace hid code which reads stdin to emulate a simple 2 axis 6 button joystick.
One wonders if this could be extended to read a serial port rather than stdin and emulate a keyboard & joystick device.
Linux kernel sample code for user space HID.
github.com/torvalds/linux/blob/master/sa.../uhid/uhid-example.c
One wonders if this could be extended to read a serial port rather than stdin and emulate a keyboard & joystick device.
Linux kernel sample code for user space HID.
github.com/torvalds/linux/blob/master/sa.../uhid/uhid-example.c
Please Log in or Create an account to join the conversation.
01 Aug 2018 11:56 #115300
by andypugh
Replied by andypugh on topic Keyboard simulation within a userspace component
For a keyboard matrix like the one shown I think I prefer a system where:
1) The matrix is scanned in realtime, and keys with a real-time permanent function are netted directly.
2) Keys which are "only" used for typing and data entry are passed through to a user-space component to be converted to keystrokes.
This should remove the problem with keyboard-jogging where sometimes the OS appears to not spot the key-up code, leading to longer-than-desired jogs.
1) The matrix is scanned in realtime, and keys with a real-time permanent function are netted directly.
2) Keys which are "only" used for typing and data entry are passed through to a user-space component to be converted to keystrokes.
This should remove the problem with keyboard-jogging where sometimes the OS appears to not spot the key-up code, leading to longer-than-desired jogs.
The following user(s) said Thank You: silopolis
Please Log in or Create an account to join the conversation.
Time to create page: 0.111 seconds