Last active
May 10, 2022 07:58
-
-
Save bjoern-r/47e9f972912fd5eec1321bda8e0cd1a0 to your computer and use it in GitHub Desktop.
script to control GB Cart reader/Writer BennVenn Joey Jr on linux
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
#!/bin/bash | |
#set -x | |
for drive in sd{a,b,c,d,e,f} | |
do | |
rdisk=$drive | |
## Warning: this will spin up the disk! | |
## TODO: just check for USB and or Vendor ID | |
if dd if=/dev/$rdisk bs=512 skip=0 count=1 status=none | grep -q BENNVENN ; then | |
echo Joey Jr Found at /dev/$rdisk | |
case $1 in | |
ROM) | |
echo Writing Rom... This may take minutes | |
dd if=$2 of=/dev/$rdisk bs=512 seek=37 | |
;; | |
FLASH) | |
echo Writing Flash Save... | |
dd if=$2 of=/dev/$rdisk bs=512 seek=65573 | |
;; | |
SRAM) | |
echo Writing SRAM... | |
dd if=$2 of=/dev/$rdisk bs=512 seek=65829 | |
;; | |
EEPROM) | |
echo Writing EEPROM... | |
dd if=$2 of=/dev/$rdisk bs=512 seek=66085 | |
;; | |
ROMLIST) | |
dd if=$2 of=/dev/$rdisk bs=512 seek=66341 | |
echo ROMLIST Update Complete | |
;; | |
MODE) | |
echo -n $2 | dd of=/dev/$rdisk bs=512 cbs=512 seek=66725 conv=sync | |
echo Mode set to $2 | |
sleep 1 | |
if [ $2 = "UPDATE" ] | |
then | |
dd if=$3 of=/dev/$rdisk bs=512 seek=66469 | |
echo Update Complete | |
break | |
fi | |
;; | |
esac | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment