-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El 2008-11-20 a las 13:33 +0100, escribí:
A eso me refiero. Ese dispositivo debe estar permanente y con los permisos adecuados, sino, el daemon no inicia y si está iniciado y desaparece, te saca los mensajes de "communication lost".
La gente de nut sabe que el dispositivo desaparece, pasa en todas las distros. Debe ser el propio nut quien lo borra.
/usr/lib/ups/driver/megatec_usb -DDD -a myups ... 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... Y no es cuestión de permisos. Acabo de hacer la pruba como usuario upsd, y ha funcionado: #upsd:x:115:2:UPS daemon:/sbin:/bin/false upsd:x:115:2:UPS daemon:/tmp:/bin/bash File /etc/passwd.vipwE4K2SS saved nimrodel:~ # su - upsd upsd@nimrodel:~> /usr/lib/ups/driver/megatec_usb -DDD -a myups Network UPS Tools 2.2.2 - Megatec protocol driver 1.5.14 [megatec_usb] Carlos Rodrigues (c) 2003-2008 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 '3' Checking device (1D6B/0001) (004/001) - - VendorID: 1d6b - - ProductID: 0001 - - Manufacturer: unknown - - Product: unknown - - Serial Number: unknown - - Bus: 004 ... Device does not match - skipping Checking device (0665/5161) (001/003) - - 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]... Q1 => OK [(235.7 235.7 235.7 020 49.9 13.6 25.0 00001001] Asking for UPS status [Q1]... ... 0 out of 5 detection attempts failed (minimum failures: 2). Cancelling any pending shutdown or battery test. Asking for UPS information [I]... I => FAILED [short read] I detail: (0 bytes) => Megatec protocol UPS detected. Parameter [ignoreoff]: [false] Asking for UPS power ratings [F]... F => OK [#230.0 002 12.00 50.0] 12.0V battery, interval [9.7V, 13.7V]. Done setting up the UPS. Asking for UPS status [Q1]... Q1 => OK [(238.2 238.2 238.2 019 49.9 13.6 25.0 00001001] Calculated battery charge: 97.5% En la traza veo que sigue recibiendo errores: ioctl(4, USBDEVFS_REAPURBNDELAY, 0xbfb4fb58) = -1 EAGAIN (Resource temporarily unavailable) select(5, NULL, [], NULL, {0, 1000}) = 0 (Timeout) gettimeofday({1227188395, 773789}, NULL) = 0 pero en realidad sigue leeyendo correctamente la UPS. creo que son estos los que le dan problemas después: open("/dev/bus/usb/001/001", O_RDONLY) = 5 open("/dev/bus/usb/001/003", O_RDWR) = 4 ioctl(4, USBDEVFS_CONTROL, 0xbfb4e2dc) = 4 ioctl(4, USBDEVFS_CONTROL, 0xbfb4e2dc) = 44 ioctl(4, USBDEVFS_CONTROL, 0xbfb4e2dc) = 4 ioctl(4, USBDEVFS_CONTROL, 0xbfb4e2dc) = 28 write(2, "- VendorID: 0665\n", 17) = 17 write(2, "- ProductID: 5161\n", 18) = 18 write(2, "- Manufacturer: Cypress Semicond"..., 38) = 38 write(2, "- Product: USB to Serial\n", 25) = 25 write(2, "- Serial Number: unknown\n", 25) = 25 write(2, "- Bus: 001\n", 11) = 11 write(2, "Trying to match device\n", 23) = 23 write(2, "Device matches\n", 15) = 15 Va interrogando por todo el USB, hasta que descubre la SAI. No usa el hiddev. Lo hago otra vez: cer@nimrodel:~> l /dev/hid* crw-rw-r-- 1 root daemon 180, 96 2008-11-20 14:47 /dev/hiddev0 crw-rw---- 1 root root 252, 0 2008-11-20 14:47 /dev/hidraw0 ejecuto, miro la traza... y el string "hid" no aparece por ningún lado, pero el proceso está leyendo la UPS y sacandome los valores por pantalla. Y los dispositivos han desaparecido: cer@nimrodel:~> l /dev/hid* ls: cannot access /dev/hid*: No such file or directory Conclusión: el daemon funciona, pero no en modo daemon, sino en consola. Posiblemente el retorno de error le confunde y no retorna "éxito", con lo cual el script de inicio abandona. Si yo me hiciera mi propio script daemon examinando la salida: Q1 => OK [(236.7 237.2 236.7 022 49.9 13.6 25.0 00001001] Calculated battery charge: 97.5% podría funcionar para apagar el ordenador en el momento adecuado. - -- Saludos Carlos E.R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkklbKcACgkQtTMYHG2NR9U54wCeJOQaLgYbSidVwIvVFYiH3sfi +nMAnAzRcvOp4mvtRY2PAlKGXLUehpta =yjl9 -----END PGP SIGNATURE-----