Control panel, MUX wiring help

More
01 Feb 2021 01:20 #197268 by rodw
Replied by rodw on topic Control panel, MUX wiring help

I think the keyboard module requires root.


Seems so but I think It just gets the keys using a program called dump. You could try saving the dump to a text file and using that.

But also pyAutoGUI seems to do the same thing.

pyautogui.readthedocs.io/en/latest/#

Man the last time I played with this stuff it was in the DOS days.

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

More
01 Feb 2021 01:26 #197269 by rodw
Replied by rodw on topic Control panel, MUX wiring help

I have not tried this but:
You should be able to write a component in Python to "stuff" data (single character or a string) into the keyboard buffer.


The first version of matrix_kb had this capability. But it did it by calling external kernel routines, and there was a worry that we had no way to know that these were thread-safe so it was taken out.

This commit is where I removed that code:
github.com/LinuxCNC/linuxcnc/commit/b494...c3b3790a457e1ed354c8
So if that was all put in a separate userspace component, the matrix_kb could look (partially) like a standard keyboard to the OS.
(In a userspace component there is no need to worry about thread safety)


I wonder how this would be treated in PREMPT_RT? I thought it basically removed any non-thread safe code.

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

More
01 Feb 2021 01:32 #197270 by andypugh

I wonder how this would be treated in PREMPT_RT? I thought it basically removed any non-thread safe code.


userspace HAL components (In C and Python) work in all supported realtime systems.
The following user(s) said Thank You: rodw

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

More
01 Feb 2021 02:45 #197273 by rodw
Replied by rodw on topic Control panel, MUX wiring help
So this example from the page above seems to work just from the python prompt
import pyautogui
pyautogui.write('Hello world!', interval=0.25)  # type with quarter-second pause in between each key

Auto types "Hello World" If you Select a text editor, it still types happily away

There seems to be a lot more you can do.
This is cool too
pyautogui.alert('This is the message to display.') # Make an alert box appear and pause the program until OK is clicked.

It would be pretty easy from here to make it a real keyboard...

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

More
01 Feb 2021 08:18 #197284 by RotarySMP
Luckily I sold that Maho menbrane keyboard, before you guys tempted me down this rabbit hole :)
The following user(s) said Thank You: rodw

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

More
03 Feb 2021 00:10 #197495 by andypugh
I am well down the rabbit hole, I have a HAL component that consumes the scancodes from matrix_kb or from a 7i73 and converts them to keystrokes.

I even had a prox limit switch connected via an STMBL drive typing the letter "c" in the terminal.

But then I broke it again, but it seems that it will work.

Watch this space.
The following user(s) said Thank You: RotarySMP, rodw

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

More
03 Feb 2021 00:23 #197497 by rodw
Replied by rodw on topic Control panel, MUX wiring help

I even had a prox limit switch connected via an STMBL drive typing the letter "c" in the terminal.

But then I broke it again, but it seems that it will work.

Watch this space.


So was it C for Curious or C for Cool?

Sounds exciting either way! I have a circuit board here waiting on one part before it turns into a shield for the 7i73... well hoping a mate will turn it into said shield cos he's much more into SMD soldering than I am!

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

More
03 Feb 2021 11:51 #197542 by RotarySMP
Maybe one of these set up as a fourth axis (C Axis) to push the button on the keyboard for you :)

Mark
The following user(s) said Thank You: tommylight, Clive S, rodw

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

More
03 Feb 2021 16:30 #197566 by tommylight
LOL, this one has evolved a fair bit ! :)

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

More
03 Feb 2021 21:33 #197596 by Todd Zuercher
Not sure why, but that really struck me funny. Thanks
The following user(s) said Thank You: tommylight

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

Time to create page: 0.409 seconds
Powered by Kunena Forum