32#include <aquila/errno.h>
36#define USE_DEFAULTS 0xF6
37#define ENABLE_MOUSE 0xF4
90 size_t size = io->
resid;
92 for (
size_t i = 0; i < size; ++i) {
176 .can_write = __vfs_can_always,
177 .eof = __vfs_eof_never,
void i8042_handler_register(int port, void(*fun)(int))
Registers the function that gets each byte a port receives.
int i8042_aux_write(uint8_t byte)
Sends a byte to the device on the second port (the mouse).
ssize_t iobuf_in(struct iobuf *io, void *dst, size_t n)
Copies bytes from the iobuf's buffer into the kernel, and moves past them.
void kdev_chrdev_register(devid_t major, struct dev *dev)
Registers a driver as the character device of a major number.
#define MODULE_INIT(name, i, f)
int posix_file_open(struct file *file)
Finishes opening a file: with O_TRUNC, a regular file is truncated to 0 bytes.
int posix_file_close(struct file *file)
Closes an open file by dropping its reference to its vnode.
ssize_t posix_file_read(struct file *file, struct iobuf *io)
Reads from an open file at its offset, and moves the offset past what was read.
ssize_t posix_file_write(struct file *file, struct iobuf *io)
Writes to an open file at its offset, and moves the offset past what was written.
static ssize_t ps2mouse_read(struct devid *dd, off_t offset, struct iobuf *io)
Reads the bytes received from the mouse.
static struct ringbuf * mouse_ring
static int ps2mouse_file_can_read(struct file *file, size_t size)
Returns whether there are bytes to read.
static int ps2mouse_file_close(struct file *file)
Closes /dev/mouse: another process may open it now.
int ps2mouse_probe()
Sets the mouse up at boot (its default settings, and reporting on) and registers /dev/mouse.
void ps2mouse_register(void)
Has the i8042 driver send the bytes of its second port, the mouse's, to this driver.
static struct waitq * mouse_read_queue
void ps2mouse_handler(int byte)
Takes a byte from the mouse, which the i8042 driver received: it goes to the readers,...
static int ps2mouse_file_open(struct file *file)
Opens /dev/mouse, which one process at a time may have open (EACCES otherwise), and resets the mouse.
static ssize_t ps2mouse_write(struct devid *dd, off_t offset, struct iobuf *io)
Sends what is written to the mouse, a byte at a time: commands, which it replies to (an ACK to each b...
A device driver: its operations, any of which may be NULL.
Which device: its kind (S_IFCHR or S_IFBLK) and numbers.
An open file (POSIX's "open file description", fs/file.c).
void waitq_wakeup(struct waitq *waitq)
Wakes up every thread sleeping on a wait queue, and every thread polling it.