Subject: Re: Keyboard support for DEC3000
To: Takuya Koumoto <takuya-k@is.aist-nara.ac.jp>
From: Chris G. Demetriou <cgd@netbsd1.cygnus.com>
List: port-alpha
Date: 07/24/1998 18:04:45
Takuya Koumoto <takuya-k@is.aist-nara.ac.jp> writes:

> I am trying to write ioctl functions for keyboard for TC
> Alphas. I think that the definitions of WSKBDIO_SETLEDS
> and WSKBDIO_GETLEDS are wrong. In sys/dev/wscons/wsconsio.h, 
> they are defined as follows:
> 
> #define WSKBDIO_SETLEDS         _IOR('W', 11, int)
> #define WSKBDIO_GETLEDS         _IOW('W', 12, int)
> 
> I think they should be follows:
> 
> #define WSKBDIO_SETLEDS         _IOW('W', 11, int)
> #define WSKBDIO_GETLEDS         _IOR('W', 12, int)
> 
> Right? 

"R vs. W don't do what you think they do."

In particular, they have _nothing_ to do with checking permissions
(you have to do that yourself with the ioctl flags arg, if you think
it's appropriate -- in this case, given the way keyboards are used,
i'm not sure that it is), but rather with whether data is to be copied
into or out of the kernel on ioctl() entry and exit.

_IO == no data
_IOR == kernel reads the data on entry
_IOW == kernel writes the data on exit
_IOWR == kernel reads on entry then writes on exit.



cgd