Jump to content

LabelFlash, Mode Sense and Get Configuration related questions


Recommended Posts

I'm working on my own program for Pioneer drives, called DVRTool, and struggling with some minor, but annoying issues, related to Mode Sense command. This command seems to work incorrectly on some SATA controllers (namely Marvell 88SE9128 in AHCI mode), and I've read somewhere that it's considered obsolete and Get Configuration should be used instead. But I don't know how to retrieve all the information about drive capabilities with Get Configuration only, so I've decided to ask my questions here.


1. Which command does ImgBurn use to detect LabelFlash capability?

In my program I use Mode Sense - Lableflash (5A 00 2D 00 00 00 00 00 FC 00), and if it returns any data, drive is considered LabelFlash-capable. Older version of ImgBurn also used this command (actually, I've stolen this command from there :)), but in newer version some other command is used. What is this command? I want to get rid of Mode Sense method, too, but can't find any replacement.

By the way, I've noticed long ago that ImgBurn detects iHASx24 B drives as LabelFlash-capable, which is not correct. Why does it happen?


2. Is it possible to get drive buffer size without Mode Sense - C/DVD Capabilities and Mechanical Status?

I haven't found this information in any Get Configuration profile... But ImgBurn detects buffer size correctly even on drives connected to Marvell 88SE9128 controller in AHCI mode, when my DVRTool shows buffer size as 0 kiB. Opti Drive Control correctly recognizes drive buffer size on that controller, too. Which command should be used to get the buffer size, except Mode Sense?


3. Is it possible to reliably detect the capability of the drive to read DVD-RW discs?

I have found no clear information about that, so I use indirect methods, checking Get Configuration - DVD-R/-RW Write profile presence, and checking MULTI110 bit of Get Configuration - DVD Read response data, but it doesn't work with DVD-ROM drives which can't read DVD-RAM discs (non DVD-Multi drives). Is it possible to reliably detect DVD-RW reading capability for such drives? Which method is currently used in ImgBurn?


Thanks in advance!

Link to comment
Share on other sites

1. Still just mode sense.

But I stopped specifically checking for 2D (yes, perhaps due to hanging) and instead ask for the full list... then check that list for the presence of 2D.

If 2D is supported, it's classed as being labelflash capable. Those liteon drives must report 2D ok and are therefore considered labelflash capable.

2. Not that I know of. I still only use that for the buffer size.

3. Not specifically, no. If the DVD Read feature (001F) is supported, I consider it able to read DVD-RW. Same goes if the DVD-R/-RW Write Feature (002F) is supported.



Link to comment
Share on other sites

Many thanks for answers, LIGHTNING UK!

So, if you still use Mode Sense command and it works fine even on that problematic controller, I think my issue is hidden somewhere in PLScsi, which I'm using to access the device. Well, at least I now know where to look for the cause of that bug. :)

And the last question I've forgotten to add in the first post: Does ImgBurn use some "special methods" for getting the data from "real" SCSI drives like old Plextor or Yamaha CD-R drives? I've found that Mode Sense - C/DVD Capabilities and Mechanical Status works different for these drives, and I'm getting really strange  values for buffer size and read/write capabilities for all media. But ImgBurn shows everything fine, even if the response of Mode Sense command is the same as in my program. Here is the photo, how it looks in ImgBurn and in DVRTool:






But the data returned by Mode Sense command is the same in ImgBurn and DVRTool - how is it possible?

ImgBurn log with Debug enabled:

I 20:42:24 Initialising Device (\\?\scsi#cdrom&ven_yamaha&prod_crw8424s&rev_1.0g#5&29e7a21d&0&000100#{53f56308-b6bf-11d0-94f2-00a0c91efb8b})...
I 20:42:24 Device Address: [4:1:0]
I 20:42:24 Drive Letter: (G:)
I 20:42:24 Family Tree:
I 20:42:24 -> Komputer z procesorem x86 obs³uguj±cy interfejs ACPI
I 20:42:24 -> System zgodny ze standardem Microsoft ACPI
I 20:42:24 -> Magistrala PCI
I 20:42:24 -> Mostek (bridge) Intel(R) 82801 PCI - 244E (VEN_8086&DEV_244E - Intel - pci)
I 20:42:24 -> Adaptec AHA-2910C/2915C/2920C/2930C PCI SCSI Controller (VEN_9004&DEV_5078 - Adaptec - aic78xx)
I 20:42:24 -> Stacja dysków CD-ROM (YAMAHA CRW8424S SCSI CdRom Device) (Bus Number 0, Target ID 1, LUN 0)
I 20:42:24 Device Maximum Transfer Length: 4*294*967*295
I 20:42:24 Device Maximum Physical Pages: 17
I 20:42:24 Device Alignment Mask: 0
I 20:42:24 Device Bus Type (Adapter/Device): SCSI / SCSI
I 20:42:24 [4:1:0] YAMAHA CRW8424S 1.0g (G:) (SCSI)
I 20:42:24 CDB: 12 00 00 00 60 00
I 20:42:24 CDB Interpretation: Inquiry
I 20:42:24 BUFFER: 05 80 02 02 27 00 00 10 59 41 4D 41 48 41 20 20 43 52 57 38 34 32 34 53 20 20 20 20 20 20 20 20 31 2E 30 67 32 30 2F 30 31 2F 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
I 20:42:24 [4:1:0] YAMAHA CRW8424S 1.0g (G:) (SCSI)
I 20:42:24 CDB: 5A 00 2A 00 00 00 00 00 FC 00
I 20:42:24 CDB Interpretation: Mode Sense (10) - Page Code (0x2A) - CD/DVD Capabilities and Mechanical Status
I 20:42:24 BUFFER: 00 24 00 00 00 00 00 08 00 00 00 00 00 00 02 00 2A 14 07 07 71 6F 29 03 0B 06 01 00 10 00 0B 06 00 00 01 61 01 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I 20:42:24 -> Drive 3 - Info: YAMAHA CRW8424S 1.0g (G:) (SCSI)


And here is what DVRTool is getting for this drive:

00 24 00 00 00 00 00 08 00 00 00 00 00 00 02 00
2a 14 07 07 71 6f 29 03 0b 06 01 00 10 00 0b 06
00 00 01 61 01 61 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


Received data is the same, as in ImgBurn! So, should it be processed differently in order to get necessary values?


Edited by Blackened2687
corrected a typo
Link to comment
Share on other sites

The returned data is made up of a mode page header, a block descriptor and then the page itself.

So you have to skip the header (8 bytes) and then the block descriptor (size taken from last 2 bytes of the header) in order to then read the actual mode page data.

As you've asked for mode page 0x2A, you know the LSB 6 bits (so & with 0x3F) in the first byte should be 0x2A, so you can use that as a sanity check.

Bytes 12 and 13 in that mode page are the buffer size and they're set to 0x1000, so that's 4096.

So maybe you just aren't parsing the returned data correctly?

I also fall back to Mode Sense (6) if Mode Sense (10) doesn't appear to be supported by the drive (invalid command op code or whatever). That may help on some really old drives.





Link to comment
Share on other sites

You were absolutely right! I haven't parsed this data correctly. I've re-checked the Mode Sense documentation and understood my mistake: I've completely ignored the Block Descriptor Length bytes in Mode Parameter Header, since I've never seen a non-zero value there (which is true for ATAPI/SATA devices). In MMC documentation it's said, that this value should be 8 for legacy SCSI Logical Units, so I've found SCSI-2 specification and read more about mode parameter block descriptors. Since I've never worked with real SCSI drives before, I've never actually seen any block descriptors, so this is quite a discovery for me. So, I just need to check these bytes, and if their value is non-zero, skip a block descriptor following the header.

Now everything is recognized correctly. I think I should implement Mode Sense (6), as well, for compatibility purposes.

Thank you VERY MUCH for the help! I've learn a lot today. :)

Link to comment
Share on other sites

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.