1

As an experimental project to start working with Linux device drivers I was thinking about creating a device driver for a parallel port device for controlling LEDs connected to a parallel port. Will this be achievable if a USB to parallel port adapter will be used instead of a direct parallel port?

If no, how would you recommend to achieve this? Do you recommend other applications for learning device drivers other than controlling LEDs via parallel port? Thanks in advance.

Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
brandbir
  • 305
  • 3
  • 14
  • Don't let the fact that your parallel port is sitting on USB bus confuse you. You still have to use the same API for parallel port programming, as if it was your PC internal parallel port. As for kernel parallel port references: just google for "driver parport led", or something like this. See: [link 1](http://elinuxdd.com/~elinuxdd/elinuxdd.docs/listings/listing05.7.html), [link 2](https://github.com/maluta/linux-drivers/blob/master/parport/led.c), [link 3](http://stackoverflow.com/questions/22954268/insmod-error-unknown-symbol-in-module) for starters. – Sam Protsenko May 29 '16 at 15:04
  • First of all you need to decide which user interface you want to use. For example, you can expose user interface as a character device or just create some sysfs files for the same purpose. This will be first half of your driver. Second half of your driver code will be working with parallel port. You need to use [parport API](https://www.kernel.org/doc/Documentation/parport-lowlevel.txt) for this. If this doesn't ring a bell -- you may want to read something like [LDD3](http://free-electrons.com/doc/books/ldd3.pdf) first. Also check out the "Eudyptula challenge" (just google for it). – Sam Protsenko May 29 '16 at 15:12
  • @SamProtsenko: Thank you for your guidelines. – brandbir May 29 '16 at 19:23
  • USB parallel port adapters work differently, and cannot be programmed as GPIO pins. – CL. May 30 '16 at 12:05
  • @CL: so this is not possible? driver for a parallel port device will not work if the device is connected via a USB-to-parallel port adapter? – brandbir May 30 '16 at 16:19

0 Answers0