Control panel, MUX wiring help

More
5 years 9 months ago #197261 by phillc54
I think the keyboard module requires root.

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

More
5 years 9 months ago - 5 years 9 months ago #197262 by andypugh

rodw wrote: 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)
Last edit: 5 years 9 months ago by andypugh.

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

More
5 years 9 months ago #197268 by rodw
Replied by rodw on topic Control panel, MUX wiring help

phillc54 wrote: 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
5 years 9 months ago #197269 by rodw
Replied by rodw on topic Control panel, MUX wiring help

andypugh wrote:

rodw wrote: 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
5 years 9 months ago #197270 by andypugh

rodw wrote: 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
5 years 9 months ago #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
Code:
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
Code:
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.

Time to create page: 0.263 seconds
Powered by Kunena Forum