lkmpg/examples/vinput.h
linD026 636c1e702d Introduce Virtual Input Device Driver
Add the new section of input device driver, vinput[1].

Also, update the Acknowledgements.

[1] https://github.com/sysprog21/vinput
2022-04-06 17:13:29 +08:00

46 lines
880 B
C

#ifndef VINPUT_H
#define VINPUT_H
#include <linux/input.h>
#include <linux/spinlock.h>
#define VINPUT_MAX_LEN 128
#define MAX_VINPUT 32
#define VINPUT_MINORS MAX_VINPUT
#define dev_to_vinput(dev) container_of(dev, struct vinput, dev)
struct vinput_device;
struct vinput {
long id;
long devno;
long last_entry;
spinlock_t lock;
void *priv_data;
struct device dev;
struct list_head list;
struct input_dev *input;
struct vinput_device *type;
};
struct vinput_ops {
int (*init)(struct vinput *);
int (*kill)(struct vinput *);
int (*send)(struct vinput *, char *, int);
int (*read)(struct vinput *, char *, int);
};
struct vinput_device {
char name[16];
struct list_head list;
struct vinput_ops *ops;
};
int vinput_register(struct vinput_device *dev);
void vinput_unregister(struct vinput_device *dev);
#endif