How to write drivers?
Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? I could probably just read the source code of OpenBSD and learn from there, but I'm a beginner programmer, so this probably will take much more time and there are no guarantees that I won't miss anything...
Re: How to write drivers?
Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? You don't even need a driver in the kernel for that, you can just access the lpt device in /dev. -- Jonathan [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]
Re: How to write drivers?
On Thu, 2008-05-01 at 20:15 +0300, Sviatoslav Chagaev wrote: Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? I could probably just read the source code of OpenBSD and learn from there, but I'm a beginner programmer, so this probably will take much more time and there are no guarantees that I won't miss anything... http://www.openbsd.org/papers/opencon06-drivers/index.html is a pretty thorough runthrough
Re: How to write drivers?
Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) On Thu, 1 May 2008 19:22:10 +0200 Jonathan Schleifer [EMAIL PROTECTED] wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? You don't even need a driver in the kernel for that, you can just access the lpt device in /dev. -- Jonathan
Re: How to write drivers?
Thanks! On Thu, 01 May 2008 13:33:18 -0400 Bret Lambert [EMAIL PROTECTED] wrote: On Thu, 2008-05-01 at 20:15 +0300, Sviatoslav Chagaev wrote: Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? I could probably just read the source code of OpenBSD and learn from there, but I'm a beginner programmer, so this probably will take much more time and there are no guarantees that I won't miss anything... http://www.openbsd.org/papers/opencon06-drivers/index.html is a pretty thorough runthrough
Re: How to write drivers?
Sviatoslav Chagaev [EMAIL PROTECTED] wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). I doubt you could use inb/outb in OpenBSD. The kernel will prevent that. Just talk with the device in /dev directly - there is really no need to write a driver. OpenBSD already has an LPT driver that gives access to it to the userland, so why reinvent the wheel here? -- Jonathan [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]
Re: How to write drivers?
Yes, by default these are blocked. But there are two ways in which you can gain access to I/O ports: 1) Enable access to all I/O ports for all processes with i386_iopl(2) 2) Enable access to individual I/O ports for the current process with i386_set_ioperm(2) Both calls must be called with superuser privileges (and i386_iopl has even more restrictions). I'm a CS student, I really like all this low-level stuff, and I want to learn how OS'es work. On Thu, 1 May 2008 20:00:38 +0200 Jonathan Schleifer [EMAIL PROTECTED] wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). I doubt you could use inb/outb in OpenBSD. The kernel will prevent that. Just talk with the device in /dev directly - there is really no need to write a driver. OpenBSD already has an LPT driver that gives access to it to the userland, so why reinvent the wheel here? -- Jonathan
Re: How to write drivers?
Sviatoslav Chagaev wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) http://www.netbsd.org/docs/kernel/ddwg.html On Thu, 1 May 2008 19:22:10 +0200 Jonathan Schleifer [EMAIL PROTECTED] wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? You don't even need a driver in the kernel for that, you can just access the lpt device in /dev. -- Jonathan
Re: How to write drivers?
Thanks! On Thu, 01 May 2008 11:57:02 -0700 Predrag Punosevac [EMAIL PROTECTED] wrote: Sviatoslav Chagaev wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) http://www.netbsd.org/docs/kernel/ddwg.html On Thu, 1 May 2008 19:22:10 +0200 Jonathan Schleifer [EMAIL PROTECTED] wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? You don't even need a driver in the kernel for that, you can just access the lpt device in /dev. -- Jonathan
Re: How to write drivers?
On Thu, May 01, 2008 at 08:00:38PM +0200, Jonathan Schleifer wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). I doubt you could use inb/outb in OpenBSD. The kernel will prevent that. Just talk with the device in /dev directly - there is really no need to write a driver. OpenBSD already has an LPT driver that gives access to it to the userland, so why reinvent the wheel here? Because he can? Because it is fun? Because he wants to learn? I can come up with another few of those. Writing drivers is a ton of fun.