public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: David Niklas <Hgntkwis@vfemail.net>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: "Filipe Laíns" <lains@archlinux.org>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Jiri Kosina" <jikos@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"Linux USB Mailing List" <linux-usb@vger.kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>
Subject: Re: I need advice with UPS connection. (ping)
Date: Tue, 23 Nov 2021 22:12:41 -0500	[thread overview]
Message-ID: <20211123221241.3cdb4e66@Zen-II-x12.niklas.com> (raw)
In-Reply-To: <CAO-hwJJtQ_1S76HTaHK=oUeP1M24QnC6z1J5CvTuU7m=oZe6zg@mail.gmail.com>

On Tue, 23 Nov 2021 17:33:08 +0100
Benjamin Tissoires <benjamin.tissoires@redhat.com> wrote:

> On Mon, Nov 22, 2021 at 10:35 PM Filipe Laíns <lains@archlinux.org>
> wrote:
> >
> > On Mon, 2021-11-22 at 15:13 -0500, Alan Stern wrote:  
> > > On Mon, Nov 22, 2021 at 11:25:26AM -0500, David Niklas wrote:  
> > > > Ok, I first edited the kernel to return -ENOMEM like you
> > > > suggested but the UPS still disconnected. I then edited it again
> > > > to re-add the 1060 byte request and the UPS still disconnected.
> > > >
> > > > I'm attaching the usbmon traces.
> > > > If you need any additional info I'll do my best to provide it.  
> > >
> > > Holy cow!  I just realized what's going on.  And these little
> > > changes we've been messing around with have nothing to do with it.
> > >
> > > For the first time, I looked at the timestamps in the usbmon
> > > traces.  It turns out that the disconnects occur several seconds
> > > after the kernel retrieves the HID report descriptor from the
> > > device.  Under normal conditions we would expect to see report
> > > packets coming in from the device, starting just a fraction of a
> > > second after the descriptor is received.  But that isn't happening
> > > in the Linux traces, whereas it does happen in the Windows pcap log.
> > >
> > > I would guess that the UPS is programmed to disconnect itself
> > > electronically from the USB bus if it doesn't get any requests for
> > > reports within a couple of seconds.  That certainly would explain
> > > what you've been seeing.  I can't imagine why it would be
> > > programmed to behave this way, but companies have been known to do
> > > stranger things.
> > >
> > > As for why the kernel doesn't try to get the reports...  That's a
> > > little harder to answer.  Maybe Jiri or Benjamin will know
> > > something about it.  
> 
> I am not sure exactly what is going on there.
> There are a couple of things that come to my mind:
> - for quite some time now, we don't fetch all reports whenever we
> connect a new device. This was known to be problematic on some devices
> (see all the devices with HID_QUIRK_NOGET or
> HID_QUIRK_NO_INIT_REPORT), and the default to not poll input values on
> plug for devices is actually safer. If you want to revert, we will
> have to have a special driver for this one I guess
> - HID_QUIRK_ALWAYS_POLL *might* be a way to force the device to stay
> with a USB connection up.
> 
> > >
> > > The UPS's vendor ID is 0d9f (POWERCOM) and the product ID is 0004.
> > > Now, the drivers/hid/hid-quirks.c file contains a quirk entry for
> > > 0d9f:0002 (product POWERCOM_UPS), which is probably an earlier
> > > model of the same device, or a very similar device.  This quirk
> > > entry is in the hid_ignore_list; it tells the HID core not to
> > > handle the device at all.
> > >
> > > I don't know why that quirk entry is present, and furthermore, it
> > > can't directly affect what is happening with your device because
> > > the product IDs are different.  Still, it is an indication that
> > > something strange is going on behind the scenes.
> > >
> > > Perhaps there is no kernel driver for these UPS devices?  Perhaps
> > > the intention is that some user program will handle all the
> > > communication when one of them is detected?  A quick search on
> > > Google turns up usbhid-ups, part of Network USB Tools (NUT) --
> > > maybe you need to install that package in order to use the device.  
> 
> I don't have enough experience with UPS here to be helpful,
> unfortunately. But What Alan said made a lot of sense. Maybe the NUT
> people will have a better insight.
<snip>

I'll send a message their way.

Thanks,
David

      reply	other threads:[~2021-11-24  3:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  3:00 I need advice with UPS connection David Niklas
2020-11-10 21:55 ` Alan Stern
2020-11-11  1:17   ` Hgntkwis
2020-11-11 15:42     ` Alan Stern
2021-11-14 19:48 ` I need advice with UPS connection. (ping) David Niklas
2021-11-14 21:14   ` Alan Stern
2021-11-15  3:02     ` David Niklas
2021-11-15 16:09       ` Alan Stern
2021-11-15 22:08         ` David Niklas
2021-11-17  5:23         ` David Niklas
2021-11-17 17:08           ` Alan Stern
2021-11-19 22:19             ` David Niklas
2021-11-21  2:54               ` Alan Stern
2021-11-22 16:25                 ` David Niklas
2021-11-22 20:13                   ` Alan Stern
2021-11-22 21:29                     ` Filipe Laíns
2021-11-23 16:33                       ` Benjamin Tissoires
2021-11-24  3:12                         ` David Niklas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211123221241.3cdb4e66@Zen-II-x12.niklas.com \
    --to=hgntkwis@vfemail.net \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=lains@archlinux.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox