#!/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