# lv_evdev.h (/api/drivers/evdev/lv_evdev_h)



<RelatedHeaders name="lv_evdev_private.h" isPrivate="false" />

<ApiSummary functions="7" enums="1" typedefs="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (2)&#x22;,&#x22;Other (5)&#x22;]">
  <ApiTab value="Setters (2)">
    <ApiMember kind="function" name="lv_evdev_set_swap_axes" file="drivers/evdev/lv_evdev.h" line="81" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L81">
      lv_evdev_set_swap_axes [#lv_evdev_set_swap_axes]

      Set whether coordinates of pointer device should be swapped. Defaults to false.

      ```c title=" " lineNumbers=1
      void lv_evdev_set_swap_axes(lv_indev_t *indev, bool swap_axes)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                                 | Description                  |
      | ----------- | ---------------------------------------------------- | ---------------------------- |
      | `indev`     | <ApiLink name="lv_indev_t" display="lv_indev_t *" /> | evdev input device           |
      | `swap_axes` | <ApiLink name="bool" />                              | whether to swap x and y axes |
    </ApiMember>

    <ApiMember kind="function" name="lv_evdev_set_calibration" file="drivers/evdev/lv_evdev.h" line="92" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L92">
      lv_evdev_set_calibration [#lv_evdev_set_calibration]

      Configure a coordinate transformation for pointer devices. Applied after axis swap, if any. Defaults to apply no transformation.

      ```c title=" " lineNumbers=1
      void lv_evdev_set_calibration(lv_indev_t *indev, int min_x, int min_y, int max_x, int max_y)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                 | Description                                   |
      | ------- | ---------------------------------------------------- | --------------------------------------------- |
      | `indev` | <ApiLink name="lv_indev_t" display="lv_indev_t *" /> | evdev input device                            |
      | `min_x` | `int`                                                | pointer coordinate mapped to min x of display |
      | `min_y` | `int`                                                | pointer coordinate mapped to min y of display |
      | `max_x` | `int`                                                | pointer coordinate mapped to max x of display |
      | `max_y` | `int`                                                | pointer coordinate mapped to max y of display |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (5)">
    <ApiMember kind="function" name="lv_evdev_create" file="drivers/evdev/lv_evdev.h" line="48" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L48">
      lv_evdev_create [#lv_evdev_create]

      Create evdev input device from a given path.

      ```c title=" " lineNumbers=1
      lv_indev_t * lv_evdev_create(lv_indev_type_t indev_type, const char *dev_path)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name         | Type                               | Description                          |
      | ------------ | ---------------------------------- | ------------------------------------ |
      | `indev_type` | <ApiLink name="lv_indev_type_t" /> |                                      |
      | `dev_path`   | `const char *`                     | device path, e.g., /dev/input/event0 |

      **Returns:** <ApiLink name="lv_indev_t" display="lv_indev_t *" /> — pointer to input device or NULL if opening failed
    </ApiMember>

    <ApiMember kind="function" name="lv_evdev_create_fd" file="drivers/evdev/lv_evdev.h" line="56" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L56">
      lv_evdev_create_fd [#lv_evdev_create_fd]

      Create evdev input device, taking ownership of the given file descriptor.

      ```c title=" " lineNumbers=1
      lv_indev_t * lv_evdev_create_fd(lv_indev_type_t indev_type, int fd)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name         | Type                               | Description                         |
      | ------------ | ---------------------------------- | ----------------------------------- |
      | `indev_type` | <ApiLink name="lv_indev_type_t" /> |                                     |
      | `fd`         | `int`                              | file descriptor of the evdev device |

      **Returns:** <ApiLink name="lv_indev_t" display="lv_indev_t *" /> — pointer to input device or NULL if opening failed
    </ApiMember>

    <ApiMember kind="function" name="lv_evdev_discovery_start" file="drivers/evdev/lv_evdev.h" line="66" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L66">
      lv_evdev_discovery_start [#lv_evdev_discovery_start]

      Begin automatically creating evdev indevs for all new and existing evdev devices found in /dev/input/

      ```c title=" " lineNumbers=1
      lv_result_t lv_evdev_discovery_start(lv_evdev_discovery_cb_t cb, void *user_data)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                       | Description                                                      |
      | ----------- | ------------------------------------------ | ---------------------------------------------------------------- |
      | `cb`        | <ApiLink name="lv_evdev_discovery_cb_t" /> | function to call when a new evdev indev is discovered, or `NULL` |
      | `user_data` | `void *`                                   | parameter to pass to the callback                                |

      **Returns:** <ApiLink name="lv_result_t" /> — the success or failure status. It will fail if it's already running or resources could not be initialized.
    </ApiMember>

    <ApiMember kind="function" name="lv_evdev_discovery_stop" file="drivers/evdev/lv_evdev.h" line="73" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L73">
      lv_evdev_discovery_stop [#lv_evdev_discovery_stop]

      Stop automatically creating evdev indevs. Safe to call from the discovery callback.

      ```c title=" " lineNumbers=1
      lv_result_t lv_evdev_discovery_stop(void)
      ```

      **Returns:** <ApiLink name="lv_result_t" /> — the success or failure status. It will fail if it's already running.
    </ApiMember>

    <ApiMember kind="function" name="lv_evdev_delete" file="drivers/evdev/lv_evdev.h" line="98" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L98">
      lv_evdev_delete [#lv_evdev_delete]

      Remove evdev input device.

      ```c title=" " lineNumbers=1
      void lv_evdev_delete(lv_indev_t *indev)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                 | Description                          |
      | ------- | ---------------------------------------------------- | ------------------------------------ |
      | `indev` | <ApiLink name="lv_indev_t" display="lv_indev_t *" /> | evdev input device to close and free |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_evdev_type_t" file="drivers/evdev/lv_evdev.h" line="25" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L25">
  lv_evdev_type_t [#lv_evdev_type_t]

  | Name                | Description                 |
  | ------------------- | --------------------------- |
  | `LV_EVDEV_TYPE_REL` | mice                        |
  | `LV_EVDEV_TYPE_ABS` | touch screens, mousepads    |
  | `LV_EVDEV_TYPE_KEY` | keyboards, keypads, buttons |
</ApiMember>

Typedefs [#typedefs]

<ApiMember kind="typedef" name="lv_evdev_discovery_cb_t" file="drivers/evdev/lv_evdev.h" line="36" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/drivers/evdev/lv_evdev.h#L36">
  lv_evdev_discovery_cb_t [#lv_evdev_discovery_cb_t]

  ```c title=" " lineNumbers=1
  typedef void(* lv_evdev_discovery_cb_t) (lv_indev_t *indev, lv_evdev_type_t type, void *user_data)
  ```
</ApiMember>

<TypeUsedBy name="lv_evdev_discovery_cb_t" count="1">
  * `lv_evdev_discovery_start` — param `cb`
</TypeUsedBy>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_indev.h&#x22;]" includedBy="[&#x22;lv_evdev_private.h&#x22;, &#x22;lv_drivers.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_group.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
