Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

classmate-laptop: always call input_sync() after input_report_switch()

Due to commit cdda911c34006f1089f3c87b1a1f31ab3a4722f2 evdev only
becomes readable when the buffer contains an EV_SYN/SYN_REPORT event.

So in order to read the tablet sensor data as it happens we need to
ensure that we always call input_sync() after input_report_switch()

Signed-off-by: Carlos Alberto Lopez Perez <clopez@igalia.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

authored by

Carlos Alberto Lopez Perez and committed by
Matthew Garrett
ad20c73b a4f46bb9

+9 -3
+9 -3
drivers/platform/x86/classmate-laptop.c
··· 725 725 struct input_dev *inputdev = dev_get_drvdata(&dev->dev); 726 726 727 727 if (event == 0x81) { 728 - if (ACPI_SUCCESS(cmpc_get_tablet(dev->handle, &val))) 728 + if (ACPI_SUCCESS(cmpc_get_tablet(dev->handle, &val))) { 729 729 input_report_switch(inputdev, SW_TABLET_MODE, !val); 730 + input_sync(inputdev); 731 + } 730 732 } 731 733 } 732 734 ··· 741 739 set_bit(SW_TABLET_MODE, inputdev->swbit); 742 740 743 741 acpi = to_acpi_device(inputdev->dev.parent); 744 - if (ACPI_SUCCESS(cmpc_get_tablet(acpi->handle, &val))) 742 + if (ACPI_SUCCESS(cmpc_get_tablet(acpi->handle, &val))) { 745 743 input_report_switch(inputdev, SW_TABLET_MODE, !val); 744 + input_sync(inputdev); 745 + } 746 746 } 747 747 748 748 static int cmpc_tablet_add(struct acpi_device *acpi) ··· 764 760 struct input_dev *inputdev = dev_get_drvdata(dev); 765 761 766 762 unsigned long long val = 0; 767 - if (ACPI_SUCCESS(cmpc_get_tablet(to_acpi_device(dev)->handle, &val))) 763 + if (ACPI_SUCCESS(cmpc_get_tablet(to_acpi_device(dev)->handle, &val))) { 768 764 input_report_switch(inputdev, SW_TABLET_MODE, !val); 765 + input_sync(inputdev); 766 + } 769 767 return 0; 770 768 } 771 769 #endif