From: Ben Greear <greearb@candelatech.com>
To: Belinda <belinda_ye@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: inb() and outb()
Date: Sun, 30 Sep 2001 12:29:17 -0700 [thread overview]
Message-ID: <3BB7728D.A691A9FB@candelatech.com> (raw)
In-Reply-To: <20010930190954.18227.qmail@web13904.mail.yahoo.com>
Belinda wrote:
>
> Hi, all
>
> I wrote a simple program with inb() and outb().
> However, it reports the segmentation error when
> running it.
>
> The code follows as:
> ---------------------------------
> #include <asm/io.h>
>
> #define LPT 0x378
>
You need to add something like this in your main method before
calling write_LPT.
See 'man ioperm' for more info..
if (ioperm(LPT, 3, 1)) {
printf("Sorry, you were not able to gain access to the ports\n");
printf("You must be root to run this program\n");
exit(1);
}
> void write_LPT(unsigned char byte)
> {
> outb(byte, LPT);
> }
>
> int main()
> {
> write_LPT(LPT);
> printf("Value:%c", inb(LPT));
>
> }
> ------------------------------------------------------
>
> Thanks,
>
> Belinda
>
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Ben Greear <greearb@candelatech.com> <Ben_Greear@excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear
prev parent reply other threads:[~2001-09-30 19:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-30 19:09 inb() and outb() Belinda
2001-09-30 19:29 ` Ben Greear [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BB7728D.A691A9FB@candelatech.com \
--to=greearb@candelatech.com \
--cc=belinda_ye@yahoo.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.