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:
Peter Hutterer 2013-12-24 08:07:00 +10:00
parent 5c2605c039
commit 7da329b4d4
2 changed files with 108 additions and 108 deletions

View file

@ -38,66 +38,66 @@ struct libevdev_uinput;
* help to create uinput devices that emulate libevdev devices. In the simplest
* form it serves to duplicate an existing device:
*
* @code
* int err;
* int new_fd;
* struct libevdev *dev;
* struct libevdev_uinput *uidev;
* struct input_event ev[2];
*
* err = libevdev_new_from_fd(&dev, fd);
* if (err != 0)
* return err;
*
* uifd = open("/dev/uinput", O_RDWR);
* if (uidev < 0)
* return -errno;
*
* err = libevdev_uinput_create_from_device(dev, uifd, &uidev);
* if (err != 0)
* return err;
*
* // post a REL_X event
* err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1);
* if (err != 0)
* return err;
* libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
* if (err != 0)
* return err;
*
* libevdev_uinput_destroy(uidev);
* close(uifd);
*
* @endcode
@code
int err;
int new_fd;
struct libevdev *dev;
struct libevdev_uinput *uidev;
struct input_event ev[2];
err = libevdev_new_from_fd(&dev, fd);
if (err != 0)
return err;
uifd = open("/dev/uinput", O_RDWR);
if (uidev < 0)
return -errno;
err = libevdev_uinput_create_from_device(dev, uifd, &uidev);
if (err != 0)
return err;
// post a REL_X event
err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1);
if (err != 0)
return err;
libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
if (err != 0)
return err;
libevdev_uinput_destroy(uidev);
close(uifd);
@endcode
*
* Alternatively, a device can be constructed from scratch:
*
* @code
* int err;
* struct libevdev *dev;
* struct libevdev_uinput *uidev;
*
* dev = libevdev_new();
* libevdev_set_name(dev, "test device");
* libevdev_enable_event_type(dev, EV_REL);
* libevdev_enable_event_code(dev, EV_REL, REL_X);
* libevdev_enable_event_code(dev, EV_REL, REL_Y);
* libevdev_enable_event_type(dev, EV_KEY);
* 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_RIGHT);
*
* err = libevdev_uinput_create_from_device(dev,
* LIBEVDEV_UINPUT_OPEN_MANAGED,
* &uidev);
* if (err != 0)
* return err;
*
* // ... do something ...
*
* libevdev_uinput_destroy(uidev);
*
* @endcode
@code
int err;
struct libevdev *dev;
struct libevdev_uinput *uidev;
dev = libevdev_new();
libevdev_set_name(dev, "test device");
libevdev_enable_event_type(dev, EV_REL);
libevdev_enable_event_code(dev, EV_REL, REL_X);
libevdev_enable_event_code(dev, EV_REL, REL_Y);
libevdev_enable_event_type(dev, EV_KEY);
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_RIGHT);
err = libevdev_uinput_create_from_device(dev,
LIBEVDEV_UINPUT_OPEN_MANAGED,
&uidev);
if (err != 0)
return err;
// ... do something ...
libevdev_uinput_destroy(uidev);
@endcode
*/
enum libevdev_uinput_open_mode {

View file

@ -100,37 +100,37 @@ extern "C" {
* finds them monitors the device to print the event.
*
* @code
* struct libevdev *dev = NULL;
* int fd;
* int rc = 1;
*
* fd = open("/dev/input/event0", O_RDONLY|O_NONBLOCK);
* rc = libevdev_new_from_fd(fd, &dev);
* if (rc < 0) {
* fprintf(stderr, "Failed to init libevdev (%s)\n", strerror(-rc));
* exit(1);
* }
* printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
* printf("Input device ID: bus %#x vendor %#x product %#x\n",
* libevdev_get_id_bustype(dev),
* libevdev_get_id_vendor(dev),
* libevdev_get_id_product(dev));
* if (!libevdev_has_event_type(dev, EV_REL) ||
* !libevdev_has_event_code(dev, EV_KEY, BTN_LEFT)) {
* printf("This device does not look like a mouse\n");
* exit(1);
* }
*
* do {
* struct input_event ev;
* rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
* if (rc == 0)
* printf("Event: %s %s %d\n",
* libevdev_get_event_type_name(ev.type),
* libevdev_get_event_code_name(ev.type, ev.code),
* ev.value);
* } while (rc == 1 || rc == 0 || rc == -EAGAIN);
* @endcode
struct libevdev *dev = NULL;
int fd;
int rc = 1;
fd = open("/dev/input/event0", O_RDONLY|O_NONBLOCK);
rc = libevdev_new_from_fd(fd, &dev);
if (rc < 0) {
fprintf(stderr, "Failed to init libevdev (%s)\n", strerror(-rc));
exit(1);
}
printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
printf("Input device ID: bus %#x vendor %#x product %#x\n",
libevdev_get_id_bustype(dev),
libevdev_get_id_vendor(dev),
libevdev_get_id_product(dev));
if (!libevdev_has_event_type(dev, EV_REL) ||
!libevdev_has_event_code(dev, EV_KEY, BTN_LEFT)) {
printf("This device does not look like a mouse\n");
exit(1);
}
do {
struct input_event ev;
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
if (rc == 0)
printf("Event: %s %s %d\n",
libevdev_get_event_type_name(ev.type),
libevdev_get_event_code_name(ev.type, ev.code),
ev.value);
} while (rc == 1 || rc == 0 || rc == -EAGAIN);
@endcode
*
* A more complete example is available with the libevdev-events tool here:
* http://cgit.freedesktop.org/libevdev/tree/tools/libevdev-events.c
@ -451,11 +451,11 @@ struct libevdev* libevdev_new(void);
*
* This is a shortcut for
*
* @code
* int err;
* struct libevdev *dev = libevdev_new();
* err = libevdev_set_fd(dev, fd);
* @endcode
@code
int err;
struct libevdev *dev = libevdev_new();
err = libevdev_set_fd(dev, fd);
@endcode
*
* @param fd A file descriptor to the device in O_RDWR or O_RDONLY mode.
* @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
*
* @code
* if (libevdev_has_event_type(dev, t) && libevdev_has_event_code(dev, t, c))
* val = libevdev_get_event_value(dev, t, c);
* @endcode
@code
if (libevdev_has_event_type(dev, t) && libevdev_has_event_code(dev, t, c))
val = libevdev_get_event_value(dev, t, c);
@endcode
*
* @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.)
@ -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
*
* @code
* if (libevdev_has_event_type(dev, EV_ABS) &&
* libevdev_has_event_code(dev, EV_ABS, c) &&
* slot < device->number_of_slots)
* val = libevdev_get_slot_value(dev, slot, c);
* @endcode
@code
if (libevdev_has_event_type(dev, EV_ABS) &&
libevdev_has_event_code(dev, EV_ABS, c) &&
slot < device->number_of_slots)
val = libevdev_get_slot_value(dev, slot, c);
@endcode
*
* @param dev The evdev device, already initialized with libevdev_set_fd()
* @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
* switch the NumLock LED on but the CapsLock LED off, use:
*
* @code
* libevdev_kernel_set_led_values(dev, LED_NUML, LIBEVDEV_LED_ON,
* LED_CAPSL, LIBEVDEV_LED_OFF,
* -1);
* @endcode
@code
libevdev_kernel_set_led_values(dev, LED_NUML, LIBEVDEV_LED_ON,
LED_CAPSL, LIBEVDEV_LED_OFF,
-1);
@endcode
*
* If any LED code or value is invalid, this function returns -EINVAL and no
* LEDs are modified.