<br><div class="gmail_quote">2012/12/3 Jevgeni Jurtsenko <span dir="ltr"><<a href="mailto:jevgenious@gmail.com" target="_blank">jevgenious@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Arnaud,</blockquote><div><br>Hi Jevgeni,<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div><div>Unfortunately your patch didn't solved the problem for me.</div>
</blockquote><div><br>it couldn't, since your issue is upstream to it (i.e, in kernel land)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>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 <b>usbfs </b>errors about claiming the device. One of the suggestions was the problem with <b>dwc_otg </b>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</div>
<div><br></div><div><div>lsusb -v -d0x06da:0x0002</div><div><br></div><div>Bus 001 Device 004: ID 06da:0002 Phoenixtec Power Co., Ltd UPS</div><div>Device Descriptor:</div><div> bLength 18</div><div> bDescriptorType 1</div>
<div> bcdUSB 1.10</div><div> bDeviceClass 0 (Defined at Interface level)</div><div> bDeviceSubClass 0</div><div> bDeviceProtocol 0</div><div> bMaxPacketSize0 8</div><div>
idVendor 0x06da Phoenixtec Power Co., Ltd</div><div> idProduct 0x0002 UPS</div><div> bcdDevice 1.00</div><div> iManufacturer 4</div><div> iProduct 24</div><div>
iSerial 0</div>
<div> bNumConfigurations 1</div><div> Configuration Descriptor:</div><div> bLength 9</div><div> bDescriptorType 2</div><div> wTotalLength 34</div><div> bNumInterfaces 1</div>
<div> bConfigurationValue 1</div><div> iConfiguration 0</div><div> bmAttributes 0x80</div><div> (Bus Powered)</div><div> MaxPower 60mA</div><div> Interface Descriptor:</div>
<div> bLength 9</div><div> bDescriptorType 4</div><div> bInterfaceNumber 0</div><div> bAlternateSetting 0</div><div> bNumEndpoints 1</div><div> bInterfaceClass 255 Vendor Specific Class</div>
<div> bInterfaceSubClass 0</div><div> bInterfaceProtocol 0</div><div> iInterface 0</div><div> ** UNRECOGNIZED: 09 21 00 01 00 01 22 00 00</div><div> Endpoint Descriptor:</div>
<div> bLength 7</div><div> bDescriptorType 5</div><div> bEndpointAddress 0x81 EP 1 IN</div><div> bmAttributes 3</div><div> Transfer Type Interrupt</div>
<div> Synch Type None</div><div> Usage Type Data</div><div> wMaxPacketSize 0x0008 1x 8 bytes</div><div> bInterval 20</div><div>Device Status: 0x5a08</div>
<div> (Bus Powered)</div><div>¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤</div><div><span style="color:rgb(34,34,34);font-size:13.333333969116211px;font-family:arial,sans-serif"><b>grep usb /var/log/syslog</b></span></div>
<div><div>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</div><div>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</div>
<div>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</div><div>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</div>
<div>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</div><div>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</div>
<div>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</div><div>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</div>
<div>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</div><div>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</div>
<div>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</div><div>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</div>
<div>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</div><div>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</div>
</div><div>¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤</div><div><div><b>/lib/nut/bcmxcp_usb -DDDDD -u root -a ups</b></div><div>Network UPS Tools - BCMXCP UPS driver 0.26 (2.6.5)</div><div>USB communication subdriver 0.22</div><div>
0.000000 send_to_all: SETINFO driver.parameter.port "auto"</div><div> 0.002520 debug level is '5'</div><div> 0.019435 entering nutusb_open()</div><div> 0.037846 device 004 opened successfully</div>
<div> 0.039967 Can't claim POWERWARE USB interface: could not claim interface 0: Device or resource busy</div><div> 0.041162 Can't reset POWERWARE USB endpoint: could not clear/halt ep 129: Device or resource busy</div>
<div> 0.041965 device 004 opened successfully</div><div> 0.042690 Can't claim POWERWARE USB interface: could not claim interface 0: Device or resource busy</div><div> 0.043556 Can't reset POWERWARE USB endpoint: could not clear/halt ep 129: Device or resource busy</div>
<div> 0.043866 device 004 opened successfully</div><div> 0.047520 Can't claim POWERWARE USB interface: could not claim interface 0: Device or resource busy</div><div> 0.047826 Can't reset POWERWARE USB endpoint: could not clear/halt ep 129: Device or resource busy</div>
<div> 0.048427 device 004 opened successfully</div><div> 0.048982 Can't claim POWERWARE USB interface: could not claim interface 0: Device or resource busy</div><div> 0.049834 Can't reset POWERWARE USB endpoint: could not clear/halt ep 129: Device or resource busy</div>
<div> 0.051205 send_to_all: SETINFO device.type "ups"</div><div> 0.051958 send_to_all: SETINFO driver.version "2.6.5"</div><div> 0.052674 send_to_all: SETINFO driver.version.internal "0.26"</div>
<div> 0.053397 send_to_all: SETINFO <a href="http://driver.name" target="_blank">driver.name</a> "bcmxcp_usb"</div><div> 0.057015 send_read_command: (4 bytes) => ab 01 31 23</div><div> 0.058327 entering get_answer(31)</div>
<div> 0.058576 => packet_loop (0, 0)</div><div> 0.058761 => bytes_read (0)</div><div> 0.059160 => usb_interrupt_read -16</div><div> 0.059762 => packet_loop (0, 0)</div><div> 0.060236 => bytes_read (0)</div>
<div> 0.061093 => usb_interrupt_read -16</div><div> 0.062454 => packet_loop (0, 0)</div><div> 0.062681 => bytes_read (0)</div><div> 0.063447 => usb_interrupt_read -16</div><div> 0.064235 => packet_loop (0, 0)</div>
<div> 0.067008 => bytes_read (0)</div><div> 0.077926 => usb_interrupt_read -16</div><div> 0.078266 => packet_loop (0, 0)</div><div> 0.078472 => bytes_read (0)</div><div> 0.078729 => usb_interrupt_read -16</div>
<div> 0.078989 => packet_loop (0, 0)</div><div> 0.079185 => bytes_read (0)</div><div> 0.080005 => usb_interrupt_read -16</div><div> 0.080783 => packet_loop (0, 0)</div><div> 0.081474 => bytes_read (0)</div>
<div> 0.087552 => usb_interrupt_read -16</div><div> 0.088423 => packet_loop (0, 0)</div><div> 0.089122 => bytes_read (0)</div><div> 0.089437 => usb_interrupt_read -16</div><div> 0.090164 => packet_loop (0, 0)</div>
<div> 0.090891 => bytes_read (0)</div><div> 0.091226 => usb_interrupt_read -16</div><div> 0.091990 => packet_loop (0, 0)</div><div> 0.092673 => bytes_read (0)</div><div> 0.092970 => usb_interrupt_read -16</div>
<div> 0.093732 => packet_loop (0, 0)</div><div> 0.094733 => bytes_read (0)</div><div> 0.095671 => usb_interrupt_read -16</div><div> 0.095957 => packet_loop (0, 0)</div><div> 0.096650 => bytes_read (0)</div>
<div> 0.097030 => usb_interrupt_read -16</div><div> 0.097827 => packet_loop (0, 0)</div><div> 0.098527 => bytes_read (0)</div><div> 0.099317 => usb_interrupt_read -16</div><div> 0.107015 => packet_loop (0, 0)</div>
<div> 0.107782 => bytes_read (0)</div><div> 0.108528 => usb_interrupt_read -16</div><div> 0.108810 => packet_loop (0, 0)</div><div> 0.109511 => bytes_read (0)</div><div> 0.110432 => usb_interrupt_read -16</div>
<div> 0.110710 => packet_loop (0, 0)</div><div> 0.111359 => bytes_read (0)</div><div> 0.111704 => usb_interrupt_read -16</div><div> 0.112659 => packet_loop (0, 0)</div><div> 0.112876 => bytes_read (0)</div>
<div> 0.117529 => usb_interrupt_read -16</div><div> 0.118350 => packet_loop (0, 0)</div><div> 0.119051 => bytes_read (0)</div><div> 0.119353 => usb_interrupt_read -16</div><div> 0.120120 => packet_loop (0, 0)</div>
<div> 0.120336 => bytes_read (0)</div></div><div>¤¤¤¤¤¤¤¤¤¤¤¤¤¤</div><div><div><b> ps -efl | grep bcm</b></div><div>1 R nut 1984 1 42 80 0 - 558 - 16:51 ? 00:05:50 /lib/nut/bcmxcp_usb -a ups</div>
<div>0 S root 2167 2129 0 80 0 - 883 pipe_w 17:05 pts/0 00:00:00 grep bcm</div></div><div>¤¤¤¤¤¤¤¤¤¤¤¤¤¤</div><div><b>usbreset.c</b></div><div><div>#include <stdlib.h></div><div>#include <stdio.h></div>
<div>#include <fcntl.h></div><div>#include <errno.h></div><div>#include <sys/types.h></div><div>#include <sys/stat.h></div><div>#include <sys/ioctl.h></div><div>#include <linux/usbdevice_fs.h></div>
<div><br></div><div>void main(int argc, char **argv)</div><div>{</div><div> const char *filename;</div><div> int fd;</div><div><br></div><div> if (argc < 2) {</div><div> printf("Give USB device name as parameter\n");</div>
<div> exit(1);</div><div> }</div><div> filename = argv[1];</div><div> fd = open(filename, O_WRONLY);</div><div> if (fd == -1) {</div><div> perror("USB device open failed");</div><div> exit(2);</div>
<div> }</div><div> if (ioctl(fd, USBDEVFS_RESET, 0) == -1) {</div><div> perror("USBDEVFS_RESET device ioctl failed");</div><div> exit(3);</div><div> }</div><div> close(fd);</div><div>}</div>
</div><div>¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤</div><div>After reset I receive in <b>/var/log/messages</b></div><div><div>Dec 3 17:24:57 kernel: <a href="tel:%5B%202027.136079" value="+12027136079" target="_blank">[ 2027.136079</a>] usb 1-1.3: usbfs: process 2228 (bcmxcp_usb) did not claim interface 0 before use</div>
<div>Dec 3 17:25:18 kernel: <a href="tel:%5B%202047.672034" value="+12047672034" target="_blank">[ 2047.672034</a>] usb 1-1.3: reset low-speed USB device number 4 using dwc_otg</div><div>Dec 3 17:27:16 kernel: <a href="tel:%5B%202166.249994" value="+12166249994" target="_blank">[ 2166.249994</a>] usb 1-1.3: USB disconnect, device number 4</div>
<div>Dec 3 17:27:18 kernel: <a href="tel:%5B%202168.021096" value="+12168021096" target="_blank">[ 2168.021096</a>] usb 1-1.3: new low-speed USB device number 5 using dwc_otg</div>
<div>Dec 3 17:27:18 kernel: <a href="tel:%5B%202168.129013" value="+12168129013" target="_blank">[ 2168.129013</a>] usb 1-1.3: New USB device found, idVendor=06da, idProduct=0002</div><div>Dec 3 17:27:18 kernel: <a href="tel:%5B%202168.129041" value="+12168129041" target="_blank">[ 2168.129041</a>] usb 1-1.3: New USB device strings: Mfr=4, Product=24, SerialNumbe r=0</div>
<div>Dec 3 17:27:18 kernel: <a href="tel:%5B%202168.129056" value="+12168129056" target="_blank">[ 2168.129056</a>] usb 1-1.3: Product: Powerware UPS</div><div>Dec 3 17:27:18 kernel: <a href="tel:%5B%202168.129067" value="+12168129067" target="_blank">[ 2168.129067</a>] usb 1-1.3: Manufacturer: Powerware</div>
</div><div><div><b> tail -f /var/log/syslog</b></div><div>
Dec 3 17:30:45 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div><div>Dec 3 17:30:49 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div><div>Dec 3 17:30:53 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div>
<div>Dec 3 17:30:57 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div><div>Dec 3 17:31:01 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div><div>Dec 3 17:31:05 raspberrypi bcmxcp_usb[2236]: RECONNECT USB DEVICE</div>
</div></div></blockquote><div><br>your issue is indeed related to dwc_otg, which binds to the device, and conflicts with bcmxcp_usb.<br>your reset attempt was a good try, but dwc_otg will re-attach as soon as the "new device" appears.<br>
<br>that said, there are 2 possible solutions:<br>- blacklist dwc_otg<br>- add a call to usb_detach_kernel_driver_np(), to detach dwc_otg (preferred solution).<br>there is a patch attached for this one. note that I've not tested it, since I've no HW under the hand.<br>
<br>feedback welcome.<br><br>cheers,<br>Arnaud<br></div></div>-- <br>NUT (Network UPS Tools) Project Leader - <a href="http://www.networkupstools.org" target="_blank">http://www.networkupstools.org</a><br>Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>
Free Software Developer - <a href="http://arnaud.quette.fr" target="_blank">http://arnaud.quette.fr</a><br><br>