On Mon, Jul 04, 2005 at 06:19:14PM +0530, Jayaprakash Shanmugam wrote:
> Hello All,
>
> I have a USB driver that talks to four devices differentiated by their
> minor numbers (fixed minor numbers for everyone of the devices)
>
> In 2.4 Kernel - Probe () function :
>
> I used devfs_register() for all the devices as follows:
>
> for (i =0; i <= 4;i++)
> {
> devfs_register(usb_devfs_handle, "MyDriver",DEVFS_FL_DEFAULT,USB_MAJOR,
> USBH_MINOR_BASE+i,S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, &Fops,
> NULL);
> }
>
> I have this code working and planning to migrate to 2.6 kernel.
>
> In 2.6 kernel :
>
> When I looked into the usb-skeleton.c, it is suggested to use the
> usb_register_dev() function. My problem here is this function
> allocates minor numbers automatically starting from the base and I
> dont have control over it ? For eg., If I plug in card 1 and then card
> 2, I will have minors as 64 for Card 1 and 65 for card 2. If I plug
> in card 2 and then card 1, I will have minors as 64 for card 2 and 65
> for card 1.
That is correct. If you are using the USB Major, there is no other way
(and if you are, you need to reserve your minor number range with the
usb kernel maintainer to make sure you don't conflict with anyone else.)
If you use your own major, you can do whatever you want to.
> Could you please help me to fix a minor number based on the vendor ID
> and product ID of a card ?
I would not recommend doing this. What happens if you plug in 2 devices
with the same vendor/product ids.
good luck,
greg k-h
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel