how to assign a name to a PCI device, that user space ioctl() can use
I am writing a driver for a "generic" PCI device, that is, not a
network card, or serial card, or anything with a special interface. I
just need to be able to open it and ioctl().
I want to know, once I initialize a PCI device that the driver
supports, how to assign the name to that device, that will then be
accessible to open() and ioctl() from user space.
To paraphrase justice Clarence Thomas, "I racked my brains on this" for
2 hours - I went over Rubini's latest edition chapter on PCI drivers
and searched the web everywhere I could think of, and nowhere, could I
find any information on this.
Please tell me. Mark Galeck
Re: how to assign a name to a PCI device, that user space ioctl()can use
> I want to know, once I initialize a PCI device that the driver[color=blue]
> supports, how to assign the name to that device, that will then be
> accessible to open() and ioctl() from user space.[/color]
The kernel knows a device by its major and minor device numbers.
The filesystem establishes a connection between device numbers
and user-visbile names using block-special or character-special
device files; see the documentation for 'mknod'.
For kernels >=2.6.15 or so, the udev subsystem dynamically creates
most of these associations. If your driver has a statement such as
where NN and MMM are decimal numbers, and an initialized
struct miscdevice with .minor = MMM and .name = "my_device"
that you specify to misc_register(), and there is a line
in a file such as /etc/udev/permissions.d/50-udev.permissions ,
then at boot, udev will perform an appropriate mknod. The result
will be /dev/my_device as a character special file owned
by root with (major, minor) of (NN, MMM) and permissions 0644
(-rw-r--r--). Search for information on 'udev'.
Re: how to assign a name to a PCI device, that user space ioctl() can use
Thank you very much this is what I needed.