Difference between revisions of "Didj SCSI Commands"
(→List of Commands)
(→Sending the commands)
|Line 42:||Line 42:|
== Sending the commands ==
== Sending the commands ==
Revision as of 01:12, 15 April 2010
This is a list and a couple methods of how to send SCSI Commands to the Didj. Which can be used for various tasks, such as unlocking, locking, and ejecting the Didj's USB storage.
SCSI Utility v 0.1 or equivalent
sg3_util comes stock with Ubuntu 9.10
List of Commands
Inquiry = 0x12 - returns product id, vendor id, device revision information. (Requires return Buffer Size be set to 96 bytes 0xFF seems to work in most cases, this is also a 6 byte command, where the others are 10).
Lock Device = 0xC1 - locks Didj usb storage so it can't be accessed (Return Buffer Size 0).
Unlock Device = 0xC2 - unlocks Didj usb storage so it can be accessed (Return Buffer Size 0).
Get Setting = 0xC3 - (returns 1 byte for Battery Level, and 4 bytes for RTC, 1 byte bool for needs_repair)
The second byte of the command is the setting value
- RTC Counter 1
- Battery Level 2
- Serial Number 3 (Listed in usb driver, but returns nothing.)
- Needs Repair 6
Set Setting = 0xC4 - (unknown at this time, probably requires extra parameters, looking at the usb driver, needs_repair might be settable)
Clear Upload Data = 0xC5 - (unknown at this time returns error, only found in scsi_custom).
Disconnect Ok = 0xC6 - Used for ejecting the Didj, will also cause it to check for new lighting boot or firmware file versions, and install them if present (Return Buffer Size 0).
Num Device Commands = 0xC7 - (unknown at this time returns error, only found in scsi_custom).
Device Cmd Undefined = 0xFF - (unknown at this time returns error, only found in scsi_custom).
Sending the commands
All the custom commands are 10 byte, some of the standard SCSI Commands are 6 byte, and may require extra values than 00 for certain bytes. For the Get/Set commands, you'll need to have Byte 1 the second byte, be the number of the setting you want, and for get you'll need to provide a buffer size.
Turn on Didj with USB connected. Then open SCSI Utility, under devices look for "LeapFrogDidj" and right click on it, choose 'Execute Custom CDB' which will bring up the Custom CDB dialog.
In BYTE 0 put the Command value, C1,C2,C3...Cn
For BYTE 1 thru BYTE 9 put the value 0 in
For BYTE 10 thru BYTE 15 leave them blank.
CDB Size should equal 10.
For Buffer Size value put 0.
Then click Execute, there will be a warning dialog box, as the wrong command to the wrong drive, could cause serious issues, make sure LeapFrogDidj is the drive selected, and click Yes.
In the Output windows you should get something like "Custom CDB: Custom CDB executed successfuly".
If ejecting, the Didj should change screen images to the Ok to disconnect screen, if unlocking in WinXP Autoplay searches, before coming up with the dialog asking what you want to do.
In Linux Turn on Didj with USB connected.
Tail your messages with
$ sudo tail -f /var/log/messages
Plug in your Didj to the USB
Look in your messages for something like this
kernel: sd 5:0:0:0: Attached scsi generic sg2 type 0
Your looking for the sg with a number sg0, sg1, sg2 etc.
Make sure you got sg3_utils installed, it came stock with Ubuntu 9.10 for me. The command you'll be using is sg_raw.
To unlock the Didj
$ sg_raw /dev/sg2 C2 00 00 00 00 00 00 00 00 00
To eject the Didj
First unmount the Didj
$ sg_raw /dev/sg2 C6 00 00 00 00 00 00 00 00 00
To lock the Didj
$ sg_raw /dev/sg2 C1 00 00 00 00 00 00 00 00 00
Double check you got the right device, as the wrong command to the wrong device, can be catastrophic.