[Nut-upsdev] new TSSHARA SOHO II ups

USUARIO INICIAL spenen at ig.com.br
Thu Mar 25 15:57:37 UTC 2010

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.

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:

typedef struct usb_communication_subdriver_s {
        char *name;                             /* name of this
subdriver               */
        char *version;                          /* version of this
subdriver            */
        int (*open)(usb_dev_handle **sdevp,     /* try to open the next
available       */
                USBDevice_t *curDevice,         /* device matching
USBDeviceMatcher_t   */
                USBDeviceMatcher_t *matcher,
                int (*callback)(usb_dev_handle *udev, USBDevice_t *hd,
unsigned char *rdbuf, int rdlen));
        void (*close)(usb_dev_handle *sdev);
        int (*get_report)(usb_dev_handle *sdev, int ReportId, unsigned char
*raw_buf, int ReportSize );
        int (*set_report)(usb_dev_handle *sdev, int ReportId, unsigned char
*raw_buf, int ReportSize );
        int (*get_string)(usb_dev_handle *sdev, int StringIdx, char *buf,
size_t buflen);
        int (*get_interrupt)(usb_dev_handle *sdev, unsigned char *buf, int
bufsize, int timeout);
} usb_communication_subdriver_t;

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...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20100325/6607892a/attachment.htm>

More information about the Nut-upsdev mailing list