search for: usb_get_string_simple

Displaying 16 results from an estimated 16 matches for "usb_get_string_simple".

2020 Apr 03
0
Powercool PCRACK-1200VA patch update
...sign extended;   * using "char" is trouble.  Likewise, sizes should never be negative.   */ @@ -128,6 +137,73 @@ static int nut_usb_set_altinterface(usb_dev_handle *udev)  #define usb_control_msg         typesafe_control_msg + +/* + * This is a wrapper for the usb_get_string() and usb_get_string_simple() functions + * Its purpose is to encapsulate the handling of langid_fix and buflen_fix. + */ +int nut_usb_get_string(usb_dev_handle *dev, int index, char *buf, size_t buflen) { + +    /* check for buflen fix */ +    int blen = buflen; +    if(buflen_fix != -1) { +        blen = buflen_fix; +    }...
2020 Apr 03
0
Patch to support Powercool PCRACK-1200VA
Hi Folks, This is my first post on nut-upsdev. I would like to share a small patch to enable support for the Powercool PCRACK 1200VA ups. I found that the UPS uses megatec/krauler protocol but is sensitive to the USB buffer length passed to it in requests via usb_get_string(), and usb_get_string_simple(). If the buflen is greater than 102 then the ups will reply to requests but does not behave correctly. In this case the responses to "Q1" commands contain constant stale data that is never updated. This patch adds a parameter to the nutdrv_qx driver that allows the value of buflen t...
2010 Sep 24
1
Dynamix 650 VA USB - broken, have rough fix
...megatec_usb would consistently fail. After spending a week (hey, I'm unemployed) reading USB docs and poking at it from various directions, I now understand what's wrong, though not necessarily the best place to fix it. megatec_usb communicates primarily with the UPS via libusb 0.1's usb_get_string_simple. usb_get_string_simple begins by requesting supported LANGIDs from the UPS -- which fails, ending communication. (Megatec's USB implementation is not a good effort.) If you skip that step and go directly to usb_get_string with some arbitrary LANGID (I tried 0x0409 and 0x0000, both worked), t...
2005 Jun 23
1
USB UPS Question...
...claim_interface' libusb.o(.text+0x17e): In function `libusb_open': : undefined reference to `usb_control_msg' libusb.o(.text+0x192): In function `libusb_open': : undefined reference to `usb_strerror' libusb.o(.text+0x203): In function `libusb_open': : undefined reference to `usb_get_string_simple' libusb.o(.text+0x2a5): In function `libusb_open': : undefined reference to `usb_get_string_simple' libusb.o(.text+0x341): In function `libusb_open': : undefined reference to `usb_get_string_simple' libusb.o(.text+0x3dc): In function `libusb_open': : undefined reference to `...
2017 Nov 26
2
Have any FreeBSD users tried the new libusb-1.0 branch?
Charles Lepple writes: > still looking for volunteers to test the libusb-1.0 code on FreeBSD and > other systems. On Fedora 27, running commit 2999c95f0: # nut-scanner Cannot load USB library (/usr/lib64/libusb-1.0.so.0.1.0) : /usr/lib64/libusb-1.0.so.0.1.0: undefined symbol: usb_get_string_simple. USB search disabled. There's also a bug in the configure script on 64 bit Fedora. The configure script sets systemdsystemshutdowndir to /usr/lib64/systemd/systemd-shutdown which misses the mark, a little bit. The fix: if test -n "${systemdsystemunitdir}"; then - systemdsyste...
2007 Feb 01
2
Re: [Nut-upsuser] Ablerex 625L USB version
...+ return -1; > + } > + > + memset(report_buf,0,sizeof(report_buf)); > + memcpy(report_buf,str,strlen(str)); > + > + if (strcmp(str, "Q1\r") == 0) > + { > + upsdebugx(4, "set_data_ablerex: Doing Q1 stuff"); > + rc = usb_get_string_simple(udev, 3, report_buf, sizeof(report_buf)); > + get_done = TRUE; > + } > + else if (strcmp(str, "Q\r") == 0) > + { > + upsdebugx(4, "set_data_ablerex: Doing Q stuff"); > + rc = usb_get_string_simple(udev, 7, report_buf, sizeof(report_bu...
2007 Aug 23
1
[nut-commits] svn commit r1073 - in trunk: . drivers
...> curDevice->Vendor = NULL; > curDevice->Product = NULL; > curDevice->Serial = NULL; > - curDevice->Bus = strdup(bus->dirname); > + curDevice->Bus = xstrdup(bus->dirname); > > if (dev->descriptor.iManufacturer) { > - ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, string, sizeof(string)); > + ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, > + string, sizeof(string)); > if (ret > 0) { > - curDevice->Vendor = strdup(string); > + curDevice->Vendor = xstrdup(...
2007 Feb 16
1
Re: [nut-commits] svn commit r808 - in trunk: . drivers
...curDevice->Serial = NULL; > - curDevice->Bus = bus->dirname; > + curDevice->Bus = strdup(bus->dirname); > > if (dev->descriptor.iManufacturer) { > ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, string, sizeof(string)); > @@ -307,6 +309,10 @@ > return rdlen; > > next_device: > + free(curDevice->Vendor); > + free(curDevice->Product); > +...
2014 Jul 07
0
Lupus 500 MEC0003 Problems
...to send a langid request every time > the ups is polled but apart from this everythin seems to work > If the langid_fix in ups.conf is set to 0x409 everything works fine and the > extra langid requests aren't sent That's because, when langid_fix is not set, the subdriver uses the usb_get_string_simple function (libusb/compat 0.1) that, in turn, calls the libusb_get_string_descriptor_ascii function (libusb 1.x) that first asks the device for all the supported langids and then uses the first one to get the string descriptor at the requested index. Nothing to worry about. So, to simplify the subdri...
2006 May 02
5
Newhidups gets unbound after a while
Hi everybody, If we let the feature running, it appears that the driver gets unbound after a while ( variable from quarter of hour to 6 hours ) and cannot reconnect. This behavior appear with both MGE Ellipse ASR and non-ASR models with connection to an UHCI and OHCI controllers. The USB core is from 2.4.28 kernel. We use nut-2.0.3. Start, powerfail and recovery detections, UPS shutdown work
2017 Nov 26
0
Have any FreeBSD users tried the new libusb-1.0 branch?
...Originally just at https://github.com/zykh/nut.git, it is now on https://github.com/networkupstools/nut with a few additions (currently at revision 80bc452cc). > > # nut-scanner > Cannot load USB library (/usr/lib64/libusb-1.0.so.0.1.0) : /usr/lib64/libusb-1.0.so.0.1.0: undefined symbol: usb_get_string_simple. USB search disabled. Although I suspect that the USB portion of nut-scanner could probably be replaced with a small shell script that parses the output of lsusb, this shouldn't be too hard to fix. Logged, in case it is not as simple as it looks: https://github.com/networkupstools/nut/issues/4...
2017 Nov 26
1
Have any FreeBSD users tried the new libusb-1.0 branch?
> >> # nut-scanner >> Cannot load USB library (/usr/lib64/libusb-1.0.so.0.1.0) : /usr/lib64/libusb-1.0.so.0.1.0: undefined symbol: usb_get_string_simple. USB search disabled. > > Although I suspect that the USB portion of nut-scanner could probably be replaced with a small shell script that parses the output of lsusb, this shouldn't be too hard to fix. Logged, in case it is not as simple as it looks: https://github.com/networkupstools/nu...
2005 Oct 26
0
A minor nit to pick
...ind_infoval: found PbAc (value: 4) ...... since the upsdebugx() statements there are at level 3. May I suggest that the following TRACE statement in in libusb_get_string() in lubusb.c be changed to level 3: --------------------------------------------------------------------------- ret = usb_get_string_simple(udev, StringIdx, string, 20); /* sizeof(string)); */ if (ret > 0) { TRACE(2, "-> String: %s (len = %i/%i)", string, ret, sizeof(string)); } --------------------------------------------------------------------------- I know...
2017 Nov 23
2
Have any FreeBSD users tried the new libusb-1.0 branch?
Hi all, I am doing some final testing of the libusb-1.0 branch (specifically https://github.com/zykh/nut.git branch libusb-1.0+0.1 @ dfd514e7), and I am running across a regression in usbhid-ups relative to the previous libusb-0.1 code running on FreeBSD. Basically, the master (2.7.4+; c703fa75) code was able to start running as root, drop privileges (usually to uucp, the default for the ports
2014 Jul 08
1
Lupus 500 MEC0003 Problems
...>> the ups is polled but apart from this everythin seems to work >> If the langid_fix in ups.conf is set to 0x409 everything works fine and >> the >> extra langid requests aren't sent > > That's because, when langid_fix is not set, the subdriver uses the > usb_get_string_simple function (libusb/compat 0.1) that, in turn, > calls the libusb_get_string_descriptor_ascii function (libusb 1.x) > that first asks the device for all the supported langids and then uses > the first one to get the string descriptor at the requested index. > Nothing to worry about. So, to...
2014 Jul 04
2
Lupus 500 MEC0003 Problems
Finally I got time to test this. >>> Can you post the output of upsc, and note if any of those values look >>> wrong? serwer2:/tmp/nut-fabula # upsc myups battery.charge: 100 battery.voltage: 13.10 battery.voltage.high: 13.00 battery.voltage.low: 10.40 battery.voltage.nominal: 12.0 device.model: 500VA UPS device.type: ups driver.name: nutdrv_qx driver.parameter.pollfreq: 30