![]() |
![]()
| ![]() |
![]()
NAME
SYNOPSIS
DESCRIPTIONThe The The virtual AT keyboards are named vkbd0, vkbd1, etc., one for each control device that has been opened. The Each virtual AT keyboard supports the usual keyboard interface ioctl(2)s, and thus can be used with kbdcontrol(1) like any other keyboard. The control device supports exactly the same ioctl(2)s as the virtual AT keyboard device. Writing AT scan codes to the control device generates an input on the virtual AT keyboard, as if the (non-existent) hardware had just received it. The virtual AT keyboard control device, normally
/dev/vkbdctl⟨N⟩,
is exclusive-open (it cannot be opened if it is already open) and is
restricted to the super-user. A
read(2)
call will return the virtual AT keyboard status structure (defined in
A write(2) call passes AT scan codes to be “received” from the virtual AT keyboard. Each AT scan code must be passed as unsigned int. Although AT scan codes must be passes as unsigned ints, the size of the buffer passed to write(2) still should be in bytes, i.e., static unsigned int codes[] = { /* Make Break */ 0x1e, 0x9e }; int main(void) { int fd, len; fd = open("/dev/vkbdctl0", O_RDWR); if (fd < 0) err(1, "open"); /* Note sizeof(codes) - not 2! */ len = write(fd, codes, sizeof(codes)); if (len < 0) err(1, "write"); close(fd); return (0); } Write will block if there is not enough space in the input queue. The control device also supports select(2) for read and write. On the last close of the control device, the virtual AT keyboard is removed. All queued scan codes are thrown away. SEE ALSOHISTORYThe AUTHORSMaksim Yevmenkin <m_evmenkin@yahoo.com> CAVEATSThe
|