Didj SCSI Commands

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.

Programs Needed
In windows

SCSI Utility v 0.1 or equivalent

In Linux

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).

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 - (unknown at this time, "the only settings that can actually be retrieved over SCSI are kSettingBatteryLevel and kSettingRTCCounter" - from scsi_custom source)

Set Setting = 0xC4 - (unknown at this time, probably requires extra parameters, returns error)

Clear Upload Data = 0xC5 - (unknown at this time returns error).

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).

Device Cmd Undefined = 0xFF - (unknown at this time returns error).

Sending the commands
In windows

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

Caution
Double check you got the right device, as the wrong command to the wrong device, can be catastrophic.