From owner-freebsd-usb@FreeBSD.ORG Mon Feb 16 08:10:16 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BE781065674 for ; Mon, 16 Feb 2009 08:10:16 +0000 (UTC) (envelope-from bowie@nrik.jp) Received: from msa105.auone-net.jp (msa105.auone-net.jp [61.117.18.165]) by mx1.freebsd.org (Postfix) with ESMTP id D85018FC15 for ; Mon, 16 Feb 2009 08:10:14 +0000 (UTC) (envelope-from bowie@nrik.jp) Received: from brain.nrik.jp (KD124211071078.ppp-bb.dion.ne.jp [124.211.71.78]) by msa105.auone-net.jp (au one net msa) with ESMTP id 6E0AE684040; Mon, 16 Feb 2009 17:10:12 +0900 (JST) Date: Mon, 16 Feb 2009 17:10:09 +0900 Message-ID: <86ab8mree6.wl%bowie@nrik.jp> From: Noriyoshi Kawano To: Hans Petter Selasky In-Reply-To: <200902160835.55330.hselasky@c2i.net> References: <86y6wbf2nc.wl%bowie@nrik.jp> <200902141036.54246.hselasky@c2i.net> <86d4dij1i2.wl%bowie@nrik.jp> <200902160835.55330.hselasky@c2i.net> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.7 Emacs/22.3 (amd64-portbld-freebsd8.0) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: freebsd-usb@freebsd.org Subject: Re: USB2 & apcupsd X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 08:10:16 -0000 At Mon, 16 Feb 2009 08:35:54 +0100, Hans Petter Selasky wrote: > > On Monday 16 February 2009, Noriyoshi Kawano wrote: > > At Sat, 14 Feb 2009 10:36:53 +0100, > > > > Hans Petter Selasky wrote: > > > Hi, > > > > > > As long as you don't see ugenX.Y attach/detach messages, it means that > > > the Apcupsd daemon is doing something. Probably it is the > > > "usb_link_check()" procedure that is executing and the connection is > > > reset by the following code: > > > > > > if (my_data->fd) { > > > usb_reset(my_data->fd); > > > /* XXX: usb_close() not needed according to libusb0.1 refdocs */ > > > usb_close(my_data->fd); > > > > > > Could you enable debugging in Apcupsd ? > > > > > > What speed is your device reported like by usbconfig ? > > > > > > --HPS > > > > Hi, > > > > I enabled debugging in apcupsd. > > > > Because the "usb_interrupt_read()" becomes the error, > > the "usb_link_check()" is called. > > > > # apcupsd -d 500 > > --- snip --- > > 61.689 apcupsd: generic-usb.c:538 Timeout=539 > > 62.232 apcupsd: generic-usb.c:549 usb_interrupt_read error: (-1) Operation > > not permitted 62.232 apcupsd: generic-usb.c:458 link_check comm lost > > 68.538 apcupsd: generic-usb.c:300 Reinitializing private structure. > > 68.539 apcupsd: generic-usb.c:398 Initializing libusb > > 68.539 apcupsd: generic-usb.c:403 Found 0 USB busses > > 68.539 apcupsd: generic-usb.c:405 Found 0 USB devices > > 68.539 apcupsd: generic-usb.c:416 /dev/usb:/dev/ugen3.2 - 0000:0000 > > 68.539 apcupsd: generic-usb.c:416 /dev/usb:/dev/ugen0.2 - 051d:0002 > > --- snip --- > > > > # usbconfig -u 0 -a 2 > > ugen0.2: at > > usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON > > Does ugen0.2 have the correct permissions? > > usbconfig -u 0 -a 2 set_owner xxx:yyy set_perm 0660 > > --HPS I think that ugen0.2 have the correct permissions. Of course, I tried to set permissions. # usbconfig -u 0 -a 2 set_owner root:wheel set_perm 0660 But the result was the same. The "usb_interrupt_read()" is executed many time, and the most succeed. The "usb_interrupt_read()" is executed it after indication "generic-usb.c:538 Timeout=xxxxx". See attached log file and follow codes. ---- genric-usb.c ---- 538 Dmsg1(200, "Timeout=%d\n", timeout); 539 retval = usb_interrupt_read(my_data->fd, USB_ENDPOINT_IN|1, (char*)buf, sizeof(buf), timeout); 540 541 if (retval == 0 || retval == -LIBUSB_ETIMEDOUT) { 542 /* No events available in ups->wait_time seconds. */ 543 return 0; 544 } else if (retval == -EINTR || retval == -EAGAIN) { 545 /* assume SIGCHLD */ 546 continue; 547 } else if (retval < 0) { 548 /* Hard error */ 549 Dmsg2(200, "usb_interrupt_read error: (%d) %s\n", retval, strer ror(-retval)); 550 usb_link_check(ups); /* link is down, wait */ 551 return 0; 552 } 553 554 if (debug_level >= 300) { 555 logf("Interrupt data: "); 556 for (i = 0; i < retval; i++) 557 logf("%02x, ", buf[i]); 558 logf("\n"); 559 } ---- generic-usb.c ---- Noriyoshi Kawano