<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 18.07.19 04:51, Charles Lepple
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:75972095-03B0-4513-9114-5F7B374CFD3D@gmail.com">
<pre class="moz-quote-pre" wrap="">On Jul 16, 2019, at 9:43 AM, Markus Grundmann wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
Whenever I called "lsof -p <pid>" for both "usbhid-ups" processes I notice that only the ugen/1.5.0 (aka /dev/usb/1.5.0) device was used. After my "patch" the drivers was called corect with the option -x and the output of "upsc" reports the right UPS and serialno.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Are you sure that the "serial = ..." parameters were specified in ups.conf when you started the drivers originally with "-a apc90*"?
The "-x serial=..." parameter to the driver is redundant when ups.conf has a "serial = " parameter. Also, the "port = ..." arguments are ignored by usbhid-ups, because there is no way to pass that port into libusb (and the ports returned during device enumeration are typically not stable across reboots anyway). We typically recommend "port = auto" for usbhid-ups (and other USB drivers).
If you are still seeing the problem where both UPSes are opening the same /dev node, we will need some driver traces to see why it is not matching the serial number specified in ups.conf. (I am not ready to rule out incompatible changes in FreeBSD 12.) Probably two "-D" flags should be sufficient. You can stop them with upsdrvctl first, but I would recommend starting usbhid-ups directly ("/usr/local/ups/bin/usbhid-ups -a apc900 -D -D"; otherwise, if you specify "upsdrvctl -D -D", NUT thinks you are trying to debug upsdrvctl itself.)
</pre>
</blockquote>
<p>You are right Chalres !!! But I don't know why I have not probed
this variant in the past :-(</p>
<p>I have used the origin upsdrvctl binary in the following test and
it works also and I'm little bit irritated now. Thanks for your
reply!</p>
<p>Please forget my "PATCH" request *LOL*<br>
</p>
<p><br>
</p>
<p><font face="Courier New, Courier, monospace">$ tail -n15
/usr/local/etc/nut/ups.conf<br>
# the -h option and/or read the driver's documentation.<br>
<br>
user = root<br>
<br>
[apc900]<br>
driver = usbhid-ups<br>
port = auto<br>
serial = 3B1520X10340<br>
desc = "APC900-LEFT"<br>
<br>
[apc901]<br>
driver = usbhid-ups<br>
port = auto<br>
serial = 3B1207X25460<br>
desc = "APC900-RIGHT"<br>
<br>
$ service nut start<br>
Network UPS Tools - UPS driver controller 2.7.4<br>
Network UPS Tools - Generic HID driver 0.41 (2.7.4)<br>
USB communication driver 0.33<br>
Using subdriver: APC HID 0.96<br>
Network UPS Tools - Generic HID driver 0.41 (2.7.4)<br>
USB communication driver 0.33<br>
Using subdriver: APC HID 0.96<br>
Starting nut.<br>
Network UPS Tools upsd 2.7.4<br>
fopen /var/db/nut/upsd.pid: No such file or directory<br>
listening on 0.0.0.0 port 3493<br>
Connected to UPS [apc901]: usbhid-ups-apc901<br>
Connected to UPS [apc900]: usbhid-ups-apc900<br>
<br>
$ ps auxw|grep -e nut -e ups<br>
root 4929 0.0 0.0 11880 3040 - Ss 07:45 0:00.01
/usr/local/libexec/nut/usbhid-ups -a apc900<br>
root 6418 0.0 0.0 11880 3040 - Ss 07:45 0:00.00
/usr/local/libexec/nut/usbhid-ups -a apc901<br>
uucp 8097 0.0 0.0 30088 2892 - Ss 07:45 0:00.00
/usr/local/sbin/upsd<br>
<br>
$ upsc apc900 | grep -i serial<br>
device.serial: 3B1520X10340 <br>
driver.parameter.serial: 3B1520X10340<br>
ups.serial: 3B1520X10340 <br>
<br>
$ upsc apc901 | grep -i serial<br>
device.serial: 3B1207X25460 <br>
driver.parameter.serial: 3B1207X25460<br>
ups.serial: 3B1207X25460</font></p>
<p><font face="Courier New, Courier, monospace">### Both drivers
using the right device. Without the serial statement in ups.conf
only '/dev/usb/1.5.0' was used.<br>
</font></p>
<p><font face="Courier New, Courier, monospace">$ lsof -p 4929<br>
COMMAND PID USER FD TYPE DEVICE SIZE/OFF
NODE NAME<br>
usbhid-up 4929 root cwd VDIR 1643202022,2213797598 9
44338 /var/db/nut<br>
usbhid-up 4929 root rtd VDIR 1643202022,2213797598
27 4 /<br>
usbhid-up 4929 root txt VREG 1643202022,2213797598 191832
44147 /usr/local/libexec/nut/usbhid-ups<br>
usbhid-up 4929 root txt VREG 1643202022,2213797598 148320
223 /libexec/ld-elf.so.1<br>
usbhid-up 4929 root txt VREG 1643202022,2213797598 93672
13486 /usr/lib/libusb.so.3<br>
usbhid-up 4929 root txt VREG 1643202022,2213797598 131824
200 /lib/libthr.so.3<br>
usbhid-up 4929 root txt VREG 1643202022,2213797598 1949672
33820 /lib/libc.so.7<br>
usbhid-up 4929 root 0u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 4929 root 1u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 4929 root 2u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 4929 root 3u unix 0xfffff8023ff4c6d0
0t0 ->0xfffff800134846d0<br>
usbhid-up 4929 root 4u VCHR 0,140 0t0
140 /dev/usb/1.4.0<br>
usbhid-up 4929 root 5u VCHR 0,140 0t0
140 /dev/usb/1.4.0<br>
usbhid-up 4929 root 6u unix 0xfffff80013483000
0t0 /var/db/nut/usbhid-ups-apc900<br>
usbhid-up 4929 root 7u unix 0xfffff800735046d0
0t0 /var/db/nut/usbhid-ups-apc900<br>
</font></p>
<p><font face="Courier New, Courier, monospace">$ lsof -p 6418<br>
COMMAND PID USER FD TYPE DEVICE SIZE/OFF
NODE NAME<br>
usbhid-up 6418 root cwd VDIR 1643202022,2213797598 9
44338 /var/db/nut<br>
usbhid-up 6418 root rtd VDIR 1643202022,2213797598
27 4 /<br>
usbhid-up 6418 root txt VREG 1643202022,2213797598 191832
44147 /usr/local/libexec/nut/usbhid-ups<br>
usbhid-up 6418 root txt VREG 1643202022,2213797598 148320
223 /libexec/ld-elf.so.1<br>
usbhid-up 6418 root txt VREG 1643202022,2213797598 93672
13486 /usr/lib/libusb.so.3<br>
usbhid-up 6418 root txt VREG 1643202022,2213797598 131824
200 /lib/libthr.so.3<br>
usbhid-up 6418 root txt VREG 1643202022,2213797598 1949672
33820 /lib/libc.so.7<br>
usbhid-up 6418 root 0u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 6418 root 1u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 6418 root 2u VCHR 0,16
0t0 16 /dev/null<br>
usbhid-up 6418 root 3u unix 0xfffff80013754000
0t0 ->0xfffff800134846d0<br>
usbhid-up 6418 root 4u VCHR 0,232 0t0
232 /dev/usb/1.5.0<br>
usbhid-up 6418 root 5u VCHR 0,232 0t0
232 /dev/usb/1.5.0<br>
usbhid-up 6418 root 6u unix 0xfffff8023ff4c368
0t0 /var/db/nut/usbhid-ups-apc901<br>
usbhid-up 6418 root 7u unix 0xfffff800134836d0
0t0 /var/db/nut/usbhid-ups-apc901</font></p>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Best regards,
Markus
</pre>
</body>
</html>