ps2.7 (2010 09)
p
ps2(7) ps2(7)
RES_1 1 count/mm 1 count/mm
RES_2 2 count/mm 3 count/mm
RES_3 4 count/mm 6 count/mm
RES_4 8 count/mm 12 count/mm
PS2_2TO1_SCALING
Set mouse scaling at 2 to 1. The X and Y coordinate values returned in
stream-mode reports are doubled, except for absolute values less than six,
which are converted to new values in a nonlinear fashion. The conversion is
detailed in this table:
Mouse Internal Value Converted Value
00
+|− 1+|− 1
+|− 2+|− 1
+|− 3+|− 3
+|− 4+|− 6
+|− 5+|− 9
All other n 2*n
This conversion does not apply to reports obtained via the
PS2_REPORT
ioctl() request.
The arg parameter is not used.
PS2_1TO1_SCALING Set mouse scaling at 1 to 1.
The X and Y values returned in mouse reports are not scaled. This request
does not use the arg parameter.
ERRORS
If a system call fails, as noted above in the DESCRIPTION section
errno is set to one of the following
values:
[EBUSY] The specified PS/2 device is already opened.
[EFAULT] A bad address was detected while attempting to use an argument to a system call.
[EINTR] A signal interrupted an
open(), read(),orioctl() system call.
[EINVAL] An invalid parameter was detected by
ioctl().
[EIO] A hardware or software error occurred while executing an
ioctl() system call.
[ENODEV]
write() is not implemented for PS/2 devices.
[ENXIO] No device is present at the specified address.
EXAMPLES
Assume that fildes is a valid file descriptor for a ps2 port connected to a keyboard. The first example
blinks the keyboard indicators, selects scancode set 3, and loops forever while printing keycodes.
#include <sys/ps2io.h>
unsigned char kbdbuf[4]; /* buffer for ioctl operations */
unsigned char inchar; /* keycode read */
/* flash the LED indicators */
kbdbuf[0] = CAPS_LED | SCROLL_LED | NUM_LED; /* all on */
if( ioctl( fildes, PS2_INDICATORS, &kbdbuf) < 0){
perror("ioctl PS2_INDICATORS failed");
exit(1);
}
printf("Indicators on\n");
sleep(1);
kbdbuf[0] = NONE_LED; /* all off */
if( ioctl( fildes, PS2_INDICATORS, &kbdbuf) < 0){
perror("ioctl PS2_INDICATORS failed");
exit(1);
}
6 Hewlett-Packard Company − 6 − HP-UX 11i Version 3: September 2010