gvalkov / python-evdev

Python bindings for the Linux input subsystem
https://python-evdev.rtfd.org/
BSD 3-Clause "New" or "Revised" License
336 stars 112 forks source link

Add #ifdef guards around UI_GET_SYSNAME #218

Closed KarsMulder closed 7 months ago

KarsMulder commented 7 months ago

The Python code is already ready to deal with uinput_get_sysname() throwing OSError in case the ioctl UI_GET_SYSNAME is not available, but it turns out that the C object code refuses to link if the macro UI_GET_SYSNAME was not defined at build time, because the compiler assumes that UI_GET_SYSNAME is a symbol that will be defined later at link time. (Issue #178)

Add an #ifdef guard around the code that relies on UI_GET_SYSNAME so that no reference to any hypothetical symbol UI_GET_SYSNAME remains in the object code if the UI_GET_SYSNAME macro was undefined at build time. This will cause uinput_get_sysname() to raise OSError if the UI_GET_SYSNAME was not defined at build time.