LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-19-2006, 11:32 AM   #1
MarkGaleck
LQ Newbie
 
Registered: Oct 2006
Posts: 8

Rep: Reputation: 0
how to assign names to PCI devices, that ioctl() can use from user space?


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, and nowhere, could I find any information on this.

Please tell me. Mark Galeck
 
Old 10-22-2006, 02:36 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You'll need to assign your device a major and minor number and then create a corresponding device file for it. Use one of the major numbers reserved for development purposes (there's a list in Documentation/devices.txt in the kernel source. Also see ioctl-number.txt if you plan to define any new ioctls. As for the actual mechanics section 7.1 of the kernel module development guide has a pretty clear code sample for how to do it.
 
Old 10-23-2006, 03:55 PM   #3
MarkGaleck
LQ Newbie
 
Registered: Oct 2006
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by btmiller
Wow thanks, this is a pretty good guide. These guys, should publish this as a book to replace Rubini. Rubini is OK and there is no other book out there, but this looks better.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ioctl[SIOCGIFADDR]: Cannot assign requested address mmcgann Linux - Wireless Networking 1 06-20-2006 12:09 PM
ioctl as non-root user cristianbdg Programming 3 12-21-2005 03:02 AM
Assign IRQ to PCI video card. Borelian Linux - Hardware 1 04-08-2005 04:54 PM
Question about floppy devices names tongzhi Solaris / OpenSolaris 1 05-25-2004 10:21 AM
names of all block devices, web links if possible. oldstinkyfish Linux - Hardware 0 11-11-2003 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration