From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Fly-0002qM-JF for qemu-devel@nongnu.org; Mon, 22 Jul 2013 09:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Fhn-0008Ve-9u for qemu-devel@nongnu.org; Mon, 22 Jul 2013 08:59:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Fhn-0008VG-0k for qemu-devel@nongnu.org; Mon, 22 Jul 2013 08:59:11 -0400 Message-ID: <51ED2C93.5050103@redhat.com> Date: Mon, 22 Jul 2013 14:58:59 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <33183CC9F5247A488A2544077AF190207EF5D6D2@szxeml538-mbx.china.huawei.com> In-Reply-To: <33183CC9F5247A488A2544077AF190207EF5D6D2@szxeml538-mbx.china.huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] usb: a problem of using libusb for usb pass through List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" Cc: Linqiangmin , Hans de Goede , Luonengjun , "qemu-devel@nongnu.org" , "Huangweidong (Hardware)" On 07/16/13 10:45, Gonglei (Arei) wrote: > Hi, Gerd > My Qemu version is 1.5.1, and use libusb for usb pass through. > I pass through a host usb device to the guest by bus number and physical port, when I unplug the usb device from > the host, and plug in on the same physical port immediately, but the usb device don't show up in the guest. > The qemu log show: > libusb_release_interface: -4 [NO_DEVICE] > libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/002/004: No such file or directory > libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/002/004: No such file or directory > libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/002/004: No such file or directory > > I find the reason is that the global libusb_context has recorded the usb devices' devnum, but when the host device was unplugged and plugged > from the host, the devnum will change, finally cause the problem. > Any ideas ? Thanks! Sounds like libusbx doesn't flush the cache on unplug even though it should. Hans? [ qemu uses one global libusb_context. libusb_device and libusb_device_handle are allocated and released on open/close ] cheers, Gerd