bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: device_read example


From: Shakthi Kannan
Subject: Re: device_read example
Date: Mon, 19 Sep 2005 08:53:52 -0700 (PDT)

Hi Neal,

--- "Neal H. Walfield" <address@hidden> wrote:
> My impression is that the fourth argument to
> device_open is a send
> right to the device...

... of type device_t.

> ... which is supplied as the first argument to
> device_read et al.

of type device_t. I checked include/device/device.defs
and it mentions device_t.
 
> Also, make sure that you add your lprread function
> to the lpr device
> structure (i.e. along side lpropen).

This I did. :) 

So, this is what I have now in test.c on hurd:

  static device_t lpr_dev;
  device_t device_master;
  error_t err;
  unsigned long result;

  err = get_privileged_ports (0, &device_master);
  err = device_open (device_master, D_READ | D_WRITE,
"lpr", &lpr_dev);

  mach_msg_type_number_t data_cnt = sizeof (result);
  err = device_read (lpr_dev, 0, -1, sizeof (result),
(void *) &result, &data_cnt);

On i386/i386at/lpr.c in gnumach-1-branch, I have

lprread(dev, ior)
int     dev;
io_req_t ior;
{
  register int err;
  unsigned long data = 0x5a5a;
  printf("lpr.c: lprread()...\n");

  /*
  err = device_read_alloc (ior, (vm_size_t)
ior->io_count);
  if (err != KERN_SUCCESS)
    return (err);
  */

  ior->io_data = data;
  ior->io_residual = ior->io_count - sizeof (data);

  return (D_SUCCESS);
}

On executing test with re-compiled driver, the "lpr.c:
lprread()" gets printed, and then I get:

  panic: pmap_remove: null pv_list!

and then it reboots. Even if I tried to uncomment the
lines in lprread for device_read_alloc, the same panic
occurs. 

Any suggestions on what is wrong?

OR

Is it possible for you to give me a simple example
wherein you send an unsigned long variable's address
through device_read on hurd, and its value gets
assigned in lprread in gnumach-1-branch and returned?

Thanks for your help,

SK

------------------------------------------------------------
Shakthi Kannan, MS
Software Engineer, Specsoft (Hexaware Technologies)
[E]: address@hidden           [M]: (91) 98407-87007
[W]: http://www.shakthimaan.com      [L]: Chennai, India
------------------------------------------------------------


        
                
______________________________________________________ 
Yahoo! for Good 
Donate to the Hurricane Katrina relief effort. 
http://store.yahoo.com/redcross-donate3/ 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]