[Nut-upsdev] support for newer mustek powermust model 06da:0003

Timo Lindfors timo.lindfors at iki.fi
Sun Nov 25 20:42:14 UTC 2007


Arjen de Korte <nut+devel at de-korte.org> writes:
> I doubt it, but just in case I padded the commands to 8 bytes and
> removed flushing the buffer. Could you try again with version 1157 from
> the trunk?

$ sudo strace -o agiler-svn1157.strace -s4096 -f /lib/nut/megatec_usb -a myups -DDDDD -x vendorid=06da -x productid=0003 -x subdriver=agiler
Network UPS Tools 2.3.0-1157M - 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 (0000/0000) (005/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 005
Trying to match device
Device does not match - skipping
Checking device (06DA/0003) (004/002)
- VendorID: 06da
- ProductID: 0003
- Manufacturer: unknown
- Product: 87XXUPS
- Serial Number: unknown
- Bus: 004
Trying to match device
Device matches
failed to claim USB device, trying 2 more time(s)...
detaching kernel driver from USB device...
trying again to claim USB device...
Starting UPS detection process...
Asking for UPS status [Q1]...
Q1 => FAILED [timeout]
Asking for UPS status [Q1]...
Q1 => FAILED [timeout]
Asking for UPS status [Q1]...
Q1 => FAILED [timeout]
Asking for UPS status [Q1]...
Q1 => FAILED [timeout]
Asking for UPS status [Q1]...
Q1 => FAILED [timeout]
0 out of 5 detection attempts succeeded (minimum required 3)
Megatec protocol UPS not detected.

doesn't indeed seem to work so it must be something else then. I
tested again with my modified agiler driver in nut 2.2.0 and the UPS
seems to be still alive. Strace output under svn 1157 is available at


The only obvious between agiler2 (my "fork") and svn head I can see

diff -u <(grep ioctl agiler2-mustek2.strace|cut -d' ' -f2-|sed 's at 0x........@@g') <(grep ioctl agiler-svn1157.strace|cut -d' ' -f2-|sed 's at 0x........@@g')


-... USBDEVFS_SUBMITURB, {type=1, endpoint=129, status=..., flags=0, buffer_length=8 ...
+... USBDEVFS_SUBMITURB, {type=1, endpoint=129, status=..., flags=0, buffer_length=256 ...

(I replaced unnecessary stuff with "..."s.)

Where does that 8 vs. 256 difference come from? -- It seems that
ser_flush_io(int fd) tries to read 256 bytes. I changed this to 8
bytes but that alone does not seem to help. I now see one 8-byte
SUBMITURB and 5 256-byte SUBMITURBs.

Where do the five other SUBMITURBs come from? -- apparently
ser_get_line() calls agiler_get_data with
buflen=256. get_agiler_data() in nut 2.2.0 had a for-loop to read the
data in 8-byte pieces -- maybe that is still needed?

best regards,
Timo Lindfors

More information about the Nut-upsdev mailing list