-
-
Save lsei/062bcec48c15ee89c7d4ec5510f7c001 to your computer and use it in GitHub Desktop.
Sony USB Jog Controller (PCVA-JC1)
This file contains hidden or 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
#!/usr/bin/env zsh | |
# requirements: hidapitester, sendkeys | |
doPress() { | |
cur+="$1" | |
sendkeys send --delay 0 --initial-delay 0 -c "$1" # faster than osascript | |
} | |
hidapitester --vidpid 054C/00C4 -l 4 --open --read-input-forever --quiet \ | |
| while read -r line; do | |
mask=`echo $line | grep '00$'` | |
if [[ ! -z $mask ]]; then | |
btn="0x${mask:0:2}" | |
dir="0x${mask:3:2}" | |
jog="0x${mask:6:2}" | |
cur="" | |
if (( (($btn >> 0) & 0x1) == 0x1 )) && doPress "A" | |
if (( (($btn >> 1) & 0x1) == 0x1 )) && doPress "B" | |
if (( (($btn >> 2) & 0x1) == 0x1 )) && doPress "C" | |
if (( (($btn >> 3) & 0x1) == 0x1 )) && doPress "D" | |
if (( (($btn >> 4) & 0x1) == 0x1 )) && doPress "E" | |
if (( (($btn >> 5) & 0x1) == 0x1 )) && doPress "F" | |
if (( (($dir >> 0) & 0x1) == 0x1 )) && doPress "P" | |
if (( (($dir >> 1) & 0x1) == 0x1 )) && doPress "U" | |
if (( (($dir >> 2) & 0x1) == 0x1 )) && doPress "D" | |
if (( (($dir >> 3) & 0x1) == 0x1 )) && doPress "L" | |
if (( (($dir >> 4) & 0x1) == 0x1 )) && doPress "R" | |
if (( $jog == 0x81 )) && doPress "<c:right>" #"→" | |
if (( $jog == 0xC1 )) && doPress "<c:left>" #"←" | |
if [[ -z $cur ]]; then | |
clear | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment