On Sat, Dec 6, 2008 at 10:22 AM, Joseph Smith joe@settoplinux.org wrote:
Hello, For the Paraflasher project I would like to setup a function to automatically detect the presence of the PC's parallel ports and their base addresses. This way it doesn't need to be hard-coded into the program. I was thinking of using /proc/ioports to do this but I am not really sure how to do this in C. Here is what I am thinking:
- First use grep -c paraport /proc/ioports to check if we have multiple
parallel ports and maybe setup loop for it. 2. Then grep paraport /proc/ioports again to get the base address of each parallel port detected. This is where I am stuck. I just need to turn the first 4 characters (base address) into a variable. Can anyone help???
There must be a way to do this in C. Maybe do some digging around in the kernel's include files?
-Corey