Re: Cheap UPS with USB «flicker» with FreeBSD but not with Windows

Hans Petter Selasky hps at selasky.org
Fri Apr 17 19:24:28 UTC 2020


On 2020-04-17 20:37, Lev Serebryakov wrote:
> On 17.04.2020 18:38, Hans Petter Selasky wrote:
> 
>> Maybe the kernel was compiles w/o:
>>
>> options USB_DEBUG
>   Yep. I have kernel with this option now, and debug shows that each disconnection looks like this (there are one successful explore cycle and one which triggers disconnection):
> 
> Apr 17 21:31:48 gateway kernel: usb_needs_explore:
> Apr 17 21:31:48 gateway kernel: usb_bus_powerd: bus=0xfffffe00322b2cd8
> Apr 17 21:31:48 gateway kernel: usb_bus_powerd: Recomputing power masks
> Apr 17 21:31:48 gateway kernel: uhub_explore: udev=0xfffff80006c35000 addr=1
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 1, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 2, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 3, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 4, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 5, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 6, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 7, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:48 gateway kernel: uhub_read_port_status: port 8, wPortStatus=0x0500, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:49 gateway kernel: usb_needs_explore:
> Apr 17 21:31:49 gateway kernel: usb_bus_powerd: bus=0xfffffe0031f7edb0
> Apr 17 21:31:49 gateway kernel: usb_bus_powerd: Recomputing power masks
> Apr 17 21:31:49 gateway kernel: uhub_explore: udev=0xfffff80006c29000 addr=1
> Apr 17 21:31:49 gateway kernel: uhub_read_port_status: port 1, wPortStatus=0x0100, wPortChange=0x0000, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:49 gateway kernel: uhub_read_port_status: port 2, wPortStatus=0x0100, wPortChange=0x0003, err=USB_ERR_NORMAL_COMPLETION
> Apr 17 21:31:49 gateway kernel: uhub_reattach_port: reattaching port 2
> Apr 17 21:31:49 gateway kernel: ugen2.2: <PPC Offline UPS> at usbus2 (disconnected)
> 

Hi,

These two bits mean (Refer to 11.24.2.7.2 Port Status Change Bits in 
USB20 specification):

> Connect Status Change: (C_PORT_CONNECTION) Indicates a change has occurred in the port’s Current Connect Status.
> 
> The hub device sets this field as described in Section 11.24.2.7.2.1.
> 0 = No change has occurred to Current Connect status.
> 1 = Current Connect status has changed.
> 
> Port Enable/Disable Change: (C_PORT_ENABLE) This field is set to one when a port is disabled because
> of a Port_Error condition (see Section 11.8.1).
> 

So the HUB (hardware device) reports that device is disconnected and the 
USB stack acts accordingly. Maybe there is a quirk you need for the 
hardware. Could check Linux sources for EHCI/XHCI/OHCI/UHCI.

--HPS


More information about the freebsd-usb mailing list