forked from usb-tools/USBProxy-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request usb-tools#3 from BenGardiner/working_button_injector
Working button injector
- Loading branch information
Showing
3 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python | ||
import sys, os | ||
|
||
path='/dev/input/event0' | ||
os.chmod(path, 666) | ||
event_file = open(path,'w') | ||
|
||
#NB: valid layout on BBB -- not on x64 | ||
#int timestamp (1), int timestamp (2), short type, short code, int value -- all LSB | ||
|
||
#press key 3 | ||
event_file.write("\x00"*4+"\x00"*4+"\x01\x00"+"\x03\x00"+"\x01\x00\x00\x00") | ||
#release key 3 | ||
event_file.write("\x00"*4+"\x00"*4+"\x01\x00"+"\x03\x00"+"\x00\x00\x00\x00") | ||
#send syn report | ||
event_file.write("\x00"*4+"\x00"*4+"\x00\x00"+"\x00\x00"+"\x00\x00\x00\x00") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters