Skip to content

Instantly share code, notes, and snippets.

@jmingov
Forked from binkybear/gist:25bef6e646adc619b4a5
Created January 4, 2016 23:57
Show Gist options
  • Save jmingov/baa62db53ca26ad20241 to your computer and use it in GitHub Desktop.
Save jmingov/baa62db53ca26ad20241 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