#define pr_fmt(fmt) …
#define MOUSEDEV_MINOR_BASE …
#define MOUSEDEV_MINORS …
#define MOUSEDEV_MIX …
#include <linux/bitops.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/random.h>
#include <linux/major.h>
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/kernel.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X
#define CONFIG_INPUT_MOUSEDEV_SCREEN_X …
#endif
#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_Y
#define CONFIG_INPUT_MOUSEDEV_SCREEN_Y …
#endif
static int xres = …;
module_param(xres, uint, 0644);
MODULE_PARM_DESC(…) …;
static int yres = …;
module_param(yres, uint, 0644);
MODULE_PARM_DESC(…) …;
static unsigned tap_time = …;
module_param(tap_time, uint, 0644);
MODULE_PARM_DESC(…) …;
struct mousedev_hw_data { … };
struct mousedev { … };
enum mousedev_emul { … };
struct mousedev_motion { … };
#define PACKET_QUEUE_LEN …
struct mousedev_client { … };
#define MOUSEDEV_SEQ_LEN …
static unsigned char mousedev_imps_seq[] = …;
static unsigned char mousedev_imex_seq[] = …;
static struct mousedev *mousedev_mix;
static LIST_HEAD(mousedev_mix_list);
#define fx(i) …
#define fy(i) …
static void mousedev_touchpad_event(struct input_dev *dev,
struct mousedev *mousedev,
unsigned int code, int value)
{ … }
static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev,
unsigned int code, int value)
{ … }
static void mousedev_rel_event(struct mousedev *mousedev,
unsigned int code, int value)
{ … }
static void mousedev_key_event(struct mousedev *mousedev,
unsigned int code, int value)
{ … }
static void mousedev_notify_readers(struct mousedev *mousedev,
struct mousedev_hw_data *packet)
{ … }
static void mousedev_touchpad_touch(struct mousedev *mousedev, int value)
{ … }
static void mousedev_event(struct input_handle *handle,
unsigned int type, unsigned int code, int value)
{ … }
static int mousedev_fasync(int fd, struct file *file, int on)
{ … }
static void mousedev_free(struct device *dev)
{ … }
static int mousedev_open_device(struct mousedev *mousedev)
{ … }
static void mousedev_close_device(struct mousedev *mousedev)
{ … }
static int mixdev_open_devices(struct mousedev *mixdev)
{ … }
static void mixdev_close_devices(struct mousedev *mixdev)
{ … }
static void mousedev_attach_client(struct mousedev *mousedev,
struct mousedev_client *client)
{ … }
static void mousedev_detach_client(struct mousedev *mousedev,
struct mousedev_client *client)
{ … }
static int mousedev_release(struct inode *inode, struct file *file)
{ … }
static int mousedev_open(struct inode *inode, struct file *file)
{ … }
static void mousedev_packet(struct mousedev_client *client, u8 *ps2_data)
{ … }
static void mousedev_generate_response(struct mousedev_client *client,
int command)
{ … }
static ssize_t mousedev_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{ … }
static ssize_t mousedev_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{ … }
static __poll_t mousedev_poll(struct file *file, poll_table *wait)
{ … }
static const struct file_operations mousedev_fops = …;
static void mousedev_mark_dead(struct mousedev *mousedev)
{ … }
static void mousedev_hangup(struct mousedev *mousedev)
{ … }
static void mousedev_cleanup(struct mousedev *mousedev)
{ … }
static int mousedev_reserve_minor(bool mixdev)
{ … }
static struct mousedev *mousedev_create(struct input_dev *dev,
struct input_handler *handler,
bool mixdev)
{ … }
static void mousedev_destroy(struct mousedev *mousedev)
{ … }
static int mixdev_add_device(struct mousedev *mousedev)
{ … }
static void mixdev_remove_device(struct mousedev *mousedev)
{ … }
static int mousedev_connect(struct input_handler *handler,
struct input_dev *dev,
const struct input_device_id *id)
{ … }
static void mousedev_disconnect(struct input_handle *handle)
{ … }
static const struct input_device_id mousedev_ids[] = …;
MODULE_DEVICE_TABLE(input, mousedev_ids);
static struct input_handler mousedev_handler = …;
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
#include <linux/miscdevice.h>
static struct miscdevice psaux_mouse = …;
static bool psaux_registered;
static void __init mousedev_psaux_register(void)
{ … }
static void __exit mousedev_psaux_unregister(void)
{ … }
#else
static inline void mousedev_psaux_register(void) { }
static inline void mousedev_psaux_unregister(void) { }
#endif
static int __init mousedev_init(void)
{ … }
static void __exit mousedev_exit(void)
{ … }
module_init(…) …;
module_exit(mousedev_exit);