<div> </div>
<div>Hi all, My name is Sergio Penen and I'd like to contribute to the project by developing a new driver for TS SHARA SOHO II usb ups.</div>
<div> </div>
<div>I'm almost done decoding the protocol and already have some basic functionality working with NUT. However I've some doubts on how to integrate this driver with NUT and I wonder if you could give me some guidance in that sense. To be more specific: In order to communicate with this UPS both input and output have to be performed as USB interrupts I/O as this UPS doesn't recognizes Control IO, so libusb_get_report() and libusb_set_report() will not work. Looking at libusb.c I realized there's a libusb_get_interrupt() which can be used to read from the endpoint, however there's no counterpart libusb_set_interrupt() API and usb_communication_subdriver_t structure doesn't contain a *set_interrupt element as well:<br>
<br>libusb.h<br>....<br>typedef struct usb_communication_subdriver_s {<br> char *name; /* name of this subdriver */<br> char *version; /* version of this subdriver */<br>
int (*open)(usb_dev_handle **sdevp, /* try to open the next available */<br> USBDevice_t *curDevice, /* device matching USBDeviceMatcher_t */<br> USBDeviceMatcher_t *matcher,<br>
int (*callback)(usb_dev_handle *udev, USBDevice_t *hd, unsigned char *rdbuf, int rdlen));<br> void (*close)(usb_dev_handle *sdev);<br> int (*get_report)(usb_dev_handle *sdev, int ReportId, unsigned char *raw_buf, int ReportSize );<br>
int (*set_report)(usb_dev_handle *sdev, int ReportId, unsigned char *raw_buf, int ReportSize );<br> int (*get_string)(usb_dev_handle *sdev, int StringIdx, char *buf, size_t buflen);<br> int (*get_interrupt)(usb_dev_handle *sdev, unsigned char *buf, int bufsize, int timeout);<br>
} usb_communication_subdriver_t;<br><br>My question is: Can I add a new element called *set_interrupt at the bottom of usb_communication_subdriver_s struct ? I'm asking this because a change on that structure will affect all USB drivers. Another obtion would be to handle USB communication inside the driver itself...<br>
<br>Thanks,<br>Sergio.<br><br></div>