Dynamic Minors
The USB device driver can make use of the USB's major number (usually 180 ).The minor number base is registered with the usb subsystem during the device registration .This is done with the usb_register_dev function that takes a pointer to a struct usb_class_driver as an argument.The minor_base field of the structure is the start of the assigned minor range for the driver.
The udev rules created the device node with the major number 180 and minor number (SKEL_MINOR_BASE) that i registered with the usb_class_driver function.A kernel with CONFIG_USB_DYNAMIC_MINORS configuration enabled,ignores this field and assigns minor number on the fly.The first usb device gets minor no 0 and the next 1 and so on.In that case udev is the best solution to handle the device nodes.The conventional static /dev management will not hold good in ths case.
The minor no assigned for the device can be obtained after a succesful call to usb_register_dev(interface,&skel_class_driver) from the minor member of the usb_interface structure(interface->minor).
For a working skeleton/example details refer the usb-skeleton.c file in the kernel source tree.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home