Repository navigation
HID-compliant UPS support with interface gt than 0 + Arduino UPS support - #1044
Conversation
|
This pull request introduces 1 alert when merging 2d8b0e93c67761b84b9c652fd7514aa4fe45cf77 into 0a198f0 - view on LGTM.com new alerts:
|
jimklimov
left a comment
There was a problem hiding this comment.
Thanks for this PR! Looks reasonable, but got a few nits to address (including consistent indentation).
Also would like some review from other community members, to make sure I did not miss an elephant in the room.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
clepple
left a comment
There was a problem hiding this comment.
Overall a useful improvement to the code, thanks!
I think the short commit message should match the PR title, or even better, the commit should be split into the two separate commits (one for interface > 0, and one for Arduino support). The "request changes" feedback is for the comments in the rest of my review, not splitting the commit, but smaller and more specific commits make it easier if someone is using git bisect or manually reverting commits during regression testing.
This comment has been minimized.
This comment has been minimized.
@clepple thank you for review - I agree this should be 2 commits. On the other hand, the change was only to add Arduino support and open the door for custom UPS development. Enhancement to libusb is a side change, just to avoid hardcoded VID/PID. |
|
Well, technically... they do sort of pursue different goals and might be cherry-picked separately by some NUT fork or release to bring different benefits. Non-zero interface support is a welcome feature on its own (especially if made configurable), and Arduino driver is "just" one of several consumers for such feature. |
|
@jimklimov I have decomposed the commits into two as requested, please kindly check |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jimklimov
left a comment
There was a problem hiding this comment.
Sorry it took a while to rectify the NUT CI side as well to get to the PRs in queue, great thanks for your contribution and patience!
|
Had a few "cosmetic" nits, an important one being the copyrights in new files. Since I can't edit the source for this PR, I proposed the changes in abratchik#1 - so intend to delay merging this one for a few days until that one is accepted, or would add those commits to NUT later after merging this PR anyway :) |
NUT pre-merge revisions to abratchik/master
hi @jimklimov I accepted your changes, thanks a lot! |
Fixes issue #985
This pull request enables support of USB HID-compliant UPS, which are composite devices. Example - Powervar UPS, which is a composite device utilizing interface greater than 0.
General idea of proposed changes - additional fields added to the usb_communication_subdriver_t structure as follows:
These parameters can later be overridden in a usbhid-ups subdriver in order to set the correct values and remove the necessity to hardcode VID/PID in the libusb.c module. The most convenient place to override these settings in the subdriver is the claim method as it is called at the time of subdriver matching before any HID requests:
Additional usbhid-ups subdriver added to support Arduino-based HID-compliant UPS project. The subdriver uses the interface 2 and interrupt endpoints 4 and 5 thus utilizing the flexibility introduced by this PR. The idea of introducing this driver is to enable creation and prototyping of smart UPS based on Arduino, which is inexpensive versatile platform very much suitable for custom fully open-source UPS development.
Powerwar UPS HID subdriver is also updated - update of hid_rep_index based on hardcoded VID/PID removed from libusb.c. The hid_rep_index for this device is now set in the subdriver itself similarly to the code snippet above.