So I've confirmed that sd_get_parms is returning -1 here (by using
printf() statements in /usr/src/sys/scsi/sd.c):

1671: if (sd_read_cap(sc, flags) != 0)
1672:        return -1;

Then then sets this error variable to -1:
218: error = sd_get_parms(sc, sd_autoconf);

Then this check is false, and is bypassed:

222: if (error == 0) {
223:     printf("%s: %lluMB, %u bytes/sector, %llu sectors",
...

This explains why I'm not seeing seeing the "bytes/sector" output.

On Tue, May 12, 2020 at 10:15 PM Andrew Klaus <and...@aklaus.ca> wrote:
>
> I recently tried using a USB Flash Drive (64GB Capacity) under OpenBSD
> 6.7 on both amd64 and arm64. It's detected as a umass0 device, but
> won't display the disksize/sector line in dmesg and is not available
> for me to use as a drive. This drive does work on other operating
> systems, so I know the drive is functional.
>
> I compiled with options SCSIDEBUG and UMASS_DEBUG, and now seeing this in 
> dmesg:
>
> umass0 at uhub0 port 9 configuration 1 interface 0 "PNY Technologies
> USB 3.0 FD" rev 3.00/1.00 addr 2
> umass0: using SCSI over Bulk-Only
> scsibus4 at umass0: 2 targets, initiator 0
> probe(umass0:1:0): got 36 of 55 bytes of inquiry data:
> ------------------------------
> 000: 00 80 06 02 33 00 00 00 50 4e 59 00 00 00 00 00
> 016: 55 53 42 20 33 2e 30 20 46 44 00 00 00 00 00 00
> 032: 00 00 00 00
> ------------------------------
> probe(umass0:1:0): got 55 of 55 bytes of inquiry data:
> ------------------------------
> 000: 00 80 06 02 33 00 00 00 50 4e 59 00 00 00 00 00
> 016: 55 53 42 20 33 2e 30 20 46 44 00 00 00 00 00 00
> 032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 048: 00 00 00 00 00 00 00
> ------------------------------
> scsi_inqmatch:  match priority 2. T_DIRECT T_REMOV <"", "", "">
> sd0 at scsibus4 targ 1 lun 0: <PNY, USB 3.0 FD, > SCSI/SPC-4 removable
> serial.154b......
> probe(umass0:1:0): state 0, luns 1, openings 1
> probe(umass0:1:0): flags (0x0801) <REMOVABLE, UMASS>
> probe(umass0:1:0): quirks (0x4008) <NOTAGS, ONLYBIG>
> sd0(umass0:1:0): Check Condition (error 0) on opcode 0x1e
> sd0(umass0:1:0): Check Condition (error 0) on opcode 0x9e
> sd0(umass0:1:0): read capacity 10 data:
> ------------------------------
> 000: 00 00 00 00 00 00 00 00
> ------------------------------
> sd0(umass0:1:0): Check Condition (error 0) on opcode 0x1e
> sd0(umass0:1:0): Check Condition (error 0) on opcode 0x9e
> sd0(umass0:1:0): read capacity 10 data:
> ------------------------------
> 000: 00 00 00 00 00 00 00 00
> ------------------------------
>
> When trying to edit it under fdisk, it gives me Device not configured:
>
> # fdisk -e /dev/rsd0c
> # fdisk: /dev/rsd0c: Device not configured
>
> I presume this has to something to do with the "read capacity 10 data"
> showing null bytes. I looked at this field with other (working) USB
> Flash drives and they have non-null data here.
>
> My knowledge in this area is limited, but I'd like to learn how to fix
> this. I know I could just get another flash drive, but I enjoy the
> challenge.
>
> Any pointers on where to go from here would be really appreciated.
>
> Thanks!

Reply via email to