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
Peter Selinger
2007-Jan-31 03:21 UTC
[Nut-upsdev] Re: [Nut-upsuser] Ablerex 625L USB version
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 getGood.> 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
Charles Lepple
2007-Jan-31 22:30 UTC
[Nut-upsdev] Re: [Nut-upsuser] Ablerex 625L USB version
On 1/31/07, Jon Gough <jon.gough@eclipsesystems.com.au> wrote:> So I suspect that you did not need to code up for Set Idle. However, seeing as the trouble I am having with my UPS I suppose anything goes!Yeah, it seems they are "compliant" in the most vague sense of the word :-) -- - Charles Lepple
Carlos,
I have implemented that and it works.
What I want to do is run the T<n> command to have it test for a
different length of time than the standard 10 secs. If I can get this
to work then I can send other commands to setup the UPS correctly, ie
wait 10 mins after loss of power before shutting servers down, but
make sure there is 2 mins of power left to allow for shut down to occur.
Jon
At 11:59 1/02/2007, Carlos Rodrigues wrote:>On 2/1/07, Jon Gough
><<mailto:jon.gough@eclipsesystems.com.au>jon.gough@eclipsesystems.com.au>
>wrote:
> Now. Do you know how to issue commands to get the UPS to do
> something, ie battery test ?
>
>
>A quick battery test is "T". You should hear the relays clicking
if
>it succeeds.
>
>
>--
>Carlos Rodrigues
>_______________________________________________
>Nut-upsdev mailing list
>Nut-upsdev@lists.alioth.debian.org
>http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 000709-1, 31/01/2007
Tested on: 1/02/2007 12:44:52 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/20070201/d4bd36e8/attachment.html