mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ohyama_sec@ariel-networks.com
To: linux-kernel@vger.kernel.org
Subject: [QUESTION] I have a question about making device driver
Date: Mon,  4 Feb 2008 18:54:30 +0900 (JST)	[thread overview]
Message-ID: <20080204095430.AFC6A978007@ns.ariel-networks.com> (raw)

I have a question about device driver.

I'm writing device driver for parallel port on Linux.

In initial function which is argument of module_init() in my device driver, I reserved I/O address region, 0x378-0x37a, with using request_region() and regist my charactor device driver calling register_chrdev().

After I compile and link it. I insert this module and I can confirm that I obtaind the range of I/O address at /proc/ioports.
But I cannot write data on I/O address line, It means that following check program shows "false".

--- check program ---
#include <linux/types.h>
#include <asm/io.h>
#include <stdio.h>

int main(void){
    int base = 0x378;
    char read, write;

    ioperm(base, 1, 1);

    write = 0xa;
    outb(write, base);
    read = inb(base);

    if((read & 0xf) == write){
        printf("true\n");
    }else{
        printf("false\n");    
    }
    return 0;
}
---

At this time, I unloaded kernel modules which are related to parallel port. they are 'ppdev', 'lp', 'parport_pc' and 'parport'.

What should I do at initial funtion in my module to do I/O.
(The version of kernel that I use is 2.6.19-7.)


===
by Hiroyasu Ohyama


             reply	other threads:[~2008-02-04 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-04  9:54 ohyama_sec [this message]
2008-02-04 10:29 ` Jan Engelhardt
2008-02-05  9:39 ohyama_sec
2008-02-05 10:58 ` Jiri Slaby

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=20080204095430.AFC6A978007@ns.ariel-networks.com \
    --to=ohyama_sec@ariel-networks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®