Skip to content

Instantly share code, notes, and snippets.

@binkybear
Created January 4, 2016 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save binkybear/25bef6e646adc619b4a5 to your computer and use it in GitHub Desktop.
Save binkybear/25bef6e646adc619b4a5 to your computer and use it in GitHub Desktop.
NH - Read text file > output to hid
#!/bin/bash
INPUT=$1
HIDKEY="/system/xbin/hid-keyboard"
while IFS= read -r -N 1 char; do
if [ "$char" == $'\n' ] || [ "$char" == $'\r' ]; then
# For each new line = return key
echo enter | $HIDKEY /dev/hidg0 keyboard
else
echo "$char" | $HIDKEY /dev/hidg0 keyboard
fi
done < "$INPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment