device emulator?

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

 



Hello list. I work for a company that makes some USB audio devices, and I've been tasked with developing a small driver-app that registers with the USBFS, and receives reads/writes/ioctls as though I was the hardware device which will be produced by Christmas.

I initially thought that this was just another character mode device, and I would register it under /proc like any other device. The I discovered that USBFS was it's own thing, and that that wouldn't work. So, I now have my device registering itself with USBFS, and it responds to reads and writes, but not ioctls. I'm trying to make this test pass:

static struct usb_device *device_init(void)
{
   struct usb_bus *usb_bus;
   struct usb_device *dev;
   usb_dev_handle *v3;

   usb_init();
   usb_find_busses();
   usb_find_devices();

   for (usb_bus = usb_busses; usb_bus; usb_bus = usb_bus->next)
   {
       for (dev = usb_bus->devices; dev; dev = dev->next)
       {
           if ( (dev->descriptor.idVendor  == DEV_VENDOR_ID) &&
                (dev->descriptor.idProduct == DEV_PRODUCT_ID) )
           {
               printf("Found it\n");
               v3 = usb_open(dev);
               usb_detach_kernel_driver_np(v3, 0);
               usb_claim_interface(v3, 0);
               usb_close(v3);
               return dev;
           }
       }
   }
   return NULL;
}

But it seems that the majority of these functions (if not ALL of them), use IOCTLs to do the actual work. My USBFS device registers like this:

const struct file_operations fops = {
	.read = device_read,
	.write = device_write,
	.open = device_open,
	.release = device_release,
	.ioctl = device_ioctl
};

I have the required printks in all functions to notify me if they get called, but during that whole function above, I don't catch any IOCTLs.

So, here's the question. What do I have to do to get the ioctls sent to my driver, instead of wherever they're going now?



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux