raspberrypi / pico-bootrom-rp2040

Other
275 stars 41 forks source link

SCSI inquiry length is 37, should be 36 #14

Open dpgeorge opened 2 years ago

dpgeorge commented 2 years ago

With the RP2040 in bootloader mode, one gets:

$ sg_inq --only /dev/sdb
standard INQUIRY:
  PQual=0  PDT=0  RMB=1  LU_CONG=0  hot_pluggable=0  version=0x02  [SCSI-2]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  [Linked=0]  [TranDis=0]  CmdQue=0
    length=37 (0x25), but only fetched 36 bytes   Peripheral device type: disk
 Vendor identification: RPI     
 Product identification: RP2             
 Product revision level: 2   

Note that the length=37 but it should be 36.

The issue is this line: https://github.com/raspberrypi/pico-bootrom/blob/master/usb_device_tiny/scsi_ir.h#L32 The - 4 should be a - 5.

Originally discussed here: https://github.com/hathach/tinyusb/pull/1349

kilograham commented 2 years ago

interesting - i guess the TinyUSB bug was different (there was no shared lineage there)

Note this does not make the USB IF MSC tests complain!

dpgeorge commented 2 years ago

i guess the TinyUSB bug was different (there was no shared lineage there)

I think the USB spec is a bit hard to understand on what value to put in the additional length field. See discussion on the linked TinyUSB issue above.