User mode USB isochronous transfer from device-to-host

后端 未结 3 1771
故里飘歌
故里飘歌 2020-12-28 09:15

I am currently trying to interface with a USB audio device from user land. I currently have the device fully enumerated and I\'ve set the interface and set the alternative

相关标签:
3条回答
  • 2020-12-28 09:58

    Ok so it turns out that the problem is due to the fact that the android OS has placed an HID driver to handle the HID controls. This seems to block up the bandwidth. Detaching these drivers from the HID interfaces releases the bandwidth allowing the isochronous transfer to proceed.

    You detach the kernel driver by doing the following:

    usbdevfs_ioctl command;
    command.ifno        = mpInterface->GetInterfaceNumber();
    command.ioctl_code  = USBDEVFS_DISCONNECT;
    command.data        = NULL;
    
    int ret = ioctl( fd, USBDEVFS_IOCTL, &command );
    

    Otherwise what I have done is correct.

    0 讨论(0)
  • 2020-12-28 09:58

    I understand the only reason you're not using libusb is that you can't open the usb device by by yourself but you do have a file descriptor pointing to it.

    If this is all correct, why are you trying to re-implement everything there is in libusb instead of just re-implementing the usb_open() function which would take a file descriptor as argument and your struct usb_device*. You could take most of the code from the libusb usb_open() source code, and use libusb for the rest.

    0 讨论(0)
  • 2020-12-28 10:07

    I have written a Java class for user mode USB isochronous transfer: UsbIso

    It uses JNA to access the USBFS API via IOCTL calls.

    0 讨论(0)
提交回复
热议问题