2012/12/3 Jevgeni Jurtsenko <jevgeni...@gmail.com> > Hi Arnaud,
Hi Jevgeni, > Unfortunately your patch didn't solved the problem for me. > it couldn't, since your issue is upstream to it (i.e, in kernel land) > I googled about the issue once more while setting the OS second time to > give logs you asked previously. Out of the syslog you can see that it is > being flooded with *usbfs *errors about claiming the device. One of the > suggestions was the problem with *dwc_otg *driver. However > my solution was a script, which resets usb and I'm able to get data from > UPS again.. As I mentioned above that re-plugging the usb cable solved it. > Problem is not stable ~3 fails out of 5 startups. At the moment I am using > PW5115 > > lsusb -v -d0x06da:0x0002 > > Bus 001 Device 004: ID 06da:0002 Phoenixtec Power Co., Ltd UPS > Device Descriptor: > bLength 18 > bDescriptorType 1 > bcdUSB 1.10 > bDeviceClass 0 (Defined at Interface level) > bDeviceSubClass 0 > bDeviceProtocol 0 > bMaxPacketSize0 8 > idVendor 0x06da Phoenixtec Power Co., Ltd > idProduct 0x0002 UPS > bcdDevice 1.00 > iManufacturer 4 > iProduct 24 > iSerial 0 > bNumConfigurations 1 > Configuration Descriptor: > bLength 9 > bDescriptorType 2 > wTotalLength 34 > bNumInterfaces 1 > bConfigurationValue 1 > iConfiguration 0 > bmAttributes 0x80 > (Bus Powered) > MaxPower 60mA > Interface Descriptor: > bLength 9 > bDescriptorType 4 > bInterfaceNumber 0 > bAlternateSetting 0 > bNumEndpoints 1 > bInterfaceClass 255 Vendor Specific Class > bInterfaceSubClass 0 > bInterfaceProtocol 0 > iInterface 0 > ** UNRECOGNIZED: 09 21 00 01 00 01 22 00 00 > Endpoint Descriptor: > bLength 7 > bDescriptorType 5 > bEndpointAddress 0x81 EP 1 IN > bmAttributes 3 > Transfer Type Interrupt > Synch Type None > Usage Type Data > wMaxPacketSize 0x0008 1x 8 bytes > bInterval 20 > Device Status: 0x5a08 > (Bus Powered) > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > *grep usb /var/log/syslog* > Nov 25 11:41:51 raspberrypi kernel: [ 95.021492] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021531] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021573] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021611] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021653] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021693] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021733] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021774] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021815] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021855] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021897] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021936] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.021976] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > Nov 25 11:41:51 raspberrypi kernel: [ 95.022017] usb 1-1.2: usbfs: > process 1862 (bcmxcp_usb) did not claim interface 0 before use > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > */lib/nut/bcmxcp_usb -DDDDD -u root -a ups* > Network UPS Tools - BCMXCP UPS driver 0.26 (2.6.5) > USB communication subdriver 0.22 > 0.000000 send_to_all: SETINFO driver.parameter.port "auto" > 0.002520 debug level is '5' > 0.019435 entering nutusb_open() > 0.037846 device 004 opened successfully > 0.039967 Can't claim POWERWARE USB interface: could not claim > interface 0: Device or resource busy > 0.041162 Can't reset POWERWARE USB endpoint: could not clear/halt > ep 129: Device or resource busy > 0.041965 device 004 opened successfully > 0.042690 Can't claim POWERWARE USB interface: could not claim > interface 0: Device or resource busy > 0.043556 Can't reset POWERWARE USB endpoint: could not clear/halt > ep 129: Device or resource busy > 0.043866 device 004 opened successfully > 0.047520 Can't claim POWERWARE USB interface: could not claim > interface 0: Device or resource busy > 0.047826 Can't reset POWERWARE USB endpoint: could not clear/halt > ep 129: Device or resource busy > 0.048427 device 004 opened successfully > 0.048982 Can't claim POWERWARE USB interface: could not claim > interface 0: Device or resource busy > 0.049834 Can't reset POWERWARE USB endpoint: could not clear/halt > ep 129: Device or resource busy > 0.051205 send_to_all: SETINFO device.type "ups" > 0.051958 send_to_all: SETINFO driver.version "2.6.5" > 0.052674 send_to_all: SETINFO driver.version.internal "0.26" > 0.053397 send_to_all: SETINFO driver.name "bcmxcp_usb" > 0.057015 send_read_command: (4 bytes) => ab 01 31 23 > 0.058327 entering get_answer(31) > 0.058576 => packet_loop (0, 0) > 0.058761 => bytes_read (0) > 0.059160 => usb_interrupt_read -16 > 0.059762 => packet_loop (0, 0) > 0.060236 => bytes_read (0) > 0.061093 => usb_interrupt_read -16 > 0.062454 => packet_loop (0, 0) > 0.062681 => bytes_read (0) > 0.063447 => usb_interrupt_read -16 > 0.064235 => packet_loop (0, 0) > 0.067008 => bytes_read (0) > 0.077926 => usb_interrupt_read -16 > 0.078266 => packet_loop (0, 0) > 0.078472 => bytes_read (0) > 0.078729 => usb_interrupt_read -16 > 0.078989 => packet_loop (0, 0) > 0.079185 => bytes_read (0) > 0.080005 => usb_interrupt_read -16 > 0.080783 => packet_loop (0, 0) > 0.081474 => bytes_read (0) > 0.087552 => usb_interrupt_read -16 > 0.088423 => packet_loop (0, 0) > 0.089122 => bytes_read (0) > 0.089437 => usb_interrupt_read -16 > 0.090164 => packet_loop (0, 0) > 0.090891 => bytes_read (0) > 0.091226 => usb_interrupt_read -16 > 0.091990 => packet_loop (0, 0) > 0.092673 => bytes_read (0) > 0.092970 => usb_interrupt_read -16 > 0.093732 => packet_loop (0, 0) > 0.094733 => bytes_read (0) > 0.095671 => usb_interrupt_read -16 > 0.095957 => packet_loop (0, 0) > 0.096650 => bytes_read (0) > 0.097030 => usb_interrupt_read -16 > 0.097827 => packet_loop (0, 0) > 0.098527 => bytes_read (0) > 0.099317 => usb_interrupt_read -16 > 0.107015 => packet_loop (0, 0) > 0.107782 => bytes_read (0) > 0.108528 => usb_interrupt_read -16 > 0.108810 => packet_loop (0, 0) > 0.109511 => bytes_read (0) > 0.110432 => usb_interrupt_read -16 > 0.110710 => packet_loop (0, 0) > 0.111359 => bytes_read (0) > 0.111704 => usb_interrupt_read -16 > 0.112659 => packet_loop (0, 0) > 0.112876 => bytes_read (0) > 0.117529 => usb_interrupt_read -16 > 0.118350 => packet_loop (0, 0) > 0.119051 => bytes_read (0) > 0.119353 => usb_interrupt_read -16 > 0.120120 => packet_loop (0, 0) > 0.120336 => bytes_read (0) > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > * ps -efl | grep bcm* > 1 R nut 1984 1 42 80 0 - 558 - 16:51 ? 00:05:50 > /lib/nut/bcmxcp_usb -a ups > 0 S root 2167 2129 0 80 0 - 883 pipe_w 17:05 pts/0 00:00:00 > grep bcm > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > *usbreset.c* > #include <stdlib.h> > #include <stdio.h> > #include <fcntl.h> > #include <errno.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <sys/ioctl.h> > #include <linux/usbdevice_fs.h> > > void main(int argc, char **argv) > { > const char *filename; > int fd; > > if (argc < 2) { > printf("Give USB device name as parameter\n"); > exit(1); > } > filename = argv[1]; > fd = open(filename, O_WRONLY); > if (fd == -1) { > perror("USB device open failed"); > exit(2); > } > if (ioctl(fd, USBDEVFS_RESET, 0) == -1) { > perror("USBDEVFS_RESET device ioctl failed"); > exit(3); > } > close(fd); > } > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > After reset I receive in */var/log/messages* > Dec 3 17:24:57 kernel: [ 2027.136079] usb 1-1.3: usbfs: process 2228 > (bcmxcp_usb) did not claim interface 0 before use > Dec 3 17:25:18 kernel: [ 2047.672034] usb 1-1.3: reset low-speed USB > device number 4 using dwc_otg > Dec 3 17:27:16 kernel: [ 2166.249994] usb 1-1.3: USB disconnect, device > number 4 > Dec 3 17:27:18 kernel: [ 2168.021096] usb 1-1.3: new low-speed USB > device number 5 using dwc_otg > Dec 3 17:27:18 kernel: [ 2168.129013] usb 1-1.3: New USB device found, > idVendor=06da, idProduct=0002 > Dec 3 17:27:18 kernel: [ 2168.129041] usb 1-1.3: New USB device strings: > Mfr=4, Product=24, SerialNumbe r=0 > Dec 3 17:27:18 kernel: [ 2168.129056] usb 1-1.3: Product: Powerware UPS > Dec 3 17:27:18 kernel: [ 2168.129067] usb 1-1.3: Manufacturer: Powerware > * tail -f /var/log/syslog* > Dec 3 17:30:45 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > Dec 3 17:30:49 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > Dec 3 17:30:53 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > Dec 3 17:30:57 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > Dec 3 17:31:01 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > Dec 3 17:31:05 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE > your issue is indeed related to dwc_otg, which binds to the device, and conflicts with bcmxcp_usb. your reset attempt was a good try, but dwc_otg will re-attach as soon as the "new device" appears. that said, there are 2 possible solutions: - blacklist dwc_otg - add a call to usb_detach_kernel_driver_np(), to detach dwc_otg (preferred solution). there is a patch attached for this one. note that I've not tested it, since I've no HW under the hand. feedback welcome. cheers, Arnaud -- NUT (Network UPS Tools) Project Leader - http://www.networkupstools.org Debian Developer - http://www.debian.org Free Software Developer - http://arnaud.quette.fr
xcpusb-detach-drv.diff
Description: Binary data
_______________________________________________ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser