@@ -765,6 +765,44 @@ static void atkbd_deactivate(struct atkbd *atkbd)
765
765
ps2dev -> serio -> phys );
766
766
}
767
767
768
+ #ifdef CONFIG_X86
769
+ static bool atkbd_is_portable_device (void )
770
+ {
771
+ static const char * const chassis_types [] = {
772
+ "8" , /* Portable */
773
+ "9" , /* Laptop */
774
+ "10" , /* Notebook */
775
+ "14" , /* Sub-Notebook */
776
+ "31" , /* Convertible */
777
+ "32" , /* Detachable */
778
+ };
779
+ int i ;
780
+
781
+ for (i = 0 ; i < ARRAY_SIZE (chassis_types ); i ++ )
782
+ if (dmi_match (DMI_CHASSIS_TYPE , chassis_types [i ]))
783
+ return true;
784
+
785
+ return false;
786
+ }
787
+
788
+ /*
789
+ * On many modern laptops ATKBD_CMD_GETID may cause problems, on these laptops
790
+ * the controller is always in translated mode. In this mode mice/touchpads will
791
+ * not work. So in this case simply assume a keyboard is connected to avoid
792
+ * confusing some laptop keyboards.
793
+ *
794
+ * Skipping ATKBD_CMD_GETID ends up using a fake keyboard id. Using a fake id is
795
+ * ok in translated mode, only atkbd_select_set() checks atkbd->id and in
796
+ * translated mode that is a no-op.
797
+ */
798
+ static bool atkbd_skip_getid (struct atkbd * atkbd )
799
+ {
800
+ return atkbd -> translated && atkbd_is_portable_device ();
801
+ }
802
+ #else
803
+ static inline bool atkbd_skip_getid (struct atkbd * atkbd ) { return false; }
804
+ #endif
805
+
768
806
/*
769
807
* atkbd_probe() probes for an AT keyboard on a serio port.
770
808
*/
@@ -794,12 +832,12 @@ static int atkbd_probe(struct atkbd *atkbd)
794
832
*/
795
833
796
834
param [0 ] = param [1 ] = 0xa5 ; /* initialize with invalid values */
797
- if (ps2_command (ps2dev , param , ATKBD_CMD_GETID )) {
835
+ if (atkbd_skip_getid ( atkbd ) || ps2_command (ps2dev , param , ATKBD_CMD_GETID )) {
798
836
799
837
/*
800
- * If the get ID command failed, we check if we can at least set the LEDs on
801
- * the keyboard. This should work on every keyboard out there. It also turns
802
- * the LEDs off, which we want anyway.
838
+ * If the get ID command was skipped or failed, we check if we can at least set
839
+ * the LEDs on the keyboard. This should work on every keyboard out there.
840
+ * It also turns the LEDs off, which we want anyway.
803
841
*/
804
842
param [0 ] = 0 ;
805
843
if (ps2_command (ps2dev , param , ATKBD_CMD_SETLEDS ))
0 commit comments