[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
device_read example
From: |
Shakthi Kannan |
Subject: |
device_read example |
Date: |
Sun, 18 Sep 2005 03:04:15 -0700 (PDT) |
Greetings!
I am trying a simple device_read operation from GNU
Hurd to gnumach-1-branch.
In gnumach-1-branch/i386/i386at/lpr.c, I have:
lpropen(dev, flag, ior)
int dev;
int flag;
#ifdef MACH_KERNEL
io_req_t ior;
#endif MACH_KERNEL
{
printf("lpr.c: lpropen()...\n");
return;
}
lprread(dev, ior)
int dev;
io_req_t ior;
{
register int err;
unsigned long data = 0x5a5a;
printf("lpr.c: lprread()...\n");
...
I have a simple test function on GNU Hurd that
1. gets_privileged_ports from device_t
error_t err;
device_t device_master;
err = get_privileged_ports (0, &device_master);
2. calls device_open
err = device_open (device_master, D_READ | D_WRITE,
"lpr", &lpr_dev);
But, when I try to do device_read, it doesn't print
message in the device_read function in
gnumach-1-branch/i386/i386at/lpr.c
3. calling device_read
unsigned long result;
mach_msg_type_number_t data_cnt = sizeof (result);
err = device_read (device_master, 0, -1, sizeof
(result), (void *) &result, &data_cnt);
if (err)
{
printf ("device_read_inband error\n");
return err;
}
When I run the above program, it does call the
device_open in gnumach driver, but, for device_read it
exits with the device_read_inband error message.
Am I missing something here? Any help is appreciated.
Thanks,
SK
------------------------------------------------------------
Shakthi Kannan, MS
Software Engineer, Specsoft (Hexaware Technologies)
[E]: shaks@shakthimaan.com [M]: (91) 98407-87007
[W]: http://www.shakthimaan.com [L]: Chennai, India
------------------------------------------------------------
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
- device_read example,
Shakthi Kannan <=