/** * struct gpio_mouse * @scan_ms: the scan interval in milliseconds. * @up: GPIO line for up value. * @down: GPIO line for down value. * @left: GPIO line for left value. * @right: GPIO line for right value. * @bleft: GPIO line for left button. * @bmiddle: GPIO line for middle button. * @bright: GPIO line for right button. * * This struct must be added to the platform_device in the board code. * It is used by the gpio_mouse driver to setup GPIO lines and to * calculate mouse movement.
*/ struct gpio_mouse {
u32 scan_ms; struct gpio_desc *up; struct gpio_desc *down; struct gpio_desc *left; struct gpio_desc *right; struct gpio_desc *bleft; struct gpio_desc *bmiddle; struct gpio_desc *bright;
};
/* * Timer function which is run every scan_ms ms when the device is opened. * The dev input variable is set to the input_dev pointer.
*/ staticvoid gpio_mouse_scan(struct input_dev *input)
{ struct gpio_mouse *gpio = input_get_drvdata(input); int x, y;
if (gpio->bleft)
input_report_key(input, BTN_LEFT,
gpiod_get_value(gpio->bleft)); if (gpio->bmiddle)
input_report_key(input, BTN_MIDDLE,
gpiod_get_value(gpio->bmiddle)); if (gpio->bright)
input_report_key(input, BTN_RIGHT,
gpiod_get_value(gpio->bright));
x = gpiod_get_value(gpio->right) - gpiod_get_value(gpio->left);
y = gpiod_get_value(gpio->down) - gpiod_get_value(gpio->up);
MODULE_AUTHOR("Hans-Christian Egtvedt ");
MODULE_DESCRIPTION("GPIO mouse driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:gpio_mouse"); /* work with hotplug and coldplug */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.