[Nut-upsdev] Nut-upsdev Digest, Vol 206, Issue 5

Jim Klimov jimklimov+nut at gmail.com
Sat Sep 23 19:05:01 BST 2023


Also, the part about "no permissions on everything" even on the item "5 of
7" suggests that some other driver (maybe default OS handler) still does
not let NUT-owned instance of libusb to access even basic info.

On Sat, Sep 23, 2023, 19:42 Jim Klimov <jimklimov+nut at gmail.com> wrote:

> <facepalm ;)> the ellispis "something=..." were supposed to be replaced by
> your device ID numbers, etc.
>
> On Sat, Sep 23, 2023, 18:26 FatGear <fatgear1 at free.fr> wrote:
>
>> Hello There,
>>
>> I tried your advice and i don't think it works either,
>>
>> See the logs,
>>
>> "
>>
>> /tmp/nut# ./drivers/usbhid-ups -DDDDDD -d1 -s test -x port=auto -x
>> vendorid=... -x productid=... -x subdriver=...
>> Network UPS Tools - Generic HID driver 0.52 (2.8.0-2557-g81fca30b2)
>> USB communication driver (libusb 1.0) 0.46
>>    0.000000    [D3] main_arg: var='port' val='auto'
>>    0.000056    [D6] testinfo_reloadable: var=port,
>> infoname=driver.parameter.port, newval=auto, reloadable=0, reload_flag=0
>>    0.000072    [D6] testinfo_reloadable: verdict for (re)loading var=port
>> value: 1
>>    0.000101    [D5] send_to_all: SETINFO driver.parameter.port "auto"
>>    0.000127    [D3] main_arg: var='vendorid' val='...'
>>    0.000163    [D5] send_to_all: SETINFO driver.parameter.vendorid "..."
>>    0.000188    [D3] main_arg: var='productid' val='...'
>>    0.000214    [D5] send_to_all: SETINFO driver.parameter.productid "..."
>>    0.000234    [D3] main_arg: var='subdriver' val='...'
>>    0.000261    [D5] send_to_all: SETINFO driver.parameter.subdriver "..."
>>    0.000286    [D1] Network UPS Tools version 2.8.0-2557-g81fca30b2
>> (release/snapshot of 2.8.0.1) built with gcc (Ubuntu
>> 9.4.0-1ubuntu1~20.04.2) 9.4.0 and configured with flags: --enable-Wcolor
>> --enable-keep_nut_report_feature --with-all=auto --with-cgi=auto
>> --with-serial=auto --with-dev=auto --with-doc=skip --with-nut_monitor=auto
>> --with-pynut=auto --disable-force-nut-version-header --enable-check-NIT
>> --enable-maintainer-mode --disable-silent-rules --sysconfdir=/etc/nut
>> --with-group=nut --with-user=nut
>> --enable-inplace-runtime='2.8.0-2557-g81fca30b2 (release/snapshot of
>> 2.8.0.1) built with gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 and'
>>    0.000313    [D1] debug level is '6'
>>    0.000339    [D5] send_to_all: SETINFO driver.debug "6"
>>    0.000373    [D5] send_to_all: SETFLAGS driver.debug RW NUMBER
>>    0.001993    [D1] Succeeded to become_user(nut): now UID=127 GID=139
>>    0.002050    [D5] send_to_all: SETINFO device.type "ups"
>>    0.002084    [D5] send_to_all: SETINFO driver.state "init.device"
>>    0.002113    [D1] upsdrv_initups (non-SHUT)...
>>    0.002144    [D2] Initializing an USB-connected UPS with library
>> libusb-1.0.23 (API: 0x1000107) (NUT subdriver name='USB communication
>> driver (libusb 1.0)' ver='0.46')
>>    0.016173    [D2] Checking device 1 of 7 (1D6B/0003)
>>    0.016242    [D1] Failed to open device (1D6B/0003), skipping: Access
>> denied (insufficient permissions)
>>    0.016259    [D2] Checking device 2 of 7 (0BDA/57C4)
>>    0.016288    [D1] Failed to open device (0BDA/57C4), skipping: Access
>> denied (insufficient permissions)
>>    0.016305    [D2] Checking device 3 of 7 (0BDA/B006)
>>    0.016333    [D1] Failed to open device (0BDA/B006), skipping: Access
>> denied (insufficient permissions)
>>    0.016350    [D2] Checking device 4 of 7 (05E3/0610)
>>    0.016378    [D1] Failed to open device (05E3/0610), skipping: Access
>> denied (insufficient permissions)
>>    0.016397    [D2] Checking device 5 of 7 (04E2/1410)
>>    0.016438    [D1] Failed to open device (04E2/1410), skipping: Access
>> denied (insufficient permissions)
>>    0.016465    [D2] Checking device 6 of 7 (0483/91D1)
>>    0.016498    [D1] Failed to open device (0483/91D1), skipping: Access
>> denied (insufficient permissions)
>>    0.016520    [D2] Checking device 7 of 7 (1D6B/0002)
>>    0.016548    [D1] Failed to open device (1D6B/0002), skipping: Access
>> denied (insufficient permissions)
>>    0.016575    [D2] libusb1: No appropriate HID device found
>>    0.016605    libusb1: Could not open any HID devices: insufficient
>> permissions on everything
>>    0.016626    No matching HID UPS found
>>    0.016658    [D5] send_to_all: SETINFO driver.state "cleanup.exit"
>> root at LOULOU:/tmp/nut# ./drivers/huawei-ups2000 -DDDDDD -d1 -s test -x
>> port=auto -x vendorid=... -x productid=... -x subdriver=...
>> Network UPS Tools - NUT Huawei UPS2000 (1kVA-3kVA) RS-232 Modbus driver
>> 0.05 (2.8.0-2557-g81fca30b2)
>> Warning: This is an experimental driver.
>> Some features may not function correctly.
>>
>>    0.000000    [D3] main_arg: var='port' val='auto'
>>    0.000049    [D6] testinfo_reloadable: var=port,
>> infoname=driver.parameter.port, newval=auto, reloadable=0, reload_flag=0
>>    0.000065    [D6] testinfo_reloadable: verdict for (re)loading var=port
>> value: 1
>>    0.000091    [D5] send_to_all: SETINFO driver.parameter.port "auto"
>>    0.000108    [D3] main_arg: var='vendorid' val='...'
>>
>> Fatal error: 'vendorid' is not a valid variable name for this driver.
>>
>> Look in the man page or call this driver with -h for a list of
>> valid variable names and flags.
>>    0.000152    [D5] send_to_all: SETINFO driver.state "cleanup.exit"
>> "
>>
>> And after severals attempts to compile huawei-ups2000 i managed to do it
>> and i tried the same command using huawei-ups2000.
>>
>> See the logs
>>
>> "
>>
>> /tmp/nut# ./drivers/huawei-ups2000 -DDDDDD -d1 -s test -x port=auto -x
>> vendorid=... -x productid=... -x subdriver=...
>> Network UPS Tools - NUT Huawei UPS2000 (1kVA-3kVA) RS-232 Modbus driver
>> 0.05 (2.8.0-2557-g81fca30b2)
>> Warning: This is an experimental driver.
>> Some features may not function correctly.
>>
>>    0.000000    [D3] main_arg: var='port' val='auto'
>>    0.000048    [D6] testinfo_reloadable: var=port,
>> infoname=driver.parameter.port, newval=auto, reloadable=0, reload_flag=0
>>    0.000064    [D6] testinfo_reloadable: verdict for (re)loading var=port
>> value: 1
>>    0.000092    [D5] send_to_all: SETINFO driver.parameter.port "auto"
>>    0.000117    [D3] main_arg: var='vendorid' val='...'
>>
>> Fatal error: 'vendorid' is not a valid variable name for this driver.
>>
>> Look in the man page or call this driver with -h for a list of
>> valid variable names and flags.
>>    0.000163    [D5] send_to_all: SETINFO driver.state "cleanup.exit"
>> "
>>
>> Best regards,
>>
>> FatGear
>> Le 19/09/2023 à 21:40, Jim Klimov a écrit :
>>
>> Well, now that the `subdriver` option got added to `usbhid-ups` too, you
>> can at least try that (by building again the current master). See
>> command-line help for the subdrivers it would currently recognize, and copy
>> e.g. the first word as the matching option, e.g.:
>>
>>     ./drivers/usbhid-ups -DDDDDD -d1 -s test -x port=auto -x vendorid=...
>> -x productid=... -x subdriver=...
>>
>> and try to lockpick your way here.
>>
>> On a side note, some long-awaited tinkering began on making an APC modbus
>> driver a reality, but so far it is in such early stages that it relies on
>> an unpublished version of the modbus library so is not trivial to even
>> build (or get packaged).
>>
>> Jim
>>
>>
>> On Tue, Sep 19, 2023 at 9:13 PM FatGear <fatgear1 at free.fr> wrote:
>>
>>> Hello there,
>>>
>>> I don't think that's working,😕
>>>
>>> I have done all your repo but i don't know how it's supposed to work.
>>>
>>> I have a idea, change vendor id and product id  to make the driver try
>>> to connect to the ups, what do you think of that ? With this driver maybe :
>>> usbhid-ups
>>>
>>> FatGear
>>> Le 16/09/2023 à 20:40, Jim Klimov a écrit :
>>>
>>> It seems the `libmodbus` library or headers were not found, or something
>>> similar - so the driver against it was not built. Did you install
>>> `libmodbus-dev` before the build? What does `config.log` in the build root
>>> say (and.or the summary shown after you run the `configure` script)?
>>>
>>> On Sat, Sep 16, 2023 at 7:46 PM FatGear <fatgear1 at free.fr> wrote:
>>>
>>>> Hi,
>>>>
>>>> I don't know what i'm doing wrong but it seams that is not working,
>>>>
>>>> I tried to put and remove id but it's not fonctioning,
>>>>
>>>> /etc/nut/ups.conf
>>>>
>>>> "
>>>>
>>>> pollinterval = 1
>>>> maxretry = 3
>>>>
>>>> [ups1kva]
>>>>         driver = huawei-ups2000
>>>>         port auto
>>>>         vendorid = "04e2"
>>>>         productid = "1410"
>>>> "
>>>>
>>>> Then i use this commands for rebooting the drivers
>>>>
>>>> https://techno-tim.github.io/posts/NUT-server-guide/
>>>>
>>>> "
>>>>
>>>> /tmp# sudo service nut-server restart
>>>> /tmp# sudo service nut-client restart
>>>> /tmp# sudo systemctl restart nut-monitor
>>>> /tmp# sudo upsdrvctl stop
>>>> Network UPS Tools - UPS driver controller 2.8.0-2454-g91b3ee057
>>>> Can't open /var/state/ups/huawei-ups2000-ups1kva.pid either: No such
>>>> file or directory
>>>> /tmp# sudo upsdrvctl start
>>>> Network UPS Tools - UPS driver controller 2.8.0-2454-g91b3ee057
>>>> Can't start /usr/bin/huawei-ups2000: No such file or directory
>>>> "
>>>>
>>>> On my "/tmp/nut/drivers/" i have :
>>>>
>>>> huawei-ups2000.c
>>>>
>>>> And in my "ls /lib/nut/" I haven't huawey-ups2000
>>>>
>>>>
>>>> "APC" became "schneider" i don't know this is relevant or not.
>>>>
>>>> What are you sugesting i do next ?
>>>>
>>>> If you want we can call each others, via discord maybe ?
>>>>
>>>> FatGear
>>>>
>>>>
>>>> Le 16/09/2023 à 17:00, Jim Klimov a écrit :
>>>>
>>>> Hi, sounds like we're making progress here :)
>>>>
>>>>   Well, if you've tried *all* of those commands, it should have made a
>>>> build workspace under /tmp/nut where it has a current NUT codebase build.
>>>>
>>>>   That should include a `/tmp/nut/drivers/huawei-ups2000` binary right
>>>> there (assuming you also did follow the link to
>>>> https://github.com/networkupstools/nut/blob/master/docs/config-prereqs.txt
>>>> and installed the `libmodbus-dev` or equivalent for your OS distribution,
>>>> among other prerequisites). This one should suffice to try testing if your
>>>> device is supported by that driver.
>>>>
>>>>   The contents of `/lib/nut` are relevant if you've also followed up
>>>> with `sudo make install` noted at the end of the doc, to replace your
>>>> packaged NUT installation. Perhaps even then, it might not auto-detect the
>>>> custom paths to drivers like these and would just place the new ones into
>>>> /usr/bin or some such.
>>>>
>>>>   All that said however, if the UPS you are looking at is still the APC
>>>> mentioned earlier, I have doubts if the huawei driver would handle it
>>>> (might... maybe they are an OEM for rebranding now?..) or if that device
>>>> just happens to use the same USB interface chip as some of those Huawei's
>>>> did - and perhaps without changing the IDs to APC's (which seems strange,
>>>> they have an assigned ID), but talks a different protocol using such chip.
>>>>
>>>>
>>>> On Sat, Sep 16, 2023 at 10:09 AM FatGear via Nut-upsdev <
>>>> nut-upsdev at alioth-lists.debian.net> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I tried all commands on
>>>>>
>>>>> https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests
>>>>>
>>>>> but i don't know what i'm supposed to do next, it seams to download
>>>>> some
>>>>> things on my /tmp/nut/ but i don't know what is it.
>>>>>
>>>>> My kernel is Linux 5.4.0-162-generic x86_64 and i don't have
>>>>> huawei-ups2000 driver.
>>>>>
>>>>> I have "/lib/nut$ ls
>>>>> al175         blazer_usb    metasys          riello_ser
>>>>> apcsmart      clone         mge-shut         riello_usb
>>>>> apcsmart-old  clone-outlet  mge-utalk        safenet
>>>>> apcupsd-ups   dummy-ups     microdowell      solis
>>>>> bcmxcp        etapro        nutdrv_atcl_usb  tripplite
>>>>> bcmxcp_usb    everups       nutdrv_qx        tripplitesu
>>>>> belkin        gamatronic    oldmge-shut      tripplite_usb
>>>>> belkinunv     genericups    oneac            upscode2
>>>>> bestfcom      isbmex        optiups          upsd
>>>>> bestfortress  ivtscd        powercom         upsmon
>>>>> bestuferrups  liebert       powerpanel       usbhid-ups
>>>>> bestups       liebert-esp2  rhino            victronups
>>>>> blazer_ser    masterguard   richcomm_usb
>>>>> "
>>>>>
>>>>> My lsusb is showing "Bus 001 Device 008: ID 04e2:1410 Exar Corp.
>>>>> XR21V1410 USB-UART IC"
>>>>>
>>>>> And i don't know what to do next.
>>>>>
>>>>> Fatgear
>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsdev/attachments/20230923/64159326/attachment-0001.htm>


More information about the Nut-upsdev mailing list