Closed OLLYDOTDEV closed 3 years ago
Once I had connected the RPI to my test bench (my desktop) with a USB cable. this USB cable must be connected to the RPI zero w data USB NOT the power USB port.
then to test if there was an HID connection with my test bench
i used the example HID cli command found in the Repo README.md
P4wnP1_cli hid run -c 'type("Hello world")'
and just as expected it typed Hello world
the great thing about this is that due to the fact that is running of the bash command line I am able to put this to a bash script file (.sh) and these files can be run from RPI.cpp
.
from here I can start making some more useful HID scripts
a function that is a simple but yet universally recognized in the short cut to the lock screen (Windows, Linux, macOS)
So in the last hid script the type
function was used which just directly takes the input in types it out
The other important function is the press
function this allows the uses of modifier keys
The modifier keys are
LEFT_CTRL RIGHT_CTRL LEFT_ALT RIGHT_ALT LEFT_SHIFT RIGHT_SHIFT LEFT_GUI RIGHT_GUI P4wnP1 allows using aliases for common modifiers CTRL == CONTROL == LEFT_CTRL ALT == LEFT_ALT SHIFT == LEFT_SHIFT WIN == GUI == LEFT_GUI https://github.com/OLLYDOTDEV/P4wnP1_aloa
with that, I can take that knowledge to make
P4wnP1_cli hid run -c 'press("GUI l")'
and well this locks the screen on Linux and windows anyway, I don't have a mac to test on
but here is the test on my personal system
added to the HID
folder is also desktop.sh
,lock.sh
,switch.sh
as some to suit some potentially common use cases infrastructures will be in a place where end users can add their own custom hid. but with having HID scripts made, the next move it is to integrate them with the rest of the system as will be seen in #21
As a developer I will need to use HID (human interface device) scrips emulate a keyboard to control the computer So that #21 can utilize these scrips