It's needed to alter GUI in order to help with input using touch screen.
Pretty sure it's possible because various high-level software suites or programming environment (java, javascripts, desktop applications) can detect it and can show screen keyboard if absent.
Using libudev isn't really helpful because on modern linux average keyboard appears as a baker's dozen of device with key layouts and no "keyboard" tag, related to LEDs, caps\scroll lock, power management and such. How X software picks up which device is a physical keyboard?
If you are really doing low-level X11, you should use XListInputDevices
.