[Nut-upsuser] NUT 2.4.3 on new server can not see serial number, but old nut on different hardware can?

Jon Bendtsen jbendtsen at laerdal.dk
Mon Nov 15 11:59:59 UTC 2010


On 13/11/2010, at 01.19, Charles Lepple wrote:

> On Nov 12, 2010, at 11:16 AM, Jon Bendtsen wrote:
> 
>> dkplugbab9:/usr/local/ups/etc# /usr/local/ups/bin/usbhid-ups -a apc1500 -u nut -DD
>> Network UPS Tools - Generic HID driver 0.34 (2.4.3)
>> USB communication driver 0.31
>>  0.000000	debug level is '2'
>>  0.002738	upsdrv_initups...
>>  0.005059	Checking device (051D/0002) (001/011)
>>  0.005304	- VendorID: 051d
>>  0.005351	- ProductID: 0002
>>  0.005383	- Manufacturer: unknown
>>  0.005420	- Product: unknown
>>  0.005451	- Serial Number: unknown
>>  0.005486	- Bus: 001
>>  0.005516	Trying to match device
>>  0.005630	Device does not match - skipping
> 
> Arjen has a point about a lot of things changing at once, but one thing that can cause these items to show up as "unknown" is that the "nut" user doesn't have write access to the device.

SPOT on. It is not group nut.

I know it is a lot of things changed, but I can not change anything less, expect maybe installing the debian nut package.


> In order to fetch a string from a USB device (such as the serial number), you need to be able to write a control message to it.
> 
> On the old system, the Debian packaging would have interacted with udev to set this up. Chances are that you just need to find the right place to drop the scripts/udev/nut-usbups.rules file, and tell udev to rescan the bus.

On both the old and the new machine there is this file:
	/etc/udev/rules.d/52-nut-usbups.rules 

Both files start with

	ACTION!="add", GOTO="nut-usbups_rules_end"
	SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
	SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
	BUS!="usb", GOTO="nut-usbups_rules_end" 

And both have
	# APC
	# various models - usbhid-ups
	ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="nut" 

And ends with
	LABEL="nut-usbups_rules_end"



I just tried restarting udev
	/etc/init.d/udev stop 
	/etc/init.d/udev start

But the file
	dkplugbab9:/etc/udev# ls -la /dev/bus/usb/001/
	total 0
	drwxr-xr-x 2 root root 160 2010-11-12 17:14 .
	drwxr-xr-x 3 root root 60 2010-11-12 17:14 ..
	crw-rw-r-- 1 root root 189, 0 2010-11-12 17:14 001
	crw-rw-r-- 1 root root 189, 1 2010-11-12 17:14 002
	crw-rw-r-- 1 root root 189, 2 2010-11-12 17:14 003
	crw-rw-r-- 1 root root 189, 3 2010-11-12 17:14 004
	crw-rw-r-- 1 root root 189, 4 2010-11-12 17:14 005
	crw-rw-r-- 1 root root 189, 5 2010-11-12 17:14 006 

still do not change the group, but 
	udevadm info --name=/dev/bus/usb/001/006 --attribute-walk | less
shows me the serial number. But it shows it differently, it says:

	ATTRS{idVendor}=="051d"
	ATTRS{idProduct}=="0002"
	ATTRS{bcdDevice}=="0006"
	ATTRS{bDeviceClass}=="00"
	ATTRS{bDeviceSubClass}=="00"
	ATTRS{bDeviceProtocol}=="00"
	ATTRS{bNumConfigurations}=="1"
	ATTRS{bMaxPacketSize0}=="8"
	ATTRS{speed}=="1.5"
	ATTRS{busnum}=="1"
	ATTRS{devnum}=="6"
	ATTRS{version}==" 1.10"
	ATTRS{maxchild}=="0"
	ATTRS{quirks}=="0x0"
	ATTRS{authorized}=="1"
	ATTRS{manufacturer}=="American Power Conversion"
	ATTRS{product}=="Smart-UPS 1500 FW:653.12.I USB FW:4.2"
	ATTRS{serial}=="AS0535132782" 

Notice how the /etc/udev/rules.d/52-nut-usbups.rules uses ATTR where udev uses ATTRS. If add a ATTRS line to /etc/udev/rules.d/52-nut-usbups.rules then everything works fine
	crw-rw-r-- 1 root nut 189, 5 2010-11-12 17:14 006 

So now I am only left pondering what is up with the ATTR and ATTRS difference?



JonB



More information about the Nut-upsuser mailing list