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

Peter Selinger selinger at mathstat.dal.ca
Wed Jan 31 03:20:14 CET 2007


Jon Gough wrote:
> 
> 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

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

Don't use -DDDD. Please use -DDD and post the entire output until the
driver begins to loop. I need to see all the lines that start with
"Path:", as well as the report descriptor (many lines of hexadecimal
data). It's best if you don't prune away parts of the output. 
 
> 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.

No, I believe the driver is setting the length correctly. The problem
is that the UPS is buggy. It expects a buffer of size 16, although it
only sends 13 bytes of useful data. We should be able to compensate,
though.

-- Peter



More information about the Nut-upsdev mailing list