[Nut-upsdev] Re: [Nut-upsuser] Ablerex 625L USB version

Jon Gough jon.gough at eclipsesystems.com.au
Wed Jan 31 02:37:29 CET 2007


Peter,
    I have been doing some more testing and I find that if I modify 
the libusb.c file to set a report size in libusb_get_report to 16 the 
error messages go away. This is the code as it currently stands:

static int libusb_get_report(usb_dev_handle *udev, int ReportId, 
unsigned char *raw_buf, int ReportSize )
{
    int ReportSize_test = 16;
    unsigned char raw_buf_test[ReportSize_test + 1];
    int rc;
    unsigned char *p_raw_buf_test;
    upsdebugx(4, "Entering libusb_get_report, ReportSize: %i, 
ReportSize_test: %i",ReportSize, ReportSize_test);

         if (udev != NULL)
         {
                 rc = usb_control_msg(udev,
                         USB_ENDPOINT_IN + USB_TYPE_CLASS + 
USB_RECIP_INTERFACE,
                         0x01, /* HID_REPORT_GET */
                         ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */
                         0, raw_buf_test, ReportSize_test, USB_TIMEOUT);
                         p_raw_buf_test = raw_buf_test + 
(ReportSize_test - ReportSize);
                         memcpy(raw_buf, p_raw_buf_test, ReportSize);
                 return rc;
         }
         else
                 return 0;
}

 From this I now get

Detected a UPS: UIS Ablerex/Ablerex USB Interface 049e
Using subdriver: EXPLORE HID 0.1
parsing 00860004
parsing Flow
hid_lookup_usage: found 84001e
parsing FlowID
hid_lookup_usage: found 84001f
Path depth = 3, Path: 00860004.Flow.FlowID, Node1/2/3:, 860004, 84001e, 84001f
0: Usage(00860004)
1: Usage(0084001e)
2: Usage(0084001f)
Buffer is stale. refreshing
Noting in the buffer for rbuf->data[0]
Noting in the buffer for rbuf->data[1]
Noting in the buffer for rbuf->data[2]
Entering libusb_get_report, ReportSize: 13, ReportSize_test: 16
Report[r]: (16 bytes) => 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 b0
=>> Before exponent: 0, 0/0)
=>> After conversion: 0.000000 (0), 0/0)
Path: 00860004.Flow.FlowID, Type: Feature, ReportID: 0x01, Offset: 0, 
Size: 4, Value: 0.000000

when i use the usbhid-ups -DDDD -x explore command.

It would appear that whatever is setting the length of the report is 
not getting it quite right. I think this is in hidparse.c, but I am 
still looking.

Jon


At 19:18 28/01/2007, Peter Selinger wrote:
>OK,
>
>no, you wouldn't expect any error messages during compiling. However,
>this doesn't mean usbhid-ups can talk to your device. You did get
>error mesages (Value too large for defined data type) when running the
>driver.
>
>I think what you have to do is to experiment with the report buffer
>size, as I described in an earlier message:
>
> > The error message "(75): Value too large for defined data type" may
> > indicate that the UPS is unhappy with the size of the buffer provided
> > by NUT (apparently 13). You can play with this by hacking a larger
> > buffer size. It should be easy to do this in the function
> > libhid.c:refresh_report_buffer(), by setting len to something bigger
> > (or smaller).
>
>Sorry if that advice was drowned in a sea of other comments. This is
>what you should do. I don't know if it will work, since I don't have
>an Ablerex device to play with.
>
>-- Peter
>
>P.S. I am moving this discussion to the nut-upsdev mailing list (from
>nut-upsuser).




---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 000709-0, 30/01/2007
Tested on: 31/01/2007 12:37:32 PM
avast! is copyright (c) 2000-2007 ALWIL Software.
http://www.avast.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20070131/b8ea15d1/attachment.html


More information about the Nut-upsdev mailing list