Bug 184014

Summary: USB storage devices do not work in FreeBSD 9.2 or higher.
Product: Base System Reporter: Stan Gammons <s_gammons>
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: Open ---    
Severity: Affects Only Me CC: seb
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Stan Gammons 2013-11-16 03:40:00 UTC
USB Ethernet device works Ok, but USB thumb drive does not. Both worked fine in FreeBSD 9.1 Release.  Here is dmesg output from inserting the thumb drive.

umass0: <Kingston DT 100 G2, class 0/0, rev 2.00/1.00, addr 3> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x4100
umass0:2:0:-1: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <Kingston DT 100 G2 1.00> Removable Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: 7639MB (15644912 512 byte sectors: 255H 63S/T 973C)
da0: quirks=0x2<NO_6_BYTE>
(da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 00 00 00 01 00
(da0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed
(da0:umass-sim0:0:0:0): Error 5, Unretryable error
(da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 00 00 00 01 00
(da0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed
(da0:umass-sim0:0:0:0): Error 5, Unretryable error
(da0:umass-sim0:0:0:0): got CAM status 0x50
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device
(da0:umass-sim0:0:0:0): lost device - 0 outstanding, 5 refs
(da0:umass-sim0:0:0:0): removing device entry

How-To-Repeat: Occurs every time a USB thumb drive is inserted in USB port.
Comment 1 hans.petter.selasky 2013-11-16 10:49:37 UTC
Hi,



This is most likely not a USB issue, but rather belongs in the CAM / SCSI area.



You can try enabling USB quirks for your device.



--HPS

 

-----Original message-----

> From:Stan Gammons <s_gammons@charter.net <mailto:s_gammons@charter.net> >

> Sent: Saturday 16th November 2013 4:40

> To: freebsd-gnats-submit@FreeBSD.org <mailto:freebsd-gnats-submit@FreeBSD.org> 

> Subject: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.

> 

> 

> >Number:         184014

> >Category:       usb

> >Synopsis:       USB storage devices do not work in FreeBSD 9.2 or higher.

> >Confidential:   no

> >Severity:       non-critical

> >Priority:       low

> >Responsible:    freebsd-usb

> >State:          open

> >Quarter:        

> >Keywords:       

> >Date-Required:

> >Class:          sw-bug

> >Submitter-Id:   current-users

> >Arrival-Date:   Sat Nov 16 03:40:00 UTC 2013

> >Closed-Date:

> >Last-Modified:

> >Originator:     Stan Gammons

> >Release:        9.2 Release

> >Organization:

> >Environment:

> FreeBSD gateway2.home.pc 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Fri Sep 27 03:52:52 UTC 2013     root@bake.isc.freebsd.org <mailto:root@bake.isc.freebsd.org> :/usr/obj/usr/src/sys/GENERIC  i386

> >Description:

> USB Ethernet device works Ok, but USB thumb drive does not. Both worked fine in FreeBSD 9.1 Release.  Here is dmesg output from inserting the thumb drive.

> 

> umass0: <Kingston DT 100 G2, class 0/0, rev 2.00/1.00, addr 3> on usbus4

> umass0:  SCSI over Bulk-Only; quirks = 0x4100

> umass0:2:0:-1: Attached to scbus2

> da0 at umass-sim0 bus 0 scbus2 target 0 lun 0

> da0: <Kingston DT 100 G2 1.00> Removable Direct Access SCSI-0 device

> da0: 40.000MB/s transfers

> da0: 7639MB (15644912 512 byte sectors: 255H 63S/T 973C)

> da0: quirks=0x2<NO_6_BYTE>

> (da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 00 00 00 01 00

> (da0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed

> (da0:umass-sim0:0:0:0): Error 5, Unretryable error

> (da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 00 00 00 01 00

> (da0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed

> (da0:umass-sim0:0:0:0): Error 5, Unretryable error

> (da0:umass-sim0:0:0:0): got CAM status 0x50

> (da0:umass-sim0:0:0:0): fatal error, failed to attach to device

> (da0:umass-sim0:0:0:0): lost device - 0 outstanding, 5 refs

> (da0:umass-sim0:0:0:0): removing device entry

> >How-To-Repeat:

> Occurs every time a USB thumb drive is inserted in USB port.

> >Fix:

> 

> 

> >Release-Note:

> >Audit-Trail:

> >Unformatted:

> _______________________________________________

> freebsd-usb@freebsd.org <mailto:freebsd-usb@freebsd.org>  mailing list

> http://lists.freebsd.org/mailman/listinfo/freebsd-usb <http://lists.freebsd.org/mailman/listinfo/freebsd-usb> 

> To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org <mailto:freebsd-usb-unsubscribe@freebsd.org> "

> 




Comment 2 Stan Gammons 2013-11-16 13:31:28 UTC
On 16/11/13 04:49, Hans Petter Selasky wrote:
> RE: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.
> Hi,
>
> This is most likely not a USB issue, but rather belongs in the CAM / SCSI area.
>
> You can try enabling USB quirks for your device.
>
> --HPS

Hi,

It's been a long time since I messed with USB quirks, so I've forgotten 
how to do this. Do I need to edit usb_quirk.c and recompile?

Thanks.


Stan
Comment 3 hans.petter.selasky 2013-11-16 16:45:13 UTC
On 11/16/13 14:31, Stan Gammons wrote:
> On 16/11/13 04:49, Hans Petter Selasky wrote:
>> RE: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.
>> Hi,
>>
>> This is most likely not a USB issue, but rather belongs in the CAM /
>> SCSI area.
>>
>> You can try enabling USB quirks for your device.
>>
>> --HPS
>
> Hi,
>
> It's been a long time since I messed with USB quirks, so I've forgotten
> how to do this. Do I need to edit usb_quirk.c and recompile?
>
> Thanks.
>
>
> Stan
>

Hi,

See:

usbconfig -d X.Y add_quirk XXXX
usbconfig dump_quirk_names

Thank you!

--HPS
Comment 4 Stan Gammons 2013-11-16 17:52:20 UTC
On 16/11/13 10:45, Hans Petter Selasky wrote:
>
> Hi,
>
> See:
>
> usbconfig -d X.Y add_quirk XXXX
> usbconfig dump_quirk_names
>
> Thank you!
>
> --HPS

Hi,

When I use the following then insert the USB drive, I'm able to mount 
the USB drive.  So, that fixed the problem on 9.2 Release.
I may have to do the same with 10.0

usbconfig -d ugen4.3 add_quirk UQ_MSC_NO_PREVENT_ALLOW


If I put usb_quirk_load="YES" in loader.conf, will that fix it so I 
don't have to manually issue the usbconfig command every time?

Thanks for the help!


Stan
Comment 5 hans.petter.selasky 2013-11-16 18:08:26 UTC
Hi,



For permanent quirks, you need to edit sys/dev/usb/quirk/usb_quirk.c .



Please submit a patch, thought we might want to investigate this issue further.



Stay tuned!



--HPS

 

 

-----Original message-----

> From:Stan Gammons <s_gammons@charter.net <mailto:s_gammons@charter.net> >

> Sent: Saturday 16th November 2013 18:52

> To: Hans Petter Selasky <hans.petter.selasky@bitfrost.no <mailto:hans.petter.selasky@bitfrost.no> >; freebsd-gnats-submit@FreeBSD.org <mailto:freebsd-gnats-submit@FreeBSD.org> 

> Cc: Alexander Motin <mav@freebsd.org <mailto:mav@freebsd.org> >

> Subject: Re: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.

> 

> On 16/11/13 10:45, Hans Petter Selasky wrote:

> >

> > Hi,

> >

> > See:

> >

> > usbconfig -d X.Y add_quirk XXXX

> > usbconfig dump_quirk_names

> >

> > Thank you!

> >

> > --HPS

> 

> Hi,

> 

> When I use the following then insert the USB drive, I'm able to mount 

> the USB drive.  So, that fixed the problem on 9.2 Release.

> I may have to do the same with 10.0

> 

> usbconfig -d ugen4.3 add_quirk UQ_MSC_NO_PREVENT_ALLOW

> 

> 

> If I put usb_quirk_load="YES" in loader.conf, will that fix it so I 

> don't have to manually issue the usbconfig command every time?

> 

> Thanks for the help!

> 

> 

> Stan

> 

> 




Comment 6 Stan Gammons 2013-11-16 21:48:03 UTC
On 16/11/13 12:08, Hans Petter Selasky wrote:
> RE: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.
> Hi,
>
> For permanent quirks, you need to edit sys/dev/usb/quirk/usb_quirk.c .
>
> Please submit a patch, thought we might want to investigate this issue further.
>
> Stay tuned!
>
> --HPS
>   
I added this line to the usb_quirk.c structure listed below

USB_QUIRK(KINGSTON, DT_100_G2, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW),



static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {

and added this line to /usr/src/sys/dev/usb/usbdevs under the Kingston 
products section

/* Kingston products */
product KINGSTON DT_100_G2      0x4100  USB Storage

then I did a make buildkernel KERNCONF=MYKERNEL and make installkernel 
KERNCONF to install the new kernel and rebooted, but that didn't work. 
So, I must be going about this wrong.


Stan
Comment 7 hans.petter.selasky 2013-11-16 21:56:23 UTC
On 11/16/13 22:48, Stan Gammons wrote:
> On 16/11/13 12:08, Hans Petter Selasky wrote:
>> RE: usb/184014: USB storage devices do not work in FreeBSD 9.2 or higher.
>> Hi,
>>
>> For permanent quirks, you need to edit sys/dev/usb/quirk/usb_quirk.c .
>>
>> Please submit a patch, thought we might want to investigate this issue
>> further.
>>
>> Stay tuned!
>>
>> --HPS
> I added this line to the usb_quirk.c structure listed below
>
> USB_QUIRK(KINGSTON, DT_100_G2, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW),
>
>
>
> static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {
>
> and added this line to /usr/src/sys/dev/usb/usbdevs under the Kingston
> products section
>
> /* Kingston products */
> product KINGSTON DT_100_G2      0x4100  USB Storage
>
> then I did a make buildkernel KERNCONF=MYKERNEL and make installkernel
> KERNCONF to install the new kernel and rebooted, but that didn't work.
> So, I must be going about this wrong.
>
>
> Stan
>
>

Did you "kldload usb_quirk" ?

--HPS
Comment 8 Stan Gammons 2013-11-16 22:02:50 UTC
On 16/11/13 15:56, Hans Petter Selasky wrote:
>
> Did you "kldload usb_quirk" ?
>
> --HPS

I tried, but get the message that usb_quirk.1 is already present in the 
KLD kernel.


Stan
Comment 9 hans.petter.selasky 2013-11-16 22:08:27 UTC
On 11/16/13 23:02, Stan Gammons wrote:
> On 16/11/13 15:56, Hans Petter Selasky wrote:
>>
>> Did you "kldload usb_quirk" ?
>>
>> --HPS
>
> I tried, but get the message that usb_quirk.1 is already present in the
> KLD kernel.
>
>
> Stan
>

Hi,

You can check using "usbconfig dump_device_quirks" that your quirk is 
really present. You might also note, that if you set mass storage device 
quirks, the auto-device-quirk algorithm, might behave differently, so 
you might need to add more quirks, like no synchronize cache and so on.

--HPS
Comment 10 Stan Gammons 2013-11-16 22:19:17 UTC
On 16/11/13 16:08, Hans Petter Selasky wrote:
> You can check using "usbconfig dump_device_quirks" that your quirk is 
> really present. You might also note, that if you set mass storage 
> device quirks, the auto-device-quirk algorithm, might behave 
> differently, so you might need to add more quirks, like no synchronize 
> cache and so on.
>
> --HPS

I believe the PID=0x4100 is it.

root@gateway2:~ # usbconfig dump_device_quirks | grep NO_PREVENT_ALLOW
VID=0x0951 PID=0x4100 REVLO=0x0000 REVHI=0xffff 
QUIRK=UQ_MSC_NO_PREVENT_ALLOW
VID=0x0483 PID=0xfada REVLO=0x0000 REVHI=0xffff 
QUIRK=UQ_MSC_NO_PREVENT_ALLOW
root@gateway2:~ #

That's the only thing I see for 0x4100 too

root@gateway2:~ # usbconfig dump_device_quirks | grep 0x4100
VID=0x0951 PID=0x4100 REVLO=0x0000 REVHI=0xffff 
QUIRK=UQ_MSC_NO_PREVENT_ALLOW
root@gateway2:~ #

I'll try adding some other quirks later today.


Stan
Comment 11 Stan Gammons 2013-11-17 17:06:20 UTC
I've been unable to figure out what quirks are needed to make this work.

Using usbconfig or a different brand USB drive are the easiest things to do.

Thanks for the help.


Stan
Comment 12 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:24 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped