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