Joseph Smith 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???
Check out http://people.redhat.com/twaugh/parport/html/parportguide.html
It has some information on how to use /dev/partportX for your purposes.
Stefan