Thanks for your reply. I just wanted to give some more information on
my requirement.
1) In my driver (working in 2.4), I have fixed minor numbers for the
USB cards (custom devices). While reading or writing, I simply do the
following:
MyCard = MINOR (pstFilp->f_dentry->d_inode->i_rdev);
if (MyCard == 64)
{
MyDevice = usb_find_device(MyCardVID, MyCardPID);
usb_control_msg();
}
else if ()
......
But if I use usb_register_dev(), it assigns the minors dynamically and
no way ( as far as I know ) I can get which device ( I have four
devices and I am sure that they will not have PIDs in common ) the
read / write is operating on.
2) For your reply:
It is our own control system - both the host and devices. These are
the only devices that can go and plug into the host's USB port.
There cannot be two boards with same VID / PID pair.
3) Can I use devfs_register in 2.6 kernel ? The /proc/kallsyms doesnt
display this symbol. I tried using devfs_mk_cdev() in probe. But I
got "No Such Device" while opening.
On 7/5/05, Greg KH <[EMAIL PROTECTED]> wrote:
> 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_idt77&alloc_id492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel