Re: usb_interrupt_read speed different on USB 2 vs 3 port.

2014-01-03 Thread Hans Petter Selasky

Hi,

For USB 3.0, sys/dev/usb/controller/xhci.c, the interval is set by:

switch (type) {
case UE_INTERRUPT:
if (fps_shift > 3)
fps_shift--;
temp |= XHCI_EPCTX_0_IVAL_SET(fps_shift);
break;
case UE_ISOCHRONOUS:

Add some prints to the kernel and print "fps_shift" in the UE_INTERRUPT 
case. The value has unit 125 * (2**fps_shift) us.


The call is:
usb_interrupt_read(devh, 0x0083, buf, 0x02a, 1000);

BTW:

 Endpoint 0
bLength = 0x0007
bDescriptorType = 0x0005
bEndpointAddress = 0x0083  
bmAttributes = 0x0003  
wMaxPacketSize = 0x002a
bInterval = 0x000a
 10ms I think for FULL speed (XHCI will use 16ms interval)
bRefresh = 0x
bSynchAddress = 0x

 Endpoint 1
bLength = 0x0007
bDescriptorType = 0x0005
bEndpointAddress = 0x0004  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0040
bInterval = 0x000a
 10ms I think for FULL speed
bRefresh = 0x
bSynchAddress = 0x

So a round trip of 20ms is like expected. Maybe the EHCI driver will 
schedule a bit differently.


If in the kernel, it is possible to override this value.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb_interrupt_read speed different on USB 2 vs 3 port.

2014-01-03 Thread Lundberg, Johannes
Here you go: (a diff shows no difference between them)

The call is:
usb_interrupt_read(devh, 0x0083, buf, 0x02a, 1000);

The code is originally from a reverse engineered linux driver which I
adapted to FreeBSD so there might be something I do wrong perhaps..


--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Fri, Jan 3, 2014 at 10:13 PM, Hans Petter Selasky wrote:

> On 01/03/14 13:59, Lundberg, Johannes wrote:
> > Hi
> >
> > I had a bug driving me crazy and I finally discovered something weird
> that
> > was the reason.
> >
> > I have a pair of AR glasses from Vuzix which have a
> > gyro/accelerometer/compass which I read from USB using usb_interrupt_read
> > (reading 42 bytes of data).
> >
> > On my laptop I have two USB 2 and one USB 3 port.
> >
> >>From the USB 2 port things behave normally and reading takes a
> millisecond
> > or so.
> >
> >>From the USB 3 port things get weird and the call to usb_interrupt_read
> > takes over 20 milliseconds. I have been running this device on the same
> > laptop for some time and haven't noticed this behavior before.
> >
> > Can it be something that has been introduced recently or perhaps only my
> > system is behaving weird?...
> >
> > # uname -a
> > FreeBSD PC 10.0-BETA1 FreeBSD 10.0-BETA1 #0: Sun Dec  8 16:15:23 JST
> > 2013 root@PC:/usr/obj/usr/src/sys/GENERIC  i386
> >
> > Best regards
> > --
> > Johannes Lundberg
> >
>
> Hi,
>
> Can you show output from
> "usbconfig -d X.Y dump_device_desc dump_curr_config_desc"
>
> In both cases?
>
> --HPS
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
WITH DEVICE IN USB 3 PORT

% usbconfig -d 1.2 dump_device_desc dump_curr_config_desc
ugen1.2:  at usbus1, cfg=0 md=HOST spd=FULL 
(12Mbps) pwr=ON (500mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0110 
  bDeviceClass = 0x 
  bDeviceSubClass = 0x 
  bDeviceProtocol = 0x 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x1bae 
  idProduct = 0x014b 
  bcdDevice = 0x0102 
  iManufacturer = 0x0001  
  iProduct = 0x0002  
  iSerialNumber = 0x  
  bNumConfigurations = 0x0001 


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x010f 
bNumInterfaces = 0x0004 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x00a0 
bMaxPower = 0x00fa 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x 
  bInterfaceClass = 0x0001 
  bInterfaceSubClass = 0x0001 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

  Additional Descriptor

  bLength = 0x0a
  bDescriptorType = 0x24
  bDescriptorSubType = 0x01
   RAW dump: 
   0x00 | 0x0a, 0x24, 0x01, 0x00, 0x01, 0x75, 0x00, 0x02, 
   0x08 | 0x01, 0x02


  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
   RAW dump: 
   0x00 | 0x0c, 0x24, 0x02, 0x03, 0x01, 0x01, 0x00, 0x02, 
   0x08 | 0x03, 0x00, 0x00, 0x00


  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
   RAW dump: 
   0x00 | 0x0c, 0x24, 0x02, 0x01, 0x01, 0x02, 0x07, 0x01, 
   0x08 | 0x01, 0x00, 0x00, 0x00


  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x24
  bDescriptorSubType = 0x06
   RAW dump: 
   0x00 | 0x09, 0x24, 0x06, 0x02, 0x01, 0x01, 0x03, 0x00, 
   0x08 | 0x00

  Additional Descriptor

  bLength = 0x0d
  bDescriptorType = 0x24
  bDescriptorSubType = 0x04
   RAW dump: 
   0x00 | 0x0d, 0x24, 0x04, 0x04, 0x02, 0x03, 0x02, 0x02, 
   0x08 | 0x03, 0x00, 0x00, 0x00, 0x00


  Additional Descriptor

  bLength = 0x0a
  bDescriptorType = 0x24
  bDescriptorSubType = 0x06
   RAW dump: 
   0x00 | 0x0a, 0x24, 0x06, 0x05, 0x04, 0x01, 0x01, 0x02, 
   0x08 | 0x02, 0x00


  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x24
  bDescriptorSubType = 0x03
   RAW dump: 
   0x00 | 0x09, 0x24, 0x03, 0x06, 0x01, 0x03, 0x00, 0x05, 
   0x08 | 0x00

  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
   RAW dump: 
   0x00 | 0x0c, 0x24, 0x02, 0x07, 0x01, 0x02, 0x01, 0x01, 
   0x08 | 0x01, 0x00, 0x00, 0x00


  Additional Descriptor

  bLength = 0x09
  bDe

Re: usb_interrupt_read speed different on USB 2 vs 3 port.

2014-01-03 Thread Hans Petter Selasky
On 01/03/14 13:59, Lundberg, Johannes wrote:
> Hi
> 
> I had a bug driving me crazy and I finally discovered something weird that
> was the reason.
> 
> I have a pair of AR glasses from Vuzix which have a
> gyro/accelerometer/compass which I read from USB using usb_interrupt_read
> (reading 42 bytes of data).
> 
> On my laptop I have two USB 2 and one USB 3 port.
> 
>>From the USB 2 port things behave normally and reading takes a millisecond
> or so.
> 
>>From the USB 3 port things get weird and the call to usb_interrupt_read
> takes over 20 milliseconds. I have been running this device on the same
> laptop for some time and haven't noticed this behavior before.
> 
> Can it be something that has been introduced recently or perhaps only my
> system is behaving weird?...
> 
> # uname -a
> FreeBSD PC 10.0-BETA1 FreeBSD 10.0-BETA1 #0: Sun Dec  8 16:15:23 JST
> 2013 root@PC:/usr/obj/usr/src/sys/GENERIC  i386
> 
> Best regards
> --
> Johannes Lundberg
> 

Hi,

Can you show output from
"usbconfig -d X.Y dump_device_desc dump_curr_config_desc"

In both cases?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"