how to assign a name to a PCI device, that user space ioctl() can use - Linux

This is a discussion on how to assign a name to a PCI device, that user space ioctl() can use - Linux ; Hello, 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how to assign a name to a PCI device, that user space ioctl() can use

  1. how to assign a name to a PCI device, that user space ioctl() can use

    Hello,

    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


  2. 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
    > supports, how to assign the name to that device, that will then be
    > accessible to open() and ioctl() from user space.


    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
    MODULE_ALIAS("char-major-NN-MMM");
    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
    my_device:root:root:0644
    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'.

    --

  3. 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.


+ Reply to Thread