kdrive: set "evdev" driver for input devices automatically, if available.
If kdrive input driver "evdev" is available, no other driver was explicitly set for a given input device, and its kernel device node is /dev/input/event*, this patch will make kdrive set "evdev" driver automatically for such device. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
This commit is contained in:
		
							parent
							
								
									6d6fd688ec
								
							
						
					
					
						commit
						0b80da0d18
					
				| 
						 | 
					@ -51,6 +51,11 @@
 | 
				
			||||||
#include "inpututils.h"
 | 
					#include "inpututils.h"
 | 
				
			||||||
#include "optionstr.h"
 | 
					#include "optionstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef KDRIVE_EVDEV
 | 
				
			||||||
 | 
					#define DEV_INPUT_EVENT_PREFIX "/dev/input/event"
 | 
				
			||||||
 | 
					#define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
 | 
					#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct KdConfigDevice {
 | 
					struct KdConfigDevice {
 | 
				
			||||||
| 
						 | 
					@ -1097,6 +1102,16 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 | 
				
			||||||
            ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
 | 
					            ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
 | 
				
			||||||
                   key, value);
 | 
					                   key, value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef KDRIVE_EVDEV
 | 
				
			||||||
 | 
					    if (!ki->driver && ki->path != NULL &&
 | 
				
			||||||
 | 
					        strncasecmp(ki->path,
 | 
				
			||||||
 | 
					                    DEV_INPUT_EVENT_PREFIX,
 | 
				
			||||||
 | 
					                    DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
 | 
				
			||||||
 | 
					            ki->driver = KdFindKeyboardDriver("evdev");
 | 
				
			||||||
 | 
					            ki->options = input_option_new(ki->options, "driver", "evdev");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KdKeyboardInfo *
 | 
					KdKeyboardInfo *
 | 
				
			||||||
| 
						 | 
					@ -1191,6 +1206,16 @@ KdParsePointerOptions(KdPointerInfo * pi)
 | 
				
			||||||
            ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
 | 
					            ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
 | 
				
			||||||
                   key, value);
 | 
					                   key, value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef KDRIVE_EVDEV
 | 
				
			||||||
 | 
					    if (!pi->driver && pi->path != NULL &&
 | 
				
			||||||
 | 
					        strncasecmp(pi->path,
 | 
				
			||||||
 | 
					                    DEV_INPUT_EVENT_PREFIX,
 | 
				
			||||||
 | 
					                    DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
 | 
				
			||||||
 | 
					            pi->driver = KdFindPointerDriver("evdev");
 | 
				
			||||||
 | 
					            pi->options = input_option_new(pi->options, "driver", "evdev");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KdPointerInfo *
 | 
					KdPointerInfo *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue