#define pr_fmt(fmt) …
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/joystick.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/cdev.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define JOYDEV_MINOR_BASE …
#define JOYDEV_MINORS …
#define JOYDEV_BUFFER_SIZE …
struct joydev { … };
struct joydev_client { … };
static int joydev_correct(int value, struct js_corr *corr)
{ … }
static void joydev_pass_event(struct joydev_client *client,
struct js_event *event)
{ … }
static void joydev_event(struct input_handle *handle,
unsigned int type, unsigned int code, int value)
{ … }
static int joydev_fasync(int fd, struct file *file, int on)
{ … }
static void joydev_free(struct device *dev)
{ … }
static void joydev_attach_client(struct joydev *joydev,
struct joydev_client *client)
{ … }
static void joydev_detach_client(struct joydev *joydev,
struct joydev_client *client)
{ … }
static void joydev_refresh_state(struct joydev *joydev)
{ … }
static int joydev_open_device(struct joydev *joydev)
{ … }
static void joydev_close_device(struct joydev *joydev)
{ … }
static void joydev_hangup(struct joydev *joydev)
{ … }
static int joydev_release(struct inode *inode, struct file *file)
{ … }
static int joydev_open(struct inode *inode, struct file *file)
{ … }
static int joydev_generate_startup_event(struct joydev_client *client,
struct input_dev *input,
struct js_event *event)
{ … }
static int joydev_fetch_next_event(struct joydev_client *client,
struct js_event *event)
{ … }
static ssize_t joydev_0x_read(struct joydev_client *client,
struct input_dev *input,
char __user *buf)
{ … }
static inline int joydev_data_pending(struct joydev_client *client)
{ … }
static ssize_t joydev_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static __poll_t joydev_poll(struct file *file, poll_table *wait)
{ … }
static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev,
void __user *argp, size_t len)
{ … }
static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev,
void __user *argp, size_t len)
{ … }
static int joydev_ioctl_common(struct joydev *joydev,
unsigned int cmd, void __user *argp)
{ … }
#ifdef CONFIG_COMPAT
static long joydev_compat_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
#endif
static long joydev_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
static const struct file_operations joydev_fops = …;
static void joydev_mark_dead(struct joydev *joydev)
{ … }
static void joydev_cleanup(struct joydev *joydev)
{ … }
#define USB_VENDOR_ID_SONY …
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER …
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER …
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER_2 …
#define USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE …
#define USB_VENDOR_ID_THQ …
#define USB_DEVICE_ID_THQ_PS3_UDRAW …
#define USB_VENDOR_ID_NINTENDO …
#define USB_DEVICE_ID_NINTENDO_JOYCONL …
#define USB_DEVICE_ID_NINTENDO_JOYCONR …
#define USB_DEVICE_ID_NINTENDO_PROCON …
#define USB_DEVICE_ID_NINTENDO_CHRGGRIP …
#define ACCEL_DEV(vnd, prd) …
static const struct input_device_id joydev_blacklist[] = …;
static bool joydev_dev_is_blacklisted(struct input_dev *dev)
{ … }
static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
{ … }
static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
{ … }
static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
const struct input_device_id *id)
{ … }
static void joydev_disconnect(struct input_handle *handle)
{ … }
static const struct input_device_id joydev_ids[] = …;
MODULE_DEVICE_TABLE(input, joydev_ids);
static struct input_handler joydev_handler = …;
static int __init joydev_init(void)
{ … }
static void __exit joydev_exit(void)
{ … }
module_init(…) …;
module_exit(joydev_exit);