dr a sahu dept of comp sc & engg. iit guwahati. usb drivers overview urb (usb request block)...

43
USB Driver and Linux Device Model Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati

Upload: julie-holland

Post on 21-Dec-2015

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB Driver and Linux Device Model

Dr A SahuDept of Comp Sc & Engg.

IIT Guwahati

Page 2: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Outline• USB Drivers Overview• URB (USB request Block)• Writing a USB Driver• Linux Device Model– Kobjects, Ksets and Subsystem–Hot plug event generation – Bus, Device, Driver and Class– Dealing with Firmwire

• Last/Next Class Agenda– Summery after mid semester, Question pattern,

Assignments

Page 3: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB driver over view

• USB drivers lives between different kernel subsystem (blk,net,char..) and USB HW controller

• USB core provide an interface to access for USB drivers to use to access and control USB hw

• Connect without worrying the different types of USB hardware controller that are present in the system

VFS layer

Blok layer

NetLayer

CharLayer

TTYLayer ….

USB device driver

USB Core

USB host controller

USER

Hardware

kernel

Page 4: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Config

Interface

USB Device Basic

• USB device is complex thing• Linux kernel provides a

subsystem USB Core to handle most of the complexity

• USB device consist of configuration, interface, endpoints

• USB device bind to USB interfaces not to entire USB devices

EndpointEndpointEndpoint

Interface

EndpointEndpointEndpoint

USB Drivers

USB Drivers

Device

Page 5: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB: Endpoints• USB endpoint can carry data in only one direction either

host to dev (OUT endpoint) or host to dev (IN endpoint)• Endpoints are 4 types: that describe how data is

transmitted– Control: allow access to diff parts of USB dev. Used for conf

dev, retrieve info, send cmd, retrieve status. This is small size end points call endpoint 0

– Interrupt:small amount of data at fixed rate: keyborad/mice– BULK:Large data with no loss : printer, storage, network– ISOCHRONOUS: large data, not guaranteed, stream

audio/video• Struct usb_host_endpoint: address, bitmask attaributes,

Maxpacket size that point can handle , Intr Interval

Page 6: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB Interfaces• USB end points are bundled up with interfaces• One interface handle one type of logical

connection (a kbd,mice or a audio) • Some USB can handle multiple interfaces USB

speaker with kbd for buttons and USB audio stream

• USB interfaces may have alternate setting which are diff choices for param of the interface

• Struct usb_interface: array of altsetting, num_altsetting, cur_altsetting, minor

Page 7: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB Configuration• USB interface are themselves bundle up with

configurations• A USB device can have multiple conf and might switch

between them inorder to change the state of device• A single conf is activated at a time• Summery:– Device: one or more Conf– Conf : one or more Interface– Interface: one or more setting– Interface: one or more end points

Page 8: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB & Sysfs

• /sys/dev/pci0000:00/000:9:0/usb2/2-1• Long device path• First USB device is a root hub: USB controller

usually connected in a PCI device• Whole USB bus connect to root hub• Every USB device take number of root hub as first

number in its name, followed by character and then the number of port that device connected.

• Root_hub-hub_port:config.interface

Page 9: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB urb (USB Request Block)

• Linux kernel communicated with all USB device with URBS• Urb is used to send/receive data from a specific USB

endpoints on a specific usb device in async manner• Every end point can handle queue of urbs• Lifecycle of urb

– Created by USB dev driver– Assigned to specific endpoints of a USB dev– Submitted to a USB core by USB driver– Submitted to USB host Controller by USB core– Processed by the USB Host Controller that makes a USB transfer

to the device– When urbb is completed, USB host controller notify the dev

driver

Page 10: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

10 of 24

Enumeration steps

• The user plugs a device into USB port.

• Hub detects the device •• Host learns of new device

• Hub resets the device.

• Hub establishes a single path between device and a bus.

Page 11: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

11 of 24

Device Driver Framework

• USB device drivers are registered and deregistered at the subsystem.

• A driver must register 2 entry points and its name.

• For certain USB devices, a driver registers file operation and minor number.

Page 12: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

12 of 24

struct usb_driver {const char *name;void * (*probe)(struct usb_device *, unsigned int,const struct usb_device_id *id_table);void (*disconnect)(struct usb_device *, void *);struct list_head driver_list;struct file_operations *fops;int minor;struct semaphore serialize;int (*ioctl) (struct usb_device *dev, unsigned int code,void *buf);const struct usb_device_id *id_table;

};

Page 13: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

13 of 24

Entry Points FrameworkUSB driver has two entry points to normal drivers :-

• void *probe ( struct usb device *dev, unsigned int interface, const struct usb_device_id *id table) – -This entry point is called whenever a new device is attached to the

bus.

void disconnect ( struct usb device *dev, void *drv context)

- This function is called whenever a device is disconnected.

Page 14: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

14 of 24

Registering a USB Driver

• We register our USB driver with USB

subsystem using

usb_register (struct usb_driver *u_drv) :- This is usually invoked in our init_module().

• Un-registering of the USB driver is usually

performed using :-

usb_deregister (struct usb_driver *drv)

:-This is usually invoked in our cleanup_module().

Page 15: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Hot plug static struct usb_device_id skel_table [ ] = { { USB_DEVICE(USB_SKEL_VENDOR_ID,

USB_SKEL_PRODUCT_ID) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, skel_table);

Page 16: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Descriptor Explained

• A USB device when attached will be

enumerated.• Enumeration means assigning the device a

unique number.• The unique number must range from 1-127.• A descriptor is basically a structure containing

information about the device and its properties.

Page 17: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

USB Request Block

• A driver passes messages to the USB subsystem using URB

• A URB consists of relevant information for executing a USB transaction.

• It delivers the data and status back.• Execution of an URB is an asynchronous

operation. Ongoing transfer for a particular URB can be cancelled at any time.

• Each URB has a completion handler.

• URB’s can be linked.

Page 18: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Linux device model

• The model provides abstraction, which supports:– Power management and system shutdown

• Understanding of the system’s structure• Right order to shutdown

– Communication with user space• Sysfs• Knobs for changing operating parameters

– Hot-pluggable devices– Device classes

• Describe devices at a functional level

– Object lifecycles• Reference count

Page 19: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Device model tree• Sysfs : /proc, /dev, /sysfs

• Authors can ignore the model, and trust it• Understanding device model is good, if struct leaks– Ex. the generic DMA code works with struct device

• Advanced material that need not be read

bus

usb

drivers device

devices class

Inp dev

mice

pci0

Dev0:10

usb2

port1

Dev1-10

Usb-hid

Page 20: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Object oriented programming

• Abstract Data typing– Information hiding– Encapsulation

• Inheritance– Derive more specialized classes from a common class

• Polymorphism– Refers to the object's ability to respond in an individual

manner to the same message• Dynamic binding

– Refers to the mechanism that resolves a virtual function call at runtime

– You can derive modified action that override the old one even after the code is compiled .

Kobject, Kset

Bus, driver, device, partition…

hotplug(), match(), probe(), kobj_type

Page 21: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject, Ksets, and Subsystems

• struct kobject supports– Reference counting of objects

• Tracking the lifecycle

– Sysfs representation• A visible representation

– Data structure glue• Made up of multiple hierarchies with numerous links

– Hotplug event handling• Notify user space about the comings and goings of hardware

• $(KERNELDIR)/lib/kobject*.c

Page 22: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject basics1. struct kobject {2. const char * k_name;3. char name[KOBJ_NAME_LEN];4. struct kref kref;5. struct list_head entry;6. struct kobject * parent;7. struct kset * kset;8. struct kobj_type * ktype;9. struct dentry * dentry;10. };

11. struct kset {12. struct subsystem * subsys;13. struct kobj_type * ktype;14. struct list_head list;15. spinlock_t list_lock;16. struct kobject kobj;17. struct kset_hotplug_ops * hotplug_ops;18. };

Directory entry, maybe for sysfs

Page 23: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject basics Contd..

• Embedded kobjects– A common type embedded in other structures– A top-level, abstract class from which other classes are derived– Ex. in ch3,

struct cdev { struct kobject kobj; struct module *owner; struct file_operations *ops; dev_t dev; };– struct kobject *kp = …;– struct cdev *device = container_of(kp, struct cdev, kobj);

Page 24: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject basics Contd..• Release functions

– Even predictable object life cycles become more complicated when sysfs is brought in; user-space programs can keep a reference for an arbitrary period of time.

– Every kobject must have a release method.– The release method is not stored in the kobject itself

• kobject types – kobj_typestruct kobj_type { void (*release)(struct kobject *); struct sysfs_ops * sysfs_ops; struct attribute ** default_attrs;};– The kobject contains a field, pointer ktype– If kobject is a member of kset, the pointer provided by

kset– struct kobj_type *get_ktype(struct kobject*kobj);

Page 25: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject basics Contd..

• Initialization– Set the entire kobject to 0, memset()– Set up some of fields with kobject_init(), ex. reference count to 1– Set the name by kobject_set_name(kobj, char *format, …)– Set up the other field, such as ktype, kset and parent

• Reference count– struct kobject *kobject_get(struct kobject *kobj); //++– void kobject_put(struct kobject *kobj); //--, 0 to

cleanup– “struct module *owner” in struct cdev?

• The existence of a kobject require the existence of module that created that kobject. ex. cdev_get()

Page 26: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Kobject hierarchies, kset

• The parent pointer and ksets– “parent” points to another kobject, representing

the next level up– “kset” is a collection of kobjects– kset are always represented in sysfs– Every kobject that is a member of a kset is

represented in sysfs

Page 27: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

ksets• Adding a kobject to a kset

– kobject’s kset must be pointed at the kset of interest– Call kobject_add(struct kobject *kobj); // reference count ++– kobject_init( ) + kobject_add( ) kobject_register( )

• Removing from the kset– kobject_del( )– kobject_del( ) + kobject_put( ) kobject_unregister( )

• Operation on ksets– void kset_init(struct kset *kset);– int kset_add(struct kset *kset);– int kset_register(struct kset *kset);– void kset_unregister(struct kset *kset);– struct kset *kset_get(struct kset *kset);– void kset_put(struct kset *kset);– ktype, is used in preference to the ktype in a kobject

Page 28: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Subsystems

• Representation for a high-level portion of the kernel• Usually show up at the top of the sysfs

– Block devices, block_subsys, /sys/block– Core device hierarchy, devices_subsys, /sys/devices– Every bus type known to the kernel…

• Driver authors almost never needs to create one– Probably want is to add a new “class”

• Subsystem is really just a wrapper around a ksetstruct subsystem { struct kset kset; struct rw_semaphore rwsem; // used to serialize access};

Page 29: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Low-level sysfs operations

• Every kobject exports attributes, in that its sysfs dir• #include <linux/sysfs.h>• Call kobject_add( ) to show up in sysfs

• Default attributesstruct attribute { char *name; struct module *owner; mode_t mode;};

struct sysfs_ops { ssize_t (*show)(*kobj, struct attribute *attr, char *buffer); ssize_t (*store)(*kobj, struct attribute *attr, const char *buffer, size_t size);};

(*release)( )

*sysfs_ops

**default_attrs

kfree();

kobj_type

*(show)*(store)

sysfs_ops

snprintf();

attribute“version”

*S_IRUGO

Page 30: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Low-level sysfs operations• Non default attributes

– Attributes can be added and removed at will• int sysfs_create_file(struct kobject *kobj, struct attribute *attr);• int sysfs_remove_file(struct kobject *kobj, struct attribute *attr);

– The same show() and store() are called• Binary attributes

– e.g., when a device is hot-plugged, a user-space program can be started via hot-plug mechanism and then passes the firmware code

struct bin_attribute { struct attribute attr; size_t size; ssize_t (*read)(struct kobject *kobj, char *buffer, loff_t pos, size_t size); ssize_t (*write)(struct kobject *kobj, char *buffer, loff_t pos, size_t size);};

– int sysfs_create_bin_file(*kobj, struct bin_attribute *attr);– int sysfs_remove_bin_file(*kobj, struct bin_attribute *attr);

• Symbolic links– int sysfs_create_link(*kobj, struct kobject *target, char *name);– void sysfs_remove_link(*kobj, char *name);

Page 31: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Hotplug event generation• Hotplug event

– a notification to user space from the kernel that something has changed in the system’s configuration

– is generated whenever a kobject is created (kobject_add) or destroyed (kobject_del)

– e.g., a camera is plugged in USB cable, disk is repartitioned…

• To invoke /sbin/hotplug– /proc/sys/kernel/hotplug specifies hotplug program path

• Operations in “hotplug_ops” of kset– Search up via parent until finding a kset– (*filter): to suppress hotplug event generation – (*name): to pass the name of relevant subsystem for a

parameter– (*hotplug): to add useful environment variables for hotplug

script

Page 32: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Buses, devices, and drivers• Buses– Channel between the processor and one or more devices

• Devices and device drivers• Once again, much of the material covered here will

never be needed by many driver authors.

kobjectcore

Drivercorebus

driver

device

Functional view inside kernel

structdevice

structdevicedriver

structkobject

structldd_device

structldd_driver

Page 33: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Hotplug operations’ sample code

• Filter example– User space may want to react to the addition of a disk or a

partition, but it does not normally care about request queues.

static int block_hotplug_filter(struct kset *kset, struct kobject *kobj){

struct kobj_type *ktype = get_ktype(kobj);return ((ktype = = &ktype_block) || (ktype = = &ktype_part));

}

– The generation of hotplug events is usually handled by logic at the bus driver level

Page 34: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Buses

struct bus_type {char *name;struct subsystem subsys;struct kset drivers;struct kset devices;int (*match)(struct device *dev, struct device_driver *drv);struct device *(*add)(struct device * parent, char * bus_id);int (*hotplug) (struct device *dev, char **envp,

int num_envp, char *buffer, int buffer_size);/* Some fields omitted */};

Page 35: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Buses Contd..• Bus registration

– struct bus_type ldd_bus_type = {.name = "ldd",.match = ldd_match, .hotplug = ldd_hotplug,

};– int __init ldd_bus_init(void) {

ret = bus_register(&ldd_bus_type); //ret value must be checked

… // bus subsystem, /sys/bus/lddret = device_register(&ldd_bus);

• Deregistration– void ldd_bus_exit(void){

device_unregister(&ldd_bus);bus_unregister(&ldd_bus_type);

Page 36: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Buses Contd..• Bus methods

– int (*match)(struct device *device, struct device_driver *driver);• Called whenever a new device or driver is added for this bus• Return a nonzero value if the device can be handled by driverstatic int ldd_match(struct device *dev, struct device_driver *driver){

return !strncmp(dev->bus_id, driver->name, strlen(driver->name));}

– int (*hotplug) (struct device *device, char **envp, int num_envp, char *buffer, int buffer_size);• Allow the bus to add environment variables• LDDBUS_VERSION

• Iterating over devices and drivers– bus_for_each_dev( ), bus_for_each_drv( )

• Bus attributes– struct bus_attribute, (*show), (*store)– BUS_ATTR(name, mode, show, store); declare “struct bus_attr_name”– bus_create_file( ), bus_remove_file( ) lddbus BUS_ATTR(version)

Page 37: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Devices

struct device {struct device *parent;struct kobject kobj;char bus_id[BUS_ID_SIZE];struct bus_type *bus;struct device_driver *driver;void *driver_data;

void (*release)(struct device *dev);/* Several fields omitted */

};

Must be set before registering

device->kobj->parent == &device->parent->kobj

kobject_unregister( )

kobject_del()kobject_hotplug() kobject_put()

kobject_release( )

kset’s releaseevice_release( )

dev->release( )

Page 38: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Devices Contd..

• Device registration– int device_register(struct device *dev);– void device_unregister(struct device *dev);– An actual bus is a device and must be registered

static void ldd_bus_release(struct device *dev){ printk(KERN_DEBUG "lddbus release\n"); }struct device ldd_bus = {

.bus_id = "ldd0",

.release = ldd_bus_release};// device_register( ) & unregister( ) ldd_bus_init( ) & exit( )// evices subsystem, /sys/devices/ldd0/

• Device attributes– struct device_attribute, DEVICE_ATTR( ), device_create_file, …

Page 39: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Device structure embeddingfor a specific bus (e.g., pci_dev,

ldd_device)• “struct device” contains the device core’s information • Most subsystems track other about the devices they

host• As a result, “struct device” is usually embedded– lddbus creates its own device type for ldd devices

struct ldd_device {char *name;struct ldd_driver *driver;struct device dev;

};#define to_ldd_device(dev) container_of(dev, struct ldd_device,

dev);

Page 40: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Device drivers

struct device_driver {char *name;struct bus_type *bus;struct kobject kobj;struct list_head devices;int (*probe)(struct device *dev);int (*remove)(struct device *dev);void (*shutdown) (struct device *dev);

};

Page 41: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Classes• net/core/net-sysfs.c, line 460

class_register(&net_class);• net/bluetooth/hci_sysfs.c, line 147

class_register(&bt_class);• drivers/pcmcia/cs.c, line 1892

class_register(&pcmcia_socket_class);• drivers/usb/core/file.c: line 90

class_register(&usb_class);• drivers/usb/core/hcd.c, line 649

class_register(&usb_host_class);• drivers/pci/probe.c, line 110

class_register(&pcibus_class);

Page 42: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

Putting all Together

Page 43: Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. USB Drivers Overview URB (USB request Block) Writing a USB Driver Linux Device Model – Kobjects, Ksets

ThanksRef: Chap 13 & 14, LDD 3e Rubini- Corbet