最終更新:2014-05-12 (月) 12:37:21 (3637d)  

drivers/usb/usb-skeleton.c
Top / drivers / usb / usb-skeleton.c

USB Skeleton driver

include

参照

usb_skel

struct usb_skel {
         struct usb_device       *udev;                  /* the usb device for this device */
         struct usb_interface    *interface;             /* the interface for this device */
         struct semaphore        limit_sem;              /* limiting the number of writes in progress */
         struct usb_anchor       submitted;              /* in case we need to retract our submissions */
         struct urb              *bulk_in_urb;           /* the urb to read data with */
         unsigned char           *bulk_in_buffer;        /* the buffer to receive data */
         size_t                  bulk_in_size;           /* the size of the receive buffer */
         size_t                  bulk_in_filled;         /* number of bytes in the buffer */
         size_t                  bulk_in_copied;         /* already copied to user space */
         __u8                    bulk_in_endpointAddr;   /* the address of the bulk in endpoint */
         __u8                    bulk_out_endpointAddr;  /* the address of the bulk out endpoint */
         int                     errors;                 /* the last request tanked */
         bool                    ongoing_read;           /* a read is going on */
         spinlock_t              err_lock;               /* lock for errors */
         struct kref             kref;
         struct mutex            io_mutex;               /* synchronize I/O with disconnect */
         wait_queue_head_t       bulk_in_wait;           /* to wait for an ongoing read */
 };

usb_driver skel_driver

.name = "skeleton",

usb_driver.probe= skel_probe,

.disconnect = skel_disconnect,

.suspend = skel_suspend,

  • usb_wait_anchor_empty_timeout?
  • usb_kill_anchored_urbs?
  • usb_kill_urb?

.resume = skel_resume,

  • return 0;

.pre_reset = skel_pre_reset,

  • usb_wait_anchor_empty_timeout?
  • usb_kill_anchored_urbs?
  • usb_kill_urb?

.post_reset = skel_post_reset,

.id_table = skel_table,

.supports_autosuspend = 1,

file_operations skel_fops

.owner = THIS_MODULE,

.read = skel_read,

.write = skel_write,

.open = skel_open,

.release = skel_release,

  • usb_autopm_put_interface?
  • kref_put?

.flush = skel_flush,

.llseek = noop_llseek,

参考