Difference between revisions of "Didj SCSI Commands"

From eLinux.org
Jump to: navigation, search
(Created page with '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…')
 
m (In windows)
 
(7 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
'''In windows'''
 
'''In windows'''
  
SCSI Utility v 0.1 or equivalent
+
SCSI Utility v 0.1 or equivalent, note SCSI Utility is kind of buggy.
  
 
'''In Linux'''
 
'''In Linux'''
  
sg3_util comes stock with Ubuntu 9.10
+
sg3_util
 
+
  
 
== List of Commands ==
 
== 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).
+
* 0x12 =  Inquiry
 +
** 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).
+
* 0xC1 = Lock Device
 +
** 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).
+
* 0xC2 = Unlock Device
 +
** 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)
+
* 0xC3 = Get Setting
 +
** Returns 1 byte for Battery Level, 4 bytes for RTC, and 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
 +
 +
* 0xC4 = Set Setting
 +
** Not actually Implemented
  
Set Setting = 0xC4 - (unknown at this time, probably requires extra parameters, returns error)
+
* 0xC5 = Clear Upload Data
 +
** Not Implemented
  
Clear Upload Data = 0xC5 - (unknown at this time returns error).
+
* 0xC6 = Disconnect Ok
 +
** 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).
  
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).
+
*0xC7 = Num Device Commands
 +
** Not Implemented
  
Num Device Commands = 0xC7 - (unknown at this time returns error).
+
* 0xFF = Device Cmd Undefined
 +
** Not Implemented
  
Device Cmd Undefined = 0xFF - (unknown at this time returns error).
+
== 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.
  
  
== Sending the commands ==
+
====In Windows ====
'''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.
 
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.
Line 52: Line 67:
 
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.
 
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 ====
'''In Linux'''
+
 
Turn on Didj with USB connected.
 
Turn on Didj with USB connected.
  
Line 59: Line 73:
 
Tail your messages with
 
Tail your messages with
  
$ sudo tail -f /var/log/messages
+
$ sudo tail -f /var/log/messages
  
  
Line 76: Line 90:
 
To unlock the Didj
 
To unlock the Didj
  
$ sg_raw /dev/sg2 C2 00 00 00 00 00 00 00 00 00
+
$ sg_raw /dev/sg2 C2 00 00 00 00 00 00 00 00 00
  
  
Line 83: Line 97:
 
First unmount the Didj
 
First unmount the Didj
  
$ sg_raw /dev/sg2 C6 00 00 00 00 00 00 00 00 00
+
$ sg_raw /dev/sg2 C6 00 00 00 00 00 00 00 00 00
  
  
 
To lock the Didj
 
To lock the Didj
  
$ sg_raw /dev/sg2 C1 00 00 00 00 00 00 00 00 00
+
$ sg_raw /dev/sg2 C1 00 00 00 00 00 00 00 00 00
  
 
== Caution ==
 
== Caution ==
  
 
Double check you got the right device, as the wrong command to the wrong device, can be catastrophic.
 
Double check you got the right device, as the wrong command to the wrong device, can be catastrophic.
 +
 +
[[Category:Didj]]
 +
[[Category:LeapFrog Pollux Platform]]

Latest revision as of 07:22, 14 July 2011

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, note SCSI Utility is kind of buggy.

In Linux

sg3_util

List of Commands

  • 0x12 = Inquiry
    • 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).
  • 0xC1 = Lock Device
    • Locks Didj usb storage so it can't be accessed (Return Buffer Size 0).
  • 0xC2 = Unlock Device
    • Unlocks Didj usb storage so it can be accessed (Return Buffer Size 0).
  • 0xC3 = Get Setting
    • Returns 1 byte for Battery Level, 4 bytes for RTC, and 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
  • 0xC4 = Set Setting
    • Not actually Implemented
  • 0xC5 = Clear Upload Data
    • Not Implemented
  • 0xC6 = Disconnect Ok
    • 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).
  • 0xC7 = Num Device Commands
    • Not Implemented
  • 0xFF = Device Cmd Undefined
    • Not Implemented

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.


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.