[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] libusb and qemu userspace emulation

From: Gábor, Wacha
Subject: [Qemu-discuss] libusb and qemu userspace emulation
Date: Tue, 23 Jul 2013 10:07:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

Dear community,

I am using qemu (git HEAD version) for an educational/research project.
In this project, the qemu Linux userspace emulation is used.

One of my simple test programs connects to an USB device with libusb, and does some control and interrupt transfers. Running this program on an x86_64 with qemu microblazeel Linux userspace emulation, the program makes the following log outputs:

Unsupported ioctl: cmd=0x41045508
Unsupported ioctl: cmd=0xffffffff8004550f
Unsupported ioctl: cmd=0xffffffff802c550a


That is because qemu does not yet support the USBDEVFS_GETDRIVER, USBDEVFS_SUBMITURB, etc. ioctls. So I've implemented them. With my implementation every needed ioctl works except the USBDEVFS_SUBMITURB ioctl.

The reason is: for the SUBMITURB ctl, the usbdevfs_urb struct is used, which has two void * members. On my 64 bit host these pointers are 8 bytes long, but on the 32 bit guest, the pointers are only 4 bytes long. That means that the size of this usbdevfs_urb struct differs on the host and the guest system.

Since in linux/usbdevice_fs.h the USBDEVFS_SUBMITURB ioctl is defined the following way:
#define USBDEVFS_SUBMITURB         _IOR('U', 10, struct usbdevfs_urb)

and the _IOR macro encodes the size of the struct usbdevfs_urb in the calculated value of USBDEVFS_SUBMITURB, the ioctl code differs on the 64 bit host and the 32 bit guest:
On the guest I have: 0x802c550a
On the host I have: 0x8038550a

Since there are two different codes to the same ioctl, the qemu linux userspace emulator does not recognize the io call.

Is there a way to solve this problem in qemu?


Gabor Wacha
PhD student at Department of Measurement and Information Systems,
Budapest University of Technology and Economics, Hungary

reply via email to

[Prev in Thread] Current Thread [Next in Thread]