Skip to contentSkip to conversation

USB support

Qemu-devel Marek Zelem 2 participants 2 messages Feb 9, 2008 – Feb 10, 2008

lore
Share & tools
lore
#0 lore raw

Hi

I want to inform you that I successfully attached my Canon MP830 (printer, scanner, fax) to Qemu via USB.
It was not easy, I had to pass though two stoppages.

1. There is no support for multi port/config (do not know proper term for that) USB devices in Qemu. Meaning that if single USB device provides multiple functionalities (like printer, scanner, fax) it will be rejected by Qemu.
Fortunately there is patch for that available on internet page
http://www.wina.at/uni/html/linux-qemu.html
(qemu-0.9.0-usb-multi-configs.patch).

2. When I applied the patch I hit another issue. When the USB device is not ready it is automatically switched to HALT state (if I understood it correctly) and additional ioctl USBDEVFS_CLEAR_HALT is required to give device another chance. Thus, I have written patch for that issue. The patch I am sending as attachment.

When I applied both patches, everything worked fine. I suggest to include those two patches in Qemu.

Best regards

Marek Zelem

--
e-mail: [email protected]
web: http://marek.terminus.sk/
pgp key: http://marek.terminus.sk/gpg.txt

usb-linux.c renamed from usb-linux.c.orig +2 -0
@@ -229,12 +229,14 @@
     if (ret < 0) {
         switch(errno) {
         case ETIMEDOUT:
+	    ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &(bt.ep));
             return USB_RET_NAK;
         case EPIPE:
         default:
 #ifdef DEBUG
             printf("handle_data: errno=%d\n", errno);
 #endif
+	    ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &(bt.ep));
             return USB_RET_STALL;
         }
     } else {
#1 lore raw

The multi-config patch is already merged in Qemu 9.1

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marek Zelem
Sent: Saturday, February 09, 2008 5:34 PM
To: [email protected]
Subject: [Qemu-devel] USB support

Hi

I want to inform you that I successfully attached my Canon MP830 (printer, scanner, fax) to Qemu via USB.
It was not easy, I had to pass though two stoppages.

1. There is no support for multi port/config (do not know proper term for that) USB devices in Qemu. Meaning that if single USB device provides multiple functionalities (like printer, scanner, fax) it will be rejected by Qemu.
Fortunately there is patch for that available on internet page
http://www.wina.at/uni/html/linux-qemu.html
(qemu-0.9.0-usb-multi-configs.patch).

2. When I applied the patch I hit another issue. When the USB device is not ready it is automatically switched to HALT state (if I understood it correctly) and additional ioctl USBDEVFS_CLEAR_HALT is required to give device another chance. Thus, I have written patch for that issue. The patch I am sending as attachment.

When I applied both patches, everything worked fine. I suggest to include those two patches in Qemu.

Best regards

Marek Zelem

--
e-mail: [email protected]
web: http://marek.terminus.sk/
pgp key: http://marek.terminus.sk/gpg.txt