mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-21 17:50:07 +01:00
doc: remove initial * from example code lines
doxygen actually copies that over into the resulting output. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
5c2605c039
commit
7da329b4d4
2 changed files with 108 additions and 108 deletions
|
|
@ -38,66 +38,66 @@ struct libevdev_uinput;
|
||||||
* help to create uinput devices that emulate libevdev devices. In the simplest
|
* help to create uinput devices that emulate libevdev devices. In the simplest
|
||||||
* form it serves to duplicate an existing device:
|
* form it serves to duplicate an existing device:
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* int err;
|
int err;
|
||||||
* int new_fd;
|
int new_fd;
|
||||||
* struct libevdev *dev;
|
struct libevdev *dev;
|
||||||
* struct libevdev_uinput *uidev;
|
struct libevdev_uinput *uidev;
|
||||||
* struct input_event ev[2];
|
struct input_event ev[2];
|
||||||
*
|
|
||||||
* err = libevdev_new_from_fd(&dev, fd);
|
err = libevdev_new_from_fd(&dev, fd);
|
||||||
* if (err != 0)
|
if (err != 0)
|
||||||
* return err;
|
return err;
|
||||||
*
|
|
||||||
* uifd = open("/dev/uinput", O_RDWR);
|
uifd = open("/dev/uinput", O_RDWR);
|
||||||
* if (uidev < 0)
|
if (uidev < 0)
|
||||||
* return -errno;
|
return -errno;
|
||||||
*
|
|
||||||
* err = libevdev_uinput_create_from_device(dev, uifd, &uidev);
|
err = libevdev_uinput_create_from_device(dev, uifd, &uidev);
|
||||||
* if (err != 0)
|
if (err != 0)
|
||||||
* return err;
|
return err;
|
||||||
*
|
|
||||||
* // post a REL_X event
|
// post a REL_X event
|
||||||
* err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1);
|
err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1);
|
||||||
* if (err != 0)
|
if (err != 0)
|
||||||
* return err;
|
return err;
|
||||||
* libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
|
libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
|
||||||
* if (err != 0)
|
if (err != 0)
|
||||||
* return err;
|
return err;
|
||||||
*
|
|
||||||
* libevdev_uinput_destroy(uidev);
|
libevdev_uinput_destroy(uidev);
|
||||||
* close(uifd);
|
close(uifd);
|
||||||
*
|
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* Alternatively, a device can be constructed from scratch:
|
* Alternatively, a device can be constructed from scratch:
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* int err;
|
int err;
|
||||||
* struct libevdev *dev;
|
struct libevdev *dev;
|
||||||
* struct libevdev_uinput *uidev;
|
struct libevdev_uinput *uidev;
|
||||||
*
|
|
||||||
* dev = libevdev_new();
|
dev = libevdev_new();
|
||||||
* libevdev_set_name(dev, "test device");
|
libevdev_set_name(dev, "test device");
|
||||||
* libevdev_enable_event_type(dev, EV_REL);
|
libevdev_enable_event_type(dev, EV_REL);
|
||||||
* libevdev_enable_event_code(dev, EV_REL, REL_X);
|
libevdev_enable_event_code(dev, EV_REL, REL_X);
|
||||||
* libevdev_enable_event_code(dev, EV_REL, REL_Y);
|
libevdev_enable_event_code(dev, EV_REL, REL_Y);
|
||||||
* libevdev_enable_event_type(dev, EV_KEY);
|
libevdev_enable_event_type(dev, EV_KEY);
|
||||||
* libevdev_enable_event_code(dev, EV_KEY, BTN_LEFT);
|
libevdev_enable_event_code(dev, EV_KEY, BTN_LEFT);
|
||||||
* libevdev_enable_event_code(dev, EV_KEY, BTN_MIDDLE);
|
libevdev_enable_event_code(dev, EV_KEY, BTN_MIDDLE);
|
||||||
* libevdev_enable_event_code(dev, EV_KEY, BTN_RIGHT);
|
libevdev_enable_event_code(dev, EV_KEY, BTN_RIGHT);
|
||||||
*
|
|
||||||
* err = libevdev_uinput_create_from_device(dev,
|
err = libevdev_uinput_create_from_device(dev,
|
||||||
* LIBEVDEV_UINPUT_OPEN_MANAGED,
|
LIBEVDEV_UINPUT_OPEN_MANAGED,
|
||||||
* &uidev);
|
&uidev);
|
||||||
* if (err != 0)
|
if (err != 0)
|
||||||
* return err;
|
return err;
|
||||||
*
|
|
||||||
* // ... do something ...
|
// ... do something ...
|
||||||
*
|
|
||||||
* libevdev_uinput_destroy(uidev);
|
libevdev_uinput_destroy(uidev);
|
||||||
*
|
|
||||||
* @endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum libevdev_uinput_open_mode {
|
enum libevdev_uinput_open_mode {
|
||||||
|
|
|
||||||
|
|
@ -100,37 +100,37 @@ extern "C" {
|
||||||
* finds them monitors the device to print the event.
|
* finds them monitors the device to print the event.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* struct libevdev *dev = NULL;
|
struct libevdev *dev = NULL;
|
||||||
* int fd;
|
int fd;
|
||||||
* int rc = 1;
|
int rc = 1;
|
||||||
*
|
|
||||||
* fd = open("/dev/input/event0", O_RDONLY|O_NONBLOCK);
|
fd = open("/dev/input/event0", O_RDONLY|O_NONBLOCK);
|
||||||
* rc = libevdev_new_from_fd(fd, &dev);
|
rc = libevdev_new_from_fd(fd, &dev);
|
||||||
* if (rc < 0) {
|
if (rc < 0) {
|
||||||
* fprintf(stderr, "Failed to init libevdev (%s)\n", strerror(-rc));
|
fprintf(stderr, "Failed to init libevdev (%s)\n", strerror(-rc));
|
||||||
* exit(1);
|
exit(1);
|
||||||
* }
|
}
|
||||||
* printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
|
printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
|
||||||
* printf("Input device ID: bus %#x vendor %#x product %#x\n",
|
printf("Input device ID: bus %#x vendor %#x product %#x\n",
|
||||||
* libevdev_get_id_bustype(dev),
|
libevdev_get_id_bustype(dev),
|
||||||
* libevdev_get_id_vendor(dev),
|
libevdev_get_id_vendor(dev),
|
||||||
* libevdev_get_id_product(dev));
|
libevdev_get_id_product(dev));
|
||||||
* if (!libevdev_has_event_type(dev, EV_REL) ||
|
if (!libevdev_has_event_type(dev, EV_REL) ||
|
||||||
* !libevdev_has_event_code(dev, EV_KEY, BTN_LEFT)) {
|
!libevdev_has_event_code(dev, EV_KEY, BTN_LEFT)) {
|
||||||
* printf("This device does not look like a mouse\n");
|
printf("This device does not look like a mouse\n");
|
||||||
* exit(1);
|
exit(1);
|
||||||
* }
|
}
|
||||||
*
|
|
||||||
* do {
|
do {
|
||||||
* struct input_event ev;
|
struct input_event ev;
|
||||||
* rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
|
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
|
||||||
* if (rc == 0)
|
if (rc == 0)
|
||||||
* printf("Event: %s %s %d\n",
|
printf("Event: %s %s %d\n",
|
||||||
* libevdev_get_event_type_name(ev.type),
|
libevdev_get_event_type_name(ev.type),
|
||||||
* libevdev_get_event_code_name(ev.type, ev.code),
|
libevdev_get_event_code_name(ev.type, ev.code),
|
||||||
* ev.value);
|
ev.value);
|
||||||
* } while (rc == 1 || rc == 0 || rc == -EAGAIN);
|
} while (rc == 1 || rc == 0 || rc == -EAGAIN);
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* A more complete example is available with the libevdev-events tool here:
|
* A more complete example is available with the libevdev-events tool here:
|
||||||
* http://cgit.freedesktop.org/libevdev/tree/tools/libevdev-events.c
|
* http://cgit.freedesktop.org/libevdev/tree/tools/libevdev-events.c
|
||||||
|
|
@ -451,11 +451,11 @@ struct libevdev* libevdev_new(void);
|
||||||
*
|
*
|
||||||
* This is a shortcut for
|
* This is a shortcut for
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* int err;
|
int err;
|
||||||
* struct libevdev *dev = libevdev_new();
|
struct libevdev *dev = libevdev_new();
|
||||||
* err = libevdev_set_fd(dev, fd);
|
err = libevdev_set_fd(dev, fd);
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* @param fd A file descriptor to the device in O_RDWR or O_RDONLY mode.
|
* @param fd A file descriptor to the device in O_RDWR or O_RDONLY mode.
|
||||||
* @param[out] dev The newly initialized evdev device.
|
* @param[out] dev The newly initialized evdev device.
|
||||||
|
|
@ -1061,10 +1061,10 @@ int libevdev_set_event_value(struct libevdev *dev, unsigned int type, unsigned i
|
||||||
*
|
*
|
||||||
* Fetch the current value of the event type. This is a shortcut for
|
* Fetch the current value of the event type. This is a shortcut for
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* if (libevdev_has_event_type(dev, t) && libevdev_has_event_code(dev, t, c))
|
if (libevdev_has_event_type(dev, t) && libevdev_has_event_code(dev, t, c))
|
||||||
* val = libevdev_get_event_value(dev, t, c);
|
val = libevdev_get_event_value(dev, t, c);
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
||||||
* @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
|
* @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
|
||||||
|
|
@ -1138,12 +1138,12 @@ int libevdev_set_slot_value(struct libevdev *dev, unsigned int slot, unsigned in
|
||||||
*
|
*
|
||||||
* Fetch the current value of the code for the given slot. This is a shortcut for
|
* Fetch the current value of the code for the given slot. This is a shortcut for
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* if (libevdev_has_event_type(dev, EV_ABS) &&
|
if (libevdev_has_event_type(dev, EV_ABS) &&
|
||||||
* libevdev_has_event_code(dev, EV_ABS, c) &&
|
libevdev_has_event_code(dev, EV_ABS, c) &&
|
||||||
* slot < device->number_of_slots)
|
slot < device->number_of_slots)
|
||||||
* val = libevdev_get_slot_value(dev, slot, c);
|
val = libevdev_get_slot_value(dev, slot, c);
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
||||||
* @param slot The numerical slot number, must be smaller than the total number
|
* @param slot The numerical slot number, must be smaller than the total number
|
||||||
|
|
@ -1396,11 +1396,11 @@ int libevdev_kernel_set_led_value(struct libevdev *dev, unsigned int code, enum
|
||||||
* of LED codes and values to set them to, terminated by a -1. For example, to
|
* of LED codes and values to set them to, terminated by a -1. For example, to
|
||||||
* switch the NumLock LED on but the CapsLock LED off, use:
|
* switch the NumLock LED on but the CapsLock LED off, use:
|
||||||
*
|
*
|
||||||
* @code
|
@code
|
||||||
* libevdev_kernel_set_led_values(dev, LED_NUML, LIBEVDEV_LED_ON,
|
libevdev_kernel_set_led_values(dev, LED_NUML, LIBEVDEV_LED_ON,
|
||||||
* LED_CAPSL, LIBEVDEV_LED_OFF,
|
LED_CAPSL, LIBEVDEV_LED_OFF,
|
||||||
* -1);
|
-1);
|
||||||
* @endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* If any LED code or value is invalid, this function returns -EINVAL and no
|
* If any LED code or value is invalid, this function returns -EINVAL and no
|
||||||
* LEDs are modified.
|
* LEDs are modified.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue