Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Nov 2021 08:05:21 +0100
From:      Milan Obuch <freebsd-usb@dino.sk>
To:        freebsd-usb@freebsd.org
Subject:   Re: USBDMSC emulated device does not work on FreeBSD
Message-ID:  <20211113080521.5e4798d7@zeta.dino.sk>
In-Reply-To: <37a6b45a-be34-4216-d038-62f1c440037c@selasky.org>
References:  <20211112095915.226af6be@zeta.dino.sk> <6a6850f5-8233-aae7-8e65-42594402fcb5@selasky.org> <20211112120714.73f195a9@zeta.dino.sk> <972a650d-d490-1965-13a4-2fb984531f1d@selasky.org> <20211112121806.2db2a908@zeta.dino.sk> <85cdc03e-e8f1-871c-6e1d-66181e45dcb1@selasky.org> <20211112123438.6305fc56@zeta.dino.sk> <df6b1571-54a3-91e2-6da5-82df6644bd64@selasky.org> <20211112140045.018ebf0c@zeta.dino.sk> <571bda62-b86c-a5b0-fcc6-f70102b85db7@selasky.org> <20211112142200.7947d6b2@zeta.dino.sk> <3f2a86d6-6906-d5a3-45ad-3b1c7ce1a345@selasky.org> <37a6b45a-be34-4216-d038-62f1c440037c@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 12 Nov 2021 15:22:13 +0100 I wrote:

> On Fri, 12 Nov 2021 14:26:32 +0100
> Hans Petter Selasky <hps@selasky.org> wrote:
> 
> > On 11/12/21 14:25, Hans Petter Selasky wrote:
> > > hw.usb.quirk.0="0x1514 0x0001 0 0xffff UQ_MSC_NO_SYNC_CACHE"
> > > hw.usb.quirk.0="0x1514 0x0001 0 0xffff UQ_NO_STRINGS"  
> > 
> > Should be "1" for second quirk.
> > 
> > hw.usb.quirk.0="0x1514 0x0001 0 0xffff UQ_MSC_NO_SYNC_CACHE"
> > hw.usb.quirk.1="0x1514 0x0001 0 0xffff UQ_NO_STRINGS"
> > 
> > --HPS
> > 
> 
> Thanks for hint, it works now. For some reason, only one quirk works
> on system under test (it is 12.2-STABLE, r368192). I checked it with
> 'usbconfig dump_device_quirks', just the second one was shown. For
> completeness, necessary lines in loader.conf files are
> 
> usb_quirk_load=YES
> hw.usb.quirk.0="0x1514 0x0001 0 0xffff UQ_NO_STRINGS"
> hw.usb.quirk.1="0x1514 0x0001 0 0xffff UQ_MSC_NO_SYNC_CACHE"
> 
> (I think UQ_NO_STRINGS could be omitted, did not test without, but
> 'usbconfig dump_device_quirks | grep 1514' outputs just
> 
> VID=0x1514 PID=0x0001 REVLO=0x0000 REVHI=0xffff
> QUIRK=UQ_MSC_NO_SYNC_CACHE
> 
> nothing more.)
> 
> I am reading from /dev/da0 now... next check would be write, I'll test
> later. If you'd like me to test anything else, just drop a note.
> 
> Again, thanks for help.
> 
> Regards,
> Milan
> 

[ Follow-up to my mail ]

After looking a bit into man page, I found it is actually easy to do it
without reboot (which is important for my main workstation, otherwise
I'd have to reopen quite a number of various windows...). Also, it
looks like some bug in loader makes it not possible to add more than
one quirk on boot time, which I can 'fix' from shell:

kldload usb_quirk
usbconfig add_dev_quirk_vplh 0x1514 0x0001 0 0xffff UQ_NO_STRINGS
usbconfig add_dev_quirk_vplh 0x1514 0x0001 0 0xffff UQ_MSC_NO_SYNC_CACHE

Now I can get expected info from 'usbconfig -d ugen1.3 dump_all_desc'
command:

ugen1.3: <vendor 0x1514 product 0x0001> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x1514 
  idProduct = 0x0001 
  bcdDevice = 0x3000 
  iManufacturer = 0x0001  <Microchip Inc>
  iProduct = 0x0002  <PolarFireSoc-FlashDrive>
  iSerialNumber = 0x0003  <123456789ABCDEF151411111>
  bNumConfigurations = 0x0001 

 Configuration index 0

    bLength = 0x0009 
    bDescriptorType = 0x0002 
    wTotalLength = 0x0020 
    bNumInterfaces = 0x0001 
    bConfigurationValue = 0x0001 
    iConfiguration = 0x0004  <CFG-HS>
    bmAttributes = 0x00c0 
    bMaxPower = 0x0032 

    Interface 0
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0000 
      bAlternateSetting = 0x0000 
      bNumEndpoints = 0x0002 
      bInterfaceClass = 0x0008  <Mass storage>
      bInterfaceSubClass = 0x0006 
      bInterfaceProtocol = 0x0050 
      iInterface = 0x0005  <Interface-MSD>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200 
        bInterval = 0x00ff 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

     Endpoint 1
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0001  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200 
        bInterval = 0x00ff 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

and 'usbconfig show_ifdrv' relevant lines are

ugen1.3: <vendor 0x1514 product 0x0001> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)
ugen1.3.0: umass0: <vendor 0x1514 product 0x0001, class 0/0, rev 2.00/30.00, addr 3>

Relevant lines in console log/dmesg:

ugen1.3: <vendor 0x1514 product 0x0001> at usbus1
umass0 on uhub3
umass0: <vendor 0x1514 product 0x0001, class 0/0, rev 2.00/30.00, addr 3 on usbus1
da0 at umass-sim0 bus 0 scbus8 target 0 lun 0
da0: <MSCC PolarFireSoC_msd 1234> Removable Direct Access SPC-2 SCSI device
da0: 40.000MB/s transfers
da0: 7457MB (15273600 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>

Now, 'gpart show da0' displays expected partitioning data, I can
'mount_msdosfs /dev/da0p2 /media' and access files there as needed.

Thanks for really valuable help, highly appreciated.

Regards,
Milan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20211113080521.5e4798d7>