[Nut-upsdev] support for newer mustek powermust model 06da:0003
Timo Lindfors
timo.lindfors at iki.fi
Mon Nov 26 16:33:43 UTC 2007
Hi,
"Arjen de Korte" <nut+devel at de-korte.org> writes:
> You'll have to fix your udev rules or else run the driver as root.
The udev rules in svn look correct to me
/etc/udev/rules.d/52_nut-usbups.rules:SYSFS{idVendor}=="0665", SYSFS{idProduct}=="5161", MODE="664", GROUP="nut"
but they just don't apply until I reboot. I first thought that
udevtrigger would have been the method to apply these changes without
reboot but the debian udev maintainer told me that manual chmod/chown
really would be the preferred solution:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=435624
Anyways, the strace output shows that after the kernel driver is
detached nut manages to claim the interface:
16040 ioctl(4, USBDEVFS_CLAIMINTERFACE, {0}) = -1 EBUSY (Device or resource busy)
16040 write(2, "failed to claim USB device, trying 2 more time(s)...\n", 53) = 53
16040 write(2, "detaching kernel driver from USB device...\n", 43) = 43
16040 ioctl(4, USBDEVFS_IOCTL, {ifno=0, ioctl_code=21782}) = 0
16040 write(2, "trying again to claim USB device...\n", 36) = 36
16040 ioctl(4, USBDEVFS_CLAIMINTERFACE, {0}) = 0
So, I'm guessing it's not a permission problem but the old mustek too
wants 8-byte reads and zero-padded 8-byte writes.
If I add phoenix_subdriver to subdriver_list
Index: drivers/megatec_usb.c
===================================================================
--- drivers/megatec_usb.c (revision 1163)
+++ drivers/megatec_usb.c (working copy)
@@ -87,6 +87,7 @@
static subdriver_t *subdriver_list[] = {
&agiler_subdriver,
&krauler_subdriver,
+ &phoenix_subdriver,
NULL /* end of list */
};
I can actually use also the old mustek UPS with the phoenix driver:
$ sudo /lib/nut/megatec_usb -a myups -DDDDD -x vendorid=0665 -x productid=5161 -x subdriver=phoenix
Network UPS Tools 2.3.0-1163M - Megatec protocol driver 1.5.8 [megatec_usb]
Carlos Rodrigues (c) 2003-2007
Serial-over-USB transport layer for Megatec protocol driver [megatec_usb]
Andrey Lelikov (c) 2006, Alexander Gordeev (c) 2006-2007, Jon Gough (c) 2007
debug level is '5'
Checking device (0665/5161) (001/002)
- VendorID: 0665
- ProductID: 5161
- Manufacturer: Cypress Semiconductor
- Product: USB to Serial
- Serial Number: unknown
- Bus: 001
Trying to match device
Device matches
Starting UPS detection process...
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.2 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 32 20 32
get_data_phoenix: got so far [(228.2 228.3 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 35
get_data_phoenix: got so far [(228.2 228.3 225.7 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35
get_data_phoenix: got so far [(228.2 228.3 225.7 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.2 228.3 225.7 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.2 228.3 225.7 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.2 228.3 225.7 008 50.1 13.6 25.0 00001001]
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.2 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 32 20 32
get_data_phoenix: got so far [(228.2 228.2 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35
get_data_phoenix: got so far [(228.2 228.2 225.8 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35
get_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.2 228.2 225.8 008 50.1 13.6 25.0 00001001]
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.3 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 33 20 32
get_data_phoenix: got so far [(228.3 228.2 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35
get_data_phoenix: got so far [(228.3 228.2 225.7 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35
get_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.3 228.2 225.7 008 50.1 13.6 25.0 00001001]
3 out of 3 detection attempts succeeded (minimum required 3)
Asking for UPS information [I]...
I => FAILED [short read]
I detail: (1 bytes) => 49
Megatec protocol UPS detected.
Asking for UPS power ratings [F]...
get_data_phoenix: got so far [#220.0 0]
get_data_phoenix: (8 bytes) => 23 32 32 30 2e 30 20 30
get_data_phoenix: got so far [#220.0 003 12.00]
get_data_phoenix: (16 bytes) => 23 32 32 30 2e 30 20 30 30 33 20 31 32 2e
30 30
00]_data_phoenix: got so far [#220.0 003 12.00 50.0
get_data_phoenix: (24 bytes) => 23 32 32 30 2e 30 20 30 30 33 20 31 32 2e
30 30 20 35 30 2e 30 0d 30 30
F => OK [#220.0 003 12.00 50.0]
12.0V battery, interval [9.7V, 13.7V].
Done setting up the UPS.
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.2 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 32 20 32
get_data_phoenix: got so far [(228.2 228.2 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35
get_data_phoenix: got so far [(228.2 228.2 225.7 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35
get_data_phoenix: got so far [(228.2 228.2 225.7 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.2 228.2 225.7 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.2 228.2 225.7 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.2 228.2 225.7 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
dstate_init: sock /var/run/nut/megatec_usb-myups open on fd 5
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.3 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 33 20 32
get_data_phoenix: got so far [(228.3 228.2 226]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 36
get_data_phoenix: got so far [(228.3 228.2 226.0 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 36 2e 30 20 30 30 38 20 35
get_data_phoenix: got so far [(228.3 228.2 226.0 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.3 228.2 226.0 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.3 228.2 226.0 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.3 228.2 226.0 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
new connection on fd 6
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.3 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 33 20 32
get_data_phoenix: got so far [(228.3 228.2 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35
get_data_phoenix: got so far [(228.3 228.2 225.7 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35
get_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.3 228.2 225.7 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 32 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.3 228.2 225.7 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.2 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 32 20 32
get_data_phoenix: got so far [(228.2 228.2 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35
get_data_phoenix: got so far [(228.2 228.2 225.8 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35
get_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.2 228.2 225.8 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 32 20 32
32 35 2e 38 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.2 228.2 225.8 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.2 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 32 20 32
get_data_phoenix: got so far [(228.2 228.3 226]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 36
get_data_phoenix: got so far [(228.2 228.3 226.0 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 36 2e 30 20 30 30 38 20 35
get_data_phoenix: got so far [(228.2 228.3 226.0 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.2 228.3 226.0 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.2 228.3 226.0 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 32 20 32 32 38 2e 33 20 32
32 36 2e 30 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.2 228.3 226.0 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(228.3 2]
get_data_phoenix: (8 bytes) => 28 32 32 38 2e 33 20 32
get_data_phoenix: got so far [(228.3 228.3 225]
get_data_phoenix: (16 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 33 20 32
32 35
get_data_phoenix: got so far [(228.3 228.3 225.7 008 5]
get_data_phoenix: (24 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35
get_data_phoenix: got so far [(228.3 228.3 225.7 008 50.1 13.6]
get_data_phoenix: (32 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36
get_data_phoenix: got so far [(228.3 228.3 225.7 008 50.1 13.6 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(228.3 228.3 225.7 008 50.1 13.6 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 38 2e 33 20 32 32 38 2e 33 20 32
32 35 2e 37 20 30 30 38 20 35 30 2e 31 20 31 33 2e 36 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
Q1 => OK [(228.3 228.3 225.7 008 50.1 13.6 25.0 00001001]
Calculated battery charge: 97.5%
Signal 2: exiting
best regards,
Timo Lindfors
More information about the Nut-upsdev
mailing list