Re: USB device not working on FreeBSD

2017-02-08 Thread Mike Tancsa
On 2/8/2017 2:20 PM, Hans Petter Selasky wrote:
> Hi,
> 
> After your device receives the following control endpoint request it
> becomes unrecoverable:
> 
>> 13:05:50.860195 usbus0.4
>> SUBM-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
>>  frame[0] WRITE 8 bytes
>>    A1 01 52 03 00 00 03 00  -- -- -- -- -- -- -- -- 
>> |..R.|
>  ^^ USB read interface class (A1)
> ^^ GET_REPORT (01)
>   ^^ feature (03)
>^^ length (3 bytes)
>>  frame[1] READ 3 bytes
>> 13:05:50.860938 usbus0.4
>> DONE-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
>>  frame[0] WRITE 8 bytes
>>  frame[1] READ 0 bytes
> 

I had a look at an older apc 650, and it works just fine after getting
that command

15:40:40.803562 usbus0.4 SUBM-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
   A1 01 01 03 00 00 02 00  -- -- -- -- -- -- -- --  ||
 frame[1] READ 2 bytes
15:40:40.804886 usbus0.4
DONE-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
   01 01 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |..  |
15:40:40.805048 usbus0.4 SUBM-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
   80 06 00 03 00 00 04 00  -- -- -- -- -- -- -- --  ||
 frame[1] READ 4 bytes
15:40:40.806959 usbus0.4
DONE-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
   04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  ||
15:40:40.807114 usbus0.4 SUBM-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
   80 06 00 03 00 00 04 00  -- -- -- -- -- -- -- --  ||
 frame[1] READ 4 bytes
15:40:40.809126 usbus0.4
DONE-CTRL-EP=0080,SPD=LOW,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
   04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  ||


ugen0.4:  at usbus0, cfg=0
md=HOST spd=LOW (1.5Mbps) pwr=ON (2mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x  
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x
  bMaxPacketSize0 = 0x0008
  idVendor = 0x051d
  idProduct = 0x0002
  bcdDevice = 0x0106
  iManufacturer = 0x0003  
  iProduct = 0x0001  
  iSerialNumber = 0x0002  <4B1640P41654  >

-- 
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: USB device not working on FreeBSD

2017-02-08 Thread Mike Tancsa
On 2/8/2017 3:09 PM, Hans Petter Selasky wrote:
> 
> You can also try connecting the device w/ or w/o a USB HUB.

I tried with a HUB, but it does not make a difference.

---Mike


-- 
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: USB device not working on FreeBSD

2017-02-08 Thread Hans Petter Selasky

On 02/08/17 21:05, Mike Tancsa wrote:


I can try.  I dont have any contacts there, but I will bcc' one of the
developers of apcupsd to see what he thinks.  I attached the output of
truss and the usbdump to see if that sheds any light on the issue and
why FreeBSD is crashing the device and not Linux.

---Mike


Hi,

You can also try connecting the device w/ or w/o a USB HUB.

--HPS

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


Re: USB device not working on FreeBSD

2017-02-08 Thread Mike Tancsa
On 2/8/2017 2:20 PM, Hans Petter Selasky wrote:
> 
> Hi,
> 
> After your device receives the following control endpoint request it
> becomes unrecoverable:
> 
>> 13:05:50.860195 usbus0.4
>> SUBM-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
>>  frame[0] WRITE 8 bytes
>>    A1 01 52 03 00 00 03 00  -- -- -- -- -- -- -- -- 
>> |..R.|
>  ^^ USB read interface class (A1)
> ^^ GET_REPORT (01)
>   ^^ feature (03)
>^^ length (3 bytes)
>>  frame[1] READ 3 bytes
>> 13:05:50.860938 usbus0.4
>> DONE-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
>>  frame[0] WRITE 8 bytes
>>  frame[1] READ 0 bytes
> 
> Can you disable devd, and launch the apcupsd manually?
> 
> Can you figure out which application is doing this request?
> 
> If you don't start apcupsd, is this request then issued? If you stop
> other daemons like hald, webcamd ... ? Is the request still there when
> you plug the device?

I disabled devd, but I dont have anything else like hald or webcamd
running. I also disconnected all usb devices. I powered off the unit,
disconnected, then reconnected it to the box and started usbdump. I
didnt see the above sequence. I started apcupsd and it seems to be the
one sending that sequence to it.


> 
> Are you using the latest version of apcupsd ?

Yes.

> 
> BTW: The manufacturer should be let aware of this issue. It's like a
> zero-day to stop the device from working properly.

I can try.  I dont have any contacts there, but I will bcc' one of the
developers of apcupsd to see what he thinks.  I attached the output of
truss and the usbdump to see if that sheds any light on the issue and
why FreeBSD is crashing the device and not Linux.

---Mike

-- 
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: USB device not working on FreeBSD

2017-02-08 Thread Hans Petter Selasky

On 02/08/17 19:08, Mike Tancsa wrote:

On 2/8/2017 12:55 PM, Hans Petter Selasky wrote:

On 02/08/17 18:38, Mike Tancsa wrote:

Hi,
It works without issue on Linux.
What information from usbdump would be helpful from usbdump ?


Hi,

If there are any transaction errors, like non successful USB transfers.

Hi,
This is with UQ_NO_STRINGS set.  I start the dump, start up apcupsd,
when a couple of seconds then do an apcaccess to query the daemon

---Mike



Hi,

After your device receives the following control endpoint request it 
becomes unrecoverable:



13:05:50.860195 usbus0.4 SUBM-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
   A1 01 52 03 00 00 03 00  -- -- -- -- -- -- -- --  |..R.|

 ^^ USB read interface class (A1)
^^ GET_REPORT (01)
  ^^ feature (03)
   ^^ length (3 bytes)

 frame[1] READ 3 bytes
13:05:50.860938 usbus0.4 
DONE-CTRL-EP=0080,SPD=FULL,NFR=2,SLEN=0,IVAL=0,ERR=IOERROR
 frame[0] WRITE 8 bytes
 frame[1] READ 0 bytes


Can you disable devd, and launch the apcupsd manually?

Can you figure out which application is doing this request?

If you don't start apcupsd, is this request then issued? If you stop 
other daemons like hald, webcamd ... ? Is the request still there when 
you plug the device?


Are you using the latest version of apcupsd ?

BTW: The manufacturer should be let aware of this issue. It's like a 
zero-day to stop the device from working properly.


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


Re: USB device not working on FreeBSD

2017-02-08 Thread Mike Tancsa
On 2/8/2017 12:55 PM, Hans Petter Selasky wrote:
> On 02/08/17 18:38, Mike Tancsa wrote:
>> Hi,
>> It works without issue on Linux.
>> What information from usbdump would be helpful from usbdump ?
> 
> Hi,
> 
> If there are any transaction errors, like non successful USB transfers.
Hi,
This is with UQ_NO_STRINGS set.  I start the dump, start up apcupsd,
when a couple of seconds then do an apcaccess to query the daemon

---Mike


-- 
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: USB device not working on FreeBSD

2017-02-08 Thread Hans Petter Selasky

On 02/08/17 18:38, Mike Tancsa wrote:

Hi,
It works without issue on Linux.
What information from usbdump would be helpful from usbdump ?


Hi,

If there are any transaction errors, like non successful USB transfers.

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


Re: USB device not working on FreeBSD

2017-02-08 Thread Mike Tancsa
On 2/8/2017 12:33 PM, Hans Petter Selasky wrote:
> On 01/24/17 18:12, Mike Tancsa wrote:
>> The daemon does attach to it, and it sort of reads some of the info (as
>> before adding the quirk)
> 
> Hi,
> 
> Does this device work with apcaccess under Linux?


> 
> Have you tried contacting the maintainers about this?
> 
> usbdump'ing the traffic, from before you attach the device, might give
> you some ideas what is going on.

Hi,
It works without issue on Linux.
What information from usbdump would be helpful from usbdump ?

Bus 001 Device 005: ID 051d:0002 American Power Conversion
Uninterruptible Power Supply
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x051d American Power Conversion
  idProduct  0x0002 Uninterruptible Power Supply
  bcdDevice0.90
  iManufacturer   1 American Power Conversion
  iProduct2 Back-UPS NS 650M1 FW:929.a5 .D USB F
  iSerial 3 4B1630P12329
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   34
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xe0
  Self Powered
  Remote Wakeup
MaxPower2mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  0 No Subclass
  bInterfaceProtocol  0 None
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.00
  bCountryCode   33 US
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength1049
 Report Descriptors:
   ** UNAVAILABLE **
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval 100
Device Status: 0x0001
  Self Powered
# apcaccess
APC  : 001,037,0922
DATE : 2017-01-24 09:29:10 -0500
HOSTNAME : loadb06
VERSION  : 3.14.12 (29 March 2014) debian
UPSNAME  : loadb06
CABLE: USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2017-01-24 09:25:13 -0500
MODEL: Back-UPS NS 650M1
STATUS   : ONLINE
LINEV: 118.0 Volts
LOADPCT  : 0.0 Percent
BCHARGE  : 96.0 Percent
TIMELEFT : 429.9 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE: Medium
LOTRANS  : 92.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 Seconds
BATTV: 13.5 Volts
LASTXFER : Low line voltage
NUMXFERS : 1
XONBATT  : 2017-01-24 09:27:37 -0500
TONBATT  : 0 Seconds
CUMONBATT: 33 Seconds
XOFFBATT : 2017-01-24 09:28:10 -0500
SELFTEST : OK
STATFLAG : 0x0508
SERIALNO : 4B1630P12329
BATTDATE : 2016-07-27
NOMINV   : 120 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 360 Watts
FIRMWARE : 929.a5 .D USB FW:a5
END APC  : 2017-01-24 09:29:44 -0500


On FreeBSD

ugen0.8:  at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA)


 Configuration index 0

bLength = 0x0009
bDescriptorType = 0x0002
wTotalLength = 0x0022
bNumInterfaces = 0x0001
bConfigurationValue = 0x0001
iConfiguration = 0x  
bmAttributes = 0x00e0
bMaxPower = 0x0001

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

  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x21
  bDescriptorSubType = 0x00
   RAW dump:
   0x00 | 0x09, 0x21, 0x00, 0x01, 0x21, 0x01, 0x22, 0x19,
   0x08 | 0x04

 Endpoint 0
bLength = 0x0007
bDescriptorType = 0x0005
bEndpointAddress = 0x0081  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008
bInterval = 0x0064
bRefresh = 0x
bSynchAddress = 0x


ugen0.8:  at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x  
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x
  bMaxPacketSize0 = 0x0040
  idVendor = 0x051d
  idProduct = 0x0002
  bcdDevice = 0x0090
  iManufacturer = 0x0001  
  iProduct = 

Re: USB device not working on FreeBSD

2017-02-08 Thread Hans Petter Selasky

On 01/24/17 18:12, Mike Tancsa wrote:

The daemon does attach to it, and it sort of reads some of the info (as
before adding the quirk)


Hi,

Does this device work with apcaccess under Linux?

Have you tried contacting the maintainers about this?

usbdump'ing the traffic, from before you attach the device, might give 
you some ideas what is going on.


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


Re: USB device not working on FreeBSD

2017-01-24 Thread Mike Tancsa
On 1/24/2017 12:03 PM, Hans Petter Selasky wrote:
> On 01/24/17 16:14, Mike Tancsa wrote:
>> Perhaps some sort of USB quirk needs to be added ? Any ideas on how to
>> get things working ? It fails on RELENG8, RELENG_10, and RELENG_11 in
>> the same way.  usbconfig dump_device_desc fails as its not able to get
>> all the info.
> 
> Hi,
> 
> Try setting the UQ_NO_STRINGS quirk for this device and also verify that
> the idVendor and idProduct is present in the apcaccess utility. Else it
> will not attach!

Thanks!  The quirk doesnt seem to make a difference to the app, but
dump_device_desc works now


# usbconfig -d ugen0.4 add_quirk UQ_NO_STRINGS


# usbconfig -d 0.4  dump_device_desc
ugen0.4:  at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x  
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x
  bMaxPacketSize0 = 0x0040
  idVendor = 0x051d
  idProduct = 0x0002
  bcdDevice = 0x0090
  iManufacturer = 0x0001  
  iProduct = 0x0002  
  iSerialNumber = 0x0003  <4B1630P12329  >
  bNumConfigurations = 0x0001




The daemon does attach to it, and it sort of reads some of the info (as
before adding the quirk)

# apcaccess
APC  : 001,033,0741
DATE : 2017-01-24 12:09:00 -0500
HOSTNAME : offsite2.sentex.ca
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : offsite2.sentex.ca
CABLE: USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2017-01-24 12:08:53 -0500
MODEL:
STATUS   :
LINEV: 0.0 Volts
LOADPCT  : 0.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 447.7 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE: Unknown
LOTRANS  : -1.0 Volts
HITRANS  : -1.0 Volts
ALARMDEL : Always
BATTV: 0.0 Volts
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x0500
SERIALNO :
BATTDATE :
NOMINV   : 0 Volts
NOMBATTV : 0.0 Volts
END APC  : 2017-01-24 12:09:47 -0500



-- 
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: USB device not working on FreeBSD

2017-01-24 Thread Hans Petter Selasky

On 01/24/17 16:14, Mike Tancsa wrote:

Perhaps some sort of USB quirk needs to be added ? Any ideas on how to
get things working ? It fails on RELENG8, RELENG_10, and RELENG_11 in
the same way.  usbconfig dump_device_desc fails as its not able to get
all the info.


Hi,

Try setting the UQ_NO_STRINGS quirk for this device and also verify that 
the idVendor and idProduct is present in the apcaccess utility. Else it 
will not attach!


--HPS

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