From owner-freebsd-usb@freebsd.org Fri Apr 17 19:24:28 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A3512C6321 for ; Fri, 17 Apr 2020 19:24:28 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 493mHb6R9Vz4X0f for ; Fri, 17 Apr 2020 19:24:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: by mailman.nyi.freebsd.org (Postfix) id DCCF72C6320; Fri, 17 Apr 2020 19:24:27 +0000 (UTC) Delivered-To: usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC93E2C631F for ; Fri, 17 Apr 2020 19:24:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 493mHb51xBz4X0d; Fri, 17 Apr 2020 19:24:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5C73A260253; Fri, 17 Apr 2020 21:24:24 +0200 (CEST) Subject: =?UTF-8?Q?Re=3a_Cheap_UPS_with_USB_=c2=abflicker=c2=bb_with_FreeBSD?= =?UTF-8?Q?_but_not_with_Windows?= To: lev@FreeBSD.org, usb@freebsd.org References: <4a0271c4-edf8-909f-c8d1-894323d1c8d5@selasky.org> <5b87bfd2-55c1-5281-b964-47dfea8c48cb@FreeBSD.org> <408f99ba-bbf9-2273-4caa-281ab96f4a91@selasky.org> <2a570645-70c4-7ead-1e7b-fd3e5b8c10cb@FreeBSD.org> <343a0da8-d1ed-dcb5-3854-042d6065771e@selasky.org> From: Hans Petter Selasky Message-ID: <6ce319aa-934a-cd26-ce79-74c192020e11@selasky.org> Date: Fri, 17 Apr 2020 21:24:10 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 493mHb51xBz4X0d X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2020 19:24:28 -0000 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: 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