[coreboot] Dynamic detection of Parallel Port

Ward Vandewege ward at gnu.org
Sat Dec 6 17:45:33 CET 2008

On Sat, Dec 06, 2008 at 10:22:44AM -0500, 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:
> 1. 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???

Would an environment variable be ok? Sed/awk should be able to do that for

Ward Vandewege <ward at fsf.org>
Free Software Foundation - Senior Systems Administrator

More information about the coreboot mailing list