All pastes #149447 Raw Edit

Miscellany

public text v1 · immutable
#149447 ·published 2006-08-25 20:42 UTC
rendered paste body
#!/bin/sh
[ -f /sys/${DEVPATH}/idVendor -a "$(cat /sys/${DEVPATH}/idVendor)" -ne "0000" ] && {
cd /sys/${DEVPATH}
for x in idVendor manufacturer idProduct product speed version; do
[ -f $x ] && { echo -ne "$x: " ; cat $x; }
done

NUM=${DEVPATH##*/}
HOST=$(find ${NUM}:*/host* -type d)
HOST=${HOST##*/}

echo -ne "waiting for disk"
while [ ! -b "/dev/scsi/${HOST}/bus0/target0/lun0/part1" ]; do {
echo -ne "."
sleep 1;
time=$((time+1)); [ $time -gt 10 ] && break
}; done

echo

mount "/dev/scsi/${HOST}/bus0/target0/lun0/part1" /mnt
cp /tmp/usbtest /mnt

old_md5=$(cat /tmp/usbtest | md5sum -)

sync
umount /mnt
mount "/dev/scsi/${HOST}/bus0/target0/lun0/part1" /mnt

new_md5=$(cat /mnt/usbtest | md5sum -)

if [ "$new_md5" != "$old_md5" ]; then
        echo "## USB WRITE FAILED ##"
else
        echo "## USB WRITE PASSED ##"
fi

rm /mnt/usbtest
umount /mnt

sleep 1
rmmod uhci-hcd ehci-hcd 2>&-
echo "## TEST DONE ##"
rm /tmp/usbtest 2>&-
} >> /dev/console