Kelly Byrd
2023-Oct-30 01:25 UTC
[Nut-upsuser] usbhid-ups not loading with Arduino Leonardo on Ubuntu 23.10
Looking at the output of lsub in my original message: `bNumInterfaces 1` Then there's only one Interface Descriptor section. I can modify the USB code the runs on the Arduino, if needed. I'm looking for help on what is going wrong and what I could modify to fix it. I have seen reports of folks claiming this just worked for them out of the box, so unsure what to do next. On Sun, Oct 29, 2023 at 4:13?PM Jim Klimov <jimklimov+nut at gmail.com> wrote:> OTOH: I wonder whether, when it says "Claimed interface 2 successfully" > it got the right number of the correct (HID) one of many interfaces you > likely have there?.. :\ > > Jim > > > On Mon, Oct 30, 2023, 00:04 Kelly Byrd <kbyrd at memcpy.com> wrote: > >> >> >> Apologies for the long post. I'm trying to include what I hope are the >> relevant bits (output of lsusb -v and usbhid-ups) >> >> Long term goal: I've got a DIY UPS that I would like to get working with >> my QNAP NAS (which uses Linux and NUT underneath the hood) >> ... >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20231029/5385421b/attachment.htm>
Charles Lepple
2023-Oct-30 01:46 UTC
[Nut-upsuser] usbhid-ups not loading with Arduino Leonardo on Ubuntu 23.10
> On Oct 29, 2023, at 9:25 PM, Kelly Byrd <kbyrd at memcpy.com> wrote: > > I have seen reports of folks claiming this just worked for them out of the box,Here you're referring to just making things work on Windows or macOS, right? I don't think it will be quite as simple with NUT, mostly because the NUT drivers are trying to expose all of the variables and commands, rather than just the simple shutdown bits. I'm not sure where a generic HID PDC driver sits in the priority list at the moment, but IIRC the current driver is still fairly tightly coupled to the USB VID and resulting model-specific mappings. So once you get the permissions worked out, you would still need a new source file that maps the HID Usage "paths" to NUT variable names. It's one of those things that in hindsight, it would have been great to fall back to a generic mapping that just looks at the OB and LB bits, but real-world UPSes are messy, and we would have needed those model-specific mappings to be able to distinguish things like input and output voltage. That said, if you change the VID/PID to something supported already, things just might work. The "Couldn't retrieve descriptors" is likely a result of the driver dropping root privileges, then not having enough permissions to write to the /dev/bus/usb node to request the HID descriptor. I don't know how your VID/PID got into the udev rules file - VID 2341 doesn't show up in the NUT Git source tree. -- Charles Lepple clepple at gmail
Kelly Byrd
2023-Oct-30 01:59 UTC
[Nut-upsuser] usbhid-ups not loading with Arduino Leonardo on Ubuntu 23.10
> Here you're referring to just making things work on Windows or macOS,right? I don't think it will be quite as simple with NUT, mostly because the NUT drivers are trying to expose all of the variables and commands, rather than just the simple shutdown bits. By "work with on Windows on macOS" I mean: "both Windows and MacOS show the correct "AC present/charging vs "no AC/discharging" status as well as showing the expected remaining status and percent charged.> I'm not sure where a generic HID PDC driver sits in the priority list atthe moment, but IIRC the current driver is still fairly tightly coupled to the USB VID and resulting model-specific mappings> f you change the VID/PID to something supported already, things justmight work... The current usbhid-ups driver should be perfect. As I said in the original email, rhe Ubuntu package includes a usev rules file that has a VID/PID (2341:8036) for the Arduino I have so it looks supported to me and that should solve the permissions issue, right? The USB HID power device standard has a well known report structure so I expected the simple things like "AC Present" vs "Discharding" to work. But I'm not even at mapping variables yet. Just at: "the OS package appears to support thie VID/PID, but it doesn't work" On Sun, Oct 29, 2023 at 6:46?PM Charles Lepple <clepple at gmail.com> wrote:> > On Oct 29, 2023, at 9:25 PM, Kelly Byrd <kbyrd at memcpy.com> wrote: > > > > I have seen reports of folks claiming this just worked for them out of > the box, > > Here you're referring to just making things work on Windows or macOS, > right? I don't think it will be quite as simple with NUT, mostly because > the NUT drivers are trying to expose all of the variables and commands, > rather than just the simple shutdown bits. > > I'm not sure where a generic HID PDC driver sits in the priority list at > the moment, but IIRC the current driver is still fairly tightly coupled to > the USB VID and resulting model-specific mappings. So once you get the > permissions worked out, you would still need a new source file that maps > the HID Usage "paths" to NUT variable names. It's one of those things that > in hindsight, it would have been great to fall back to a generic mapping > that just looks at the OB and LB bits, but real-world UPSes are messy, and > we would have needed those model-specific mappings to be able to > distinguish things like input and output voltage. > > That said, if you change the VID/PID to something supported already, > things just might work. The "Couldn't retrieve descriptors" is likely a > result of the driver dropping root privileges, then not having enough > permissions to write to the /dev/bus/usb node to request the HID > descriptor. I don't know how your VID/PID got into the udev rules file - > VID 2341 doesn't show up in the NUT Git source tree. > > -- > Charles Lepple > clepple at gmail > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20231029/881f6609/attachment.htm>