When I tried to use this, however, I found that I have to reverse the sorting order (sort -r), because commands were only accepted by the last of the hidraw devices, not the first one. Is this due to latest changes in USB device ordering?
(base) max@max-framework:~/src/uhk-learn-layout$ ./uhk-cmd.sh "set keystrokeDelay 5" ; sleep 1; ./uhk-cmd.sh "tapKeySeq u d space minusAndUnderscore u enter"
set keystrokeDelay 5
tapKeySeq u d space minusAndUnderscore u enter
(base) max@max-framework:~/src/uhk-learn-layout$ ls -l
total 24
-rw-rw-r-- 1 max max 1075 Jun 23 2023 LICENSE
-rw-rw-r-- 1 max max 3483 Dez 23 04:05 README.md
-rwxrwxr-x 1 max max 175 Jun 11 10:01 uhk-cmd.sh
-rwxrwxr-x 1 max max 11021 Jul 6 2023 uhk-learn-layout.py
Which seems to work – the shell executes the intended ls -l command. Interestingly, I had to set keystrokeDelay; I never need that when I run tapKeySeq directly from macros. But I get the UHK to type the commands. (Because of Colemak mapping on the host OS, I have to send ud for the ls command… I know it’s weird…)
However, once this is complete, ERR flashes on the display. So I start up Agent to find the following error message:
Error at 1/2/1: Unrecognized command: inus
> 2 | inus enter
???
Are there some length restrictions in the commands?
Also, how can I send a sequence of commands, i.e. a whole macro such as:
set something...
tapKey something...
delayUntil...
tapKey something else...
etc.
But these are actually the commands I have used. I have copy/pasted directly from my terminal / shell output.
Aw… that won’t work for what I am trying to do. I would need to create that macro on the host system and somehow upload it to the UHK first. (But I also don’t want to keep frequently overwriting flash memory.)
I basically want to create some command sequences dynamically, and have the UHK execute them. Since they are not static, I can’t store them already in some fixed macros.
I can happily only send one command at a time, but I would need to know when the previous execution is finished. If I run a command such as setLedTxt 500 'ABC' then the uhk-cmd.sh returns immediately after sending the command, although the execution will take just over 500ms.
But these are actually the commands I have used. I have copy/pasted directly from my terminal / shell output.
That’s strange. It works fine for me.
I basically want to create some command sequences dynamically, and have the UHK execute them. Since they are not static, I can’t store them already in some fixed macros.
If you really need multiple commands, it should not be hard to send a string that contains newlines.
I am not sure if the parser will accept it, but I think it should.
If I run a command such as setLedTxt 500 'ABC' then the uhk-cmd.sh returns immediately after sending the command
If you run the command when previous usb-executed macro is still running, your command should report an error. This is since there is only one buffer for usb commands, so you can’t start another while the old one is still running.
Any ideas?
Yes, create your own firmware fork, or dig into AHK .