[PATCH v3 04/11] HID: haptic: introduce hid_haptic_device

Jonathan Denose posted 11 patches 5 months, 3 weeks ago
[PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Jonathan Denose 5 months, 3 weeks ago
From: Angela Czubak <aczubak@google.com>

Define a new structure that contains simple haptic device configuration
as well as current state.
Add functions that recognize auto trigger and manual trigger reports
as well as save their addresses.
Verify that the pressure unit is either grams or newtons.
Mark the input device as a haptic touchpad if the unit is correct and
the reports are found.

Signed-off-by: Angela Czubak <aczubak@google.com>
Co-developed-by: Jonathan Denose <jdenose@google.com>
Signed-off-by: Jonathan Denose <jdenose@google.com>
---
 drivers/hid/Kconfig      |  11 ++++++
 drivers/hid/Makefile     |   1 +
 drivers/hid/hid-haptic.c |  72 +++++++++++++++++++++++++++++++++
 drivers/hid/hid-haptic.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 185 insertions(+)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 43859fc757470caf6ad43bd5f72f119e9c36aea7..fa0a53287c0ed6b5853d0e80641df341fb728332 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -92,6 +92,17 @@ config HID_GENERIC
 
 	If unsure, say Y.
 
+config HID_HAPTIC
+	tristate "Haptic touchpad support"
+	default n
+	help
+	Support for touchpads with force sensors and haptic actuators instead of a
+	traditional button.
+	Adds extra parsing and FF device for the hid multitouch driver.
+	It can be used for Elan 2703 haptic touchpad.
+
+	If unsure, say N.
+
 menu "Special HID drivers"
 
 config HID_A4TECH
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 10ae5dedbd84708d988ea1f594d409ccebd85ebb..361a7daedeb85454114def8afb5f58caeab58a00 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -4,6 +4,7 @@
 #
 hid-y			:= hid-core.o hid-input.o hid-quirks.o
 hid-$(CONFIG_DEBUG_FS)		+= hid-debug.o
+hid-$(CONFIG_HID_HAPTIC)	+= hid-haptic.o
 
 obj-$(CONFIG_HID_BPF)		+= bpf/
 
diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c
new file mode 100644
index 0000000000000000000000000000000000000000..d659a430c1a6b06ded31d49efe4bded909671cb6
--- /dev/null
+++ b/drivers/hid/hid-haptic.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *  HID Haptic support for Linux
+ *
+ *  Copyright (c) 2021 Angela Czubak <acz@semihalf.com>
+ */
+
+#include "hid-haptic.h"
+
+void hid_haptic_feature_mapping(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_field *field, struct hid_usage *usage)
+{
+	if (usage->hid == HID_HP_AUTOTRIGGER) {
+		if (usage->usage_index >= field->report_count) {
+			dev_err(&hdev->dev,
+				"HID_HP_AUTOTRIGGER out of range\n");
+			return;
+		}
+
+		hid_device_io_start(hdev);
+		hid_hw_request(hdev, field->report, HID_REQ_GET_REPORT);
+		hid_hw_wait(hdev);
+		hid_device_io_stop(hdev);
+		haptic->default_auto_trigger =
+			field->value[usage->usage_index];
+		haptic->auto_trigger_report = field->report;
+	}
+}
+EXPORT_SYMBOL_GPL(hid_haptic_feature_mapping);
+
+bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
+				    struct hid_input *hi, struct hid_field *field)
+{
+	if (field->unit == HID_UNIT_GRAM || field->unit == HID_UNIT_NEWTON)
+		return true;
+	return false;
+}
+EXPORT_SYMBOL_GPL(hid_haptic_check_pressure_unit);
+
+int hid_haptic_input_mapping(struct hid_device *hdev,
+			     struct hid_haptic_device *haptic,
+			     struct hid_input *hi,
+			     struct hid_field *field, struct hid_usage *usage,
+			     unsigned long **bit, int *max)
+{
+	if (usage->hid == HID_HP_MANUALTRIGGER) {
+		haptic->manual_trigger_report = field->report;
+		/* we don't really want to map these fields */
+		return -1;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(hid_haptic_input_mapping);
+
+int hid_haptic_input_configured(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_input *hi)
+{
+
+	if (hi->application == HID_DG_TOUCHPAD) {
+		if (haptic->auto_trigger_report &&
+		    haptic->manual_trigger_report) {
+			__set_bit(INPUT_PROP_HAPTIC_TOUCHPAD, hi->input->propbit);
+			return 1;
+		}
+		return 0;
+	}
+	return -1;
+}
+EXPORT_SYMBOL_GPL(hid_haptic_input_configured);
diff --git a/drivers/hid/hid-haptic.h b/drivers/hid/hid-haptic.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e89addf5ec280d5b9a59d06088cc08bd4f445c1
--- /dev/null
+++ b/drivers/hid/hid-haptic.h
@@ -0,0 +1,101 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *  HID Haptic support for Linux
+ *
+ *  Copyright (c) 2021 Angela Czubak <acz@semihalf.com>
+ */
+
+#include <linux/hid.h>
+
+#define HID_HAPTIC_ORDINAL_WAVEFORMNONE 1
+#define HID_HAPTIC_ORDINAL_WAVEFORMSTOP 2
+
+#define HID_HAPTIC_MODE_DEVICE 0
+#define HID_HAPTIC_MODE_HOST 1
+
+struct hid_haptic_effect {
+	u8 *report_buf;
+	struct input_dev *input_dev;
+	struct work_struct work;
+	struct list_head control;
+	struct mutex control_mutex;
+};
+
+struct hid_haptic_effect_node {
+	struct list_head node;
+	struct file *file;
+};
+
+struct hid_haptic_device {
+	struct input_dev *input_dev;
+	struct hid_device *hdev;
+	struct hid_report *auto_trigger_report;
+	struct mutex auto_trigger_mutex;
+	struct workqueue_struct *wq;
+	struct hid_report *manual_trigger_report;
+	struct mutex manual_trigger_mutex;
+	size_t manual_trigger_report_len;
+	int pressed_state;
+	s32 pressure_sum;
+	s32 force_logical_minimum;
+	s32 force_physical_minimum;
+	s32 force_resolution;
+	u32 mode;
+	u32 default_auto_trigger;
+	u32 vendor_page;
+	u32 vendor_id;
+	u32 max_waveform_id;
+	u32 max_duration_id;
+	u16 *hid_usage_map;
+	u32 *duration_map;
+	u16 press_ordinal;
+	u16 release_ordinal;
+	struct hid_haptic_effect *effect;
+	struct hid_haptic_effect stop_effect;
+};
+
+#if IS_ENABLED(CONFIG_HID_HAPTIC)
+void hid_haptic_feature_mapping(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_field *field, struct hid_usage
+				*usage);
+bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
+				    struct hid_input *hi, struct hid_field *field);
+int hid_haptic_input_mapping(struct hid_device *hdev,
+			     struct hid_haptic_device *haptic,
+			     struct hid_input *hi,
+			     struct hid_field *field, struct hid_usage *usage,
+			     unsigned long **bit, int *max);
+int hid_haptic_input_configured(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_input *hi);
+#else
+static inline
+void hid_haptic_feature_mapping(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_field *field, struct hid_usage
+				*usage)
+{}
+static inline
+bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
+				    struct hid_input *hi, struct hid_field *field)
+{
+	return false;
+}
+static inline
+int hid_haptic_input_mapping(struct hid_device *hdev,
+			     struct hid_haptic_device *haptic,
+			     struct hid_input *hi,
+			     struct hid_field *field, struct hid_usage *usage,
+			     unsigned long **bit, int *max)
+{
+	return 0;
+}
+static inline
+int hid_haptic_input_configured(struct hid_device *hdev,
+				struct hid_haptic_device *haptic,
+				struct hid_input *hi)
+{
+	return 0;
+}
+#endif

-- 
2.51.0.rc1.193.gad69d77794-goog
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Thorsten Leemhuis 4 months ago
On 8/19/25 01:08, Jonathan Denose wrote:
> From: Angela Czubak <aczubak@google.com>
> 
> Define a new structure that contains simple haptic device configuration
> as well as current state.
> Add functions that recognize auto trigger and manual trigger reports
> as well as save their addresses.
> Verify that the pressure unit is either grams or newtons.
> Mark the input device as a haptic touchpad if the unit is correct and
> the reports are found.
>  [...]
> +config HID_HAPTIC
> +	tristate "Haptic touchpad support"
> +	default n
> +	help
> +	Support for touchpads with force sensors and haptic actuators instead of a
> +	traditional button.
> +	Adds extra parsing and FF device for the hid multitouch driver.
> +	It can be used for Elan 2703 haptic touchpad.
> +
> +	If unsure, say N.
> +
>  menu "Special HID drivers"

I suspect this change is related to a build error I ran into today:

  MODPOST Module.symvers
ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1

The config where this occurred had this:

CONFIG_HID=y
CONFIG_HID_MULTITOUCH=m
CONFIG_HID_HAPTIC=m

Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.

Ciao, Thorsten  
>  config HID_A4TECH
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index 10ae5dedbd84708d988ea1f594d409ccebd85ebb..361a7daedeb85454114def8afb5f58caeab58a00 100644
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -4,6 +4,7 @@
>  #
>  hid-y			:= hid-core.o hid-input.o hid-quirks.o
>  hid-$(CONFIG_DEBUG_FS)		+= hid-debug.o
> +hid-$(CONFIG_HID_HAPTIC)	+= hid-haptic.o
>  
>  obj-$(CONFIG_HID_BPF)		+= bpf/
>  
> diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..d659a430c1a6b06ded31d49efe4bded909671cb6
> --- /dev/null
> +++ b/drivers/hid/hid-haptic.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *  HID Haptic support for Linux
> + *
> + *  Copyright (c) 2021 Angela Czubak <acz@semihalf.com>
> + */
> +
> +#include "hid-haptic.h"
> +
> +void hid_haptic_feature_mapping(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_field *field, struct hid_usage *usage)
> +{
> +	if (usage->hid == HID_HP_AUTOTRIGGER) {
> +		if (usage->usage_index >= field->report_count) {
> +			dev_err(&hdev->dev,
> +				"HID_HP_AUTOTRIGGER out of range\n");
> +			return;
> +		}
> +
> +		hid_device_io_start(hdev);
> +		hid_hw_request(hdev, field->report, HID_REQ_GET_REPORT);
> +		hid_hw_wait(hdev);
> +		hid_device_io_stop(hdev);
> +		haptic->default_auto_trigger =
> +			field->value[usage->usage_index];
> +		haptic->auto_trigger_report = field->report;
> +	}
> +}
> +EXPORT_SYMBOL_GPL(hid_haptic_feature_mapping);
> +
> +bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
> +				    struct hid_input *hi, struct hid_field *field)
> +{
> +	if (field->unit == HID_UNIT_GRAM || field->unit == HID_UNIT_NEWTON)
> +		return true;
> +	return false;
> +}
> +EXPORT_SYMBOL_GPL(hid_haptic_check_pressure_unit);
> +
> +int hid_haptic_input_mapping(struct hid_device *hdev,
> +			     struct hid_haptic_device *haptic,
> +			     struct hid_input *hi,
> +			     struct hid_field *field, struct hid_usage *usage,
> +			     unsigned long **bit, int *max)
> +{
> +	if (usage->hid == HID_HP_MANUALTRIGGER) {
> +		haptic->manual_trigger_report = field->report;
> +		/* we don't really want to map these fields */
> +		return -1;
> +	}
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(hid_haptic_input_mapping);
> +
> +int hid_haptic_input_configured(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_input *hi)
> +{
> +
> +	if (hi->application == HID_DG_TOUCHPAD) {
> +		if (haptic->auto_trigger_report &&
> +		    haptic->manual_trigger_report) {
> +			__set_bit(INPUT_PROP_HAPTIC_TOUCHPAD, hi->input->propbit);
> +			return 1;
> +		}
> +		return 0;
> +	}
> +	return -1;
> +}
> +EXPORT_SYMBOL_GPL(hid_haptic_input_configured);
> diff --git a/drivers/hid/hid-haptic.h b/drivers/hid/hid-haptic.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..2e89addf5ec280d5b9a59d06088cc08bd4f445c1
> --- /dev/null
> +++ b/drivers/hid/hid-haptic.h
> @@ -0,0 +1,101 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + *  HID Haptic support for Linux
> + *
> + *  Copyright (c) 2021 Angela Czubak <acz@semihalf.com>
> + */
> +
> +#include <linux/hid.h>
> +
> +#define HID_HAPTIC_ORDINAL_WAVEFORMNONE 1
> +#define HID_HAPTIC_ORDINAL_WAVEFORMSTOP 2
> +
> +#define HID_HAPTIC_MODE_DEVICE 0
> +#define HID_HAPTIC_MODE_HOST 1
> +
> +struct hid_haptic_effect {
> +	u8 *report_buf;
> +	struct input_dev *input_dev;
> +	struct work_struct work;
> +	struct list_head control;
> +	struct mutex control_mutex;
> +};
> +
> +struct hid_haptic_effect_node {
> +	struct list_head node;
> +	struct file *file;
> +};
> +
> +struct hid_haptic_device {
> +	struct input_dev *input_dev;
> +	struct hid_device *hdev;
> +	struct hid_report *auto_trigger_report;
> +	struct mutex auto_trigger_mutex;
> +	struct workqueue_struct *wq;
> +	struct hid_report *manual_trigger_report;
> +	struct mutex manual_trigger_mutex;
> +	size_t manual_trigger_report_len;
> +	int pressed_state;
> +	s32 pressure_sum;
> +	s32 force_logical_minimum;
> +	s32 force_physical_minimum;
> +	s32 force_resolution;
> +	u32 mode;
> +	u32 default_auto_trigger;
> +	u32 vendor_page;
> +	u32 vendor_id;
> +	u32 max_waveform_id;
> +	u32 max_duration_id;
> +	u16 *hid_usage_map;
> +	u32 *duration_map;
> +	u16 press_ordinal;
> +	u16 release_ordinal;
> +	struct hid_haptic_effect *effect;
> +	struct hid_haptic_effect stop_effect;
> +};
> +
> +#if IS_ENABLED(CONFIG_HID_HAPTIC)
> +void hid_haptic_feature_mapping(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_field *field, struct hid_usage
> +				*usage);
> +bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
> +				    struct hid_input *hi, struct hid_field *field);
> +int hid_haptic_input_mapping(struct hid_device *hdev,
> +			     struct hid_haptic_device *haptic,
> +			     struct hid_input *hi,
> +			     struct hid_field *field, struct hid_usage *usage,
> +			     unsigned long **bit, int *max);
> +int hid_haptic_input_configured(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_input *hi);
> +#else
> +static inline
> +void hid_haptic_feature_mapping(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_field *field, struct hid_usage
> +				*usage)
> +{}
> +static inline
> +bool hid_haptic_check_pressure_unit(struct hid_haptic_device *haptic,
> +				    struct hid_input *hi, struct hid_field *field)
> +{
> +	return false;
> +}
> +static inline
> +int hid_haptic_input_mapping(struct hid_device *hdev,
> +			     struct hid_haptic_device *haptic,
> +			     struct hid_input *hi,
> +			     struct hid_field *field, struct hid_usage *usage,
> +			     unsigned long **bit, int *max)
> +{
> +	return 0;
> +}
> +static inline
> +int hid_haptic_input_configured(struct hid_device *hdev,
> +				struct hid_haptic_device *haptic,
> +				struct hid_input *hi)
> +{
> +	return 0;
> +}
> +#endif
>
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Randy Dunlap 4 months ago
Hi,

On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> On 8/19/25 01:08, Jonathan Denose wrote:
>> From: Angela Czubak <aczubak@google.com>
>>
>> Define a new structure that contains simple haptic device configuration
>> as well as current state.
>> Add functions that recognize auto trigger and manual trigger reports
>> as well as save their addresses.Hi,
>> Verify that the pressure unit is either grams or newtons.
>> Mark the input device as a haptic touchpad if the unit is correct and
>> the reports are found.
>>  [...]
>> +config HID_HAPTIC
>> +	tristate "Haptic touchpad support"
>> +	default n
>> +	help
>> +	Support for touchpads with force sensors and haptic actuators instead of a
>> +	traditional button.
>> +	Adds extra parsing and FF device for the hid multitouch driver.
>> +	It can be used for Elan 2703 haptic touchpad.
>> +
>> +	If unsure, say N.
>> +
>>  menu "Special HID drivers"
> 
> I suspect this change is related to a build error I ran into today:
> 
>   MODPOST Module.symvers
> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> 
> The config where this occurred had this:
> 
> CONFIG_HID=y
> CONFIG_HID_MULTITOUCH=m
> CONFIG_HID_HAPTIC=m
> 
> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.

Sure, but that's just covering up the problem.

First, I get this build error:

ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o

so I added those to hid-haptic.c.... and I still get that same build error.

So I looked at the hid-haptic.o file, in the .modinfo section,
and saw this:

Disassembly of section .modinfo:

0000000000000000 <__UNIQUE_ID_modinfo569>:
   0:	68 69 64 2e 6c       	push   $0x6c2e6469
   5:	69 63 65 6e 73 65 3d 	imul   $0x3d65736e,0x65(%rbx),%esp
   c:	47 50                	rex.RXB push %r8
   e:	4c 00            	rex.WR add %r13b,0x69(%rax)

which is ASCII " h  i  d  .  l  i  c  e  n  s  e  =  G  P  L".

so the license string is there.

Maybe something is modpost is having a problem.
Unless someone who has modified modpost recently has any ideas,
this needs a git bisect, I expect.

---
~Randy
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Thorsten Leemhuis 4 months ago
[Top-Posting for easier consumption]

Mainly writing this mail to bring Lucas GISSOT in here, who reported the
same error yesterday here:
https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/

Lucas there suggested:
"""but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
Kconfig updated."""

And Randy: Thx for the closer investigation! It explains some of the
"that feels odd, am I holding this wrong" feeling I had when reporting this.

Ciao, Thorsten

On 10/10/25 06:50, Randy Dunlap wrote:
> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
>> On 8/19/25 01:08, Jonathan Denose wrote:
>>> From: Angela Czubak <aczubak@google.com>
>>>
>>> Define a new structure that contains simple haptic device configuration
>>> as well as current state.
>>> Add functions that recognize auto trigger and manual trigger reports
>>> as well as save their addresses.Hi,
>>> Verify that the pressure unit is either grams or newtons.
>>> Mark the input device as a haptic touchpad if the unit is correct and
>>> the reports are found.
>>>  [...]
>>> +config HID_HAPTIC
>>> +	tristate "Haptic touchpad support"
>>> +	default n
>>> +	help
>>> +	Support for touchpads with force sensors and haptic actuators instead of a
>>> +	traditional button.
>>> +	Adds extra parsing and FF device for the hid multitouch driver.
>>> +	It can be used for Elan 2703 haptic touchpad.
>>> +
>>> +	If unsure, say N.
>>> +
>>>  menu "Special HID drivers"
>>
>> I suspect this change is related to a build error I ran into today:
>>
>>   MODPOST Module.symvers
>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
>>
>> The config where this occurred had this:
>>
>> CONFIG_HID=y
>> CONFIG_HID_MULTITOUCH=m
>> CONFIG_HID_HAPTIC=m
>>
>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> 
> Sure, but that's just covering up the problem.
>> First, I get this build error:
> 
> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> 
> so I added those to hid-haptic.c.... and I still get that same build error.
> 
> So I looked at the hid-haptic.o file, in the .modinfo section,
> and saw this:
> 
> Disassembly of section .modinfo:
> 
> 0000000000000000 <__UNIQUE_ID_modinfo569>:
>    0:	68 69 64 2e 6c       	push   $0x6c2e6469
>    5:	69 63 65 6e 73 65 3d 	imul   $0x3d65736e,0x65(%rbx),%esp
>    c:	47 50                	rex.RXB push %r8
>    e:	4c 00            	rex.WR add %r13b,0x69(%rax)
> 
> which is ASCII " h  i  d  .  l  i  c  e  n  s  e  =  G  P  L".
> 
> so the license string is there.
> 
> Maybe something is modpost is having a problem.
> Unless someone who has modified modpost recently has any ideas,
> this needs a git bisect, I expect.
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Randy Dunlap 4 months ago
Hi,

I think I found it... see below.


On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> [Top-Posting for easier consumption]
> 
> Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> same error yesterday here:
> https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> 
> Lucas there suggested:
> """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> Kconfig updated."""
> 
> And Randy: Thx for the closer investigation! It explains some of the
> "that feels odd, am I holding this wrong" feeling I had when reporting this.
> 
> Ciao, Thorsten
> 
> On 10/10/25 06:50, Randy Dunlap wrote:
>> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
>>> On 8/19/25 01:08, Jonathan Denose wrote:
>>>> From: Angela Czubak <aczubak@google.com>
>>>>
>>>> Define a new structure that contains simple haptic device configuration
>>>> as well as current state.
>>>> Add functions that recognize auto trigger and manual trigger reports
>>>> as well as save their addresses.Hi,
>>>> Verify that the pressure unit is either grams or newtons.
>>>> Mark the input device as a haptic touchpad if the unit is correct and
>>>> the reports are found.
>>>>  [...]
>>>> +config HID_HAPTIC
>>>> +	tristate "Haptic touchpad support"
>>>> +	default n
>>>> +	help
>>>> +	Support for touchpads with force sensors and haptic actuators instead of a
>>>> +	traditional button.
>>>> +	Adds extra parsing and FF device for the hid multitouch driver.
>>>> +	It can be used for Elan 2703 haptic touchpad.
>>>> +
>>>> +	If unsure, say N.
>>>> +
>>>>  menu "Special HID drivers"
>>>
>>> I suspect this change is related to a build error I ran into today:
>>>
>>>   MODPOST Module.symvers
>>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
>>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
>>>
>>> The config where this occurred had this:
>>>
>>> CONFIG_HID=y
>>> CONFIG_HID_MULTITOUCH=m
>>> CONFIG_HID_HAPTIC=m
>>>
>>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
>>
>> Sure, but that's just covering up the problem.
>>> First, I get this build error:
>>
>> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
>> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
>>

ISTM that tristate is incompatible with this newly added Makefile
line:

+hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o

hid-* lists files that should be builtin, not loadable modules.
These should all be hid-y.  AFAIK, hid-m is not useful.
(A maintainer can correct me as needed.)

So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
hid-haptic.c and changing drivers/hid/Makefile to use
obj-$(CONFIG_HID_HAPTIC_	+= hid-haptic.o

fixes the build errors for me.

Angela, Jonathan D., is there any reason that
hid-haptic needs to be builtin instead of a loadable
module?  It's no problem for hid-multitouch.ko to call
into hid-haptic.ko (both as loadable modules) as long as
hid-haptic.ko is loaded first.

Thanks.

~Randy
---
---
 drivers/hid/hid-haptic.c |    3 +++
 1 file changed, 3 insertions(+)

--- linux.orig/drivers/hid/hid-haptic.c
+++ linux/drivers/hid/hid-haptic.c
@@ -10,6 +10,9 @@
 
 #include "hid-haptic.h"
 
+MODULE_DESCRIPTION("HID haptic touchpad support");
+MODULE_LICENSE("GPL");
+
 void hid_haptic_feature_mapping(struct hid_device *hdev,
 				struct hid_haptic_device *haptic,
 				struct hid_field *field, struct hid_usage *usage)
---
 drivers/hid/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux.orig/drivers/hid/Makefile
+++ linux/drivers/hid/Makefile
@@ -4,7 +4,8 @@
 #
 hid-y			:= hid-core.o hid-input.o hid-quirks.o
 hid-$(CONFIG_DEBUG_FS)		+= hid-debug.o
-hid-$(CONFIG_HID_HAPTIC)	+= hid-haptic.o
+
+obj-$(CONFIG_HID_HAPTIC)	+= hid-haptic.o
 
 obj-$(CONFIG_HID_BPF)		+= bpf/
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Jonathan Denose 4 months ago
Hi all,

Thanks for looking into this.

On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi,
>
> I think I found it... see below.
>
>
> On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> > [Top-Posting for easier consumption]
> >
> > Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> > same error yesterday here:
> > https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> >
> > Lucas there suggested:
> > """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> > hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> > Kconfig updated."""
> >
> > And Randy: Thx for the closer investigation! It explains some of the
> > "that feels odd, am I holding this wrong" feeling I had when reporting this.
> >
> > Ciao, Thorsten
> >
> > On 10/10/25 06:50, Randy Dunlap wrote:
> >> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> >>> On 8/19/25 01:08, Jonathan Denose wrote:
> >>>> From: Angela Czubak <aczubak@google.com>
> >>>>
> >>>> Define a new structure that contains simple haptic device configuration
> >>>> as well as current state.
> >>>> Add functions that recognize auto trigger and manual trigger reports
> >>>> as well as save their addresses.Hi,
> >>>> Verify that the pressure unit is either grams or newtons.
> >>>> Mark the input device as a haptic touchpad if the unit is correct and
> >>>> the reports are found.
> >>>>  [...]
> >>>> +config HID_HAPTIC
> >>>> +  tristate "Haptic touchpad support"
> >>>> +  default n
> >>>> +  help
> >>>> +  Support for touchpads with force sensors and haptic actuators instead of a
> >>>> +  traditional button.
> >>>> +  Adds extra parsing and FF device for the hid multitouch driver.
> >>>> +  It can be used for Elan 2703 haptic touchpad.
> >>>> +
> >>>> +  If unsure, say N.
> >>>> +
> >>>>  menu "Special HID drivers"
> >>>
> >>> I suspect this change is related to a build error I ran into today:
> >>>
> >>>   MODPOST Module.symvers
> >>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> >>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> >>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> >>>
> >>> The config where this occurred had this:
> >>>
> >>> CONFIG_HID=y
> >>> CONFIG_HID_MULTITOUCH=m
> >>> CONFIG_HID_HAPTIC=m
> >>>
> >>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> >>
> >> Sure, but that's just covering up the problem.
> >>> First, I get this build error:
> >>
> >> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> >> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> >>
>
> ISTM that tristate is incompatible with this newly added Makefile
> line:
>
> +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
>
> hid-* lists files that should be builtin, not loadable modules.
> These should all be hid-y.  AFAIK, hid-m is not useful.
> (A maintainer can correct me as needed.)
>
> So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
> hid-haptic.c and changing drivers/hid/Makefile to use
> obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
>
> fixes the build errors for me.
>
> Angela, Jonathan D., is there any reason that
> hid-haptic needs to be builtin instead of a loadable
> module?  It's no problem for hid-multitouch.ko to call
> into hid-haptic.ko (both as loadable modules) as long as
> hid-haptic.ko is loaded first.
>
As long as hid-multitouch.ko is able to call into hid-haptic.ko I
don't see any issues, but is there a way to enforce that when
CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
hid-multitouch.ko?
>
> Thanks.
>
> ~Randy
> ---
> ---
>  drivers/hid/hid-haptic.c |    3 +++
>  1 file changed, 3 insertions(+)
>
> --- linux.orig/drivers/hid/hid-haptic.c
> +++ linux/drivers/hid/hid-haptic.c
> @@ -10,6 +10,9 @@
>
>  #include "hid-haptic.h"
>
> +MODULE_DESCRIPTION("HID haptic touchpad support");
> +MODULE_LICENSE("GPL");
> +
>  void hid_haptic_feature_mapping(struct hid_device *hdev,
>                                 struct hid_haptic_device *haptic,
>                                 struct hid_field *field, struct hid_usage *usage)
> ---
>  drivers/hid/Makefile |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- linux.orig/drivers/hid/Makefile
> +++ linux/drivers/hid/Makefile
> @@ -4,7 +4,8 @@
>  #
>  hid-y                  := hid-core.o hid-input.o hid-quirks.o
>  hid-$(CONFIG_DEBUG_FS)         += hid-debug.o
> -hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> +
> +obj-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
>
>  obj-$(CONFIG_HID_BPF)          += bpf/
>
>
--
Jonathan
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Randy Dunlap 4 months ago

On 10/10/25 1:30 PM, Jonathan Denose wrote:
> Hi all,
> 
> Thanks for looking into this.
> 
> On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> Hi,
>>
>> I think I found it... see below.
>>
>>
>> On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
>>> [Top-Posting for easier consumption]
>>>
>>> Mainly writing this mail to bring Lucas GISSOT in here, who reported the
>>> same error yesterday here:
>>> https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
>>>
>>> Lucas there suggested:
>>> """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
>>> hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
>>> Kconfig updated."""
>>>
>>> And Randy: Thx for the closer investigation! It explains some of the
>>> "that feels odd, am I holding this wrong" feeling I had when reporting this.
>>>
>>> Ciao, Thorsten
>>>
>>> On 10/10/25 06:50, Randy Dunlap wrote:
>>>> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
>>>>> On 8/19/25 01:08, Jonathan Denose wrote:
>>>>>> From: Angela Czubak <aczubak@google.com>
>>>>>>
>>>>>> Define a new structure that contains simple haptic device configuration
>>>>>> as well as current state.
>>>>>> Add functions that recognize auto trigger and manual trigger reports
>>>>>> as well as save their addresses.Hi,
>>>>>> Verify that the pressure unit is either grams or newtons.
>>>>>> Mark the input device as a haptic touchpad if the unit is correct and
>>>>>> the reports are found.
>>>>>>  [...]
>>>>>> +config HID_HAPTIC
>>>>>> +  tristate "Haptic touchpad support"
>>>>>> +  default n
>>>>>> +  help
>>>>>> +  Support for touchpads with force sensors and haptic actuators instead of a
>>>>>> +  traditional button.
>>>>>> +  Adds extra parsing and FF device for the hid multitouch driver.
>>>>>> +  It can be used for Elan 2703 haptic touchpad.
>>>>>> +
>>>>>> +  If unsure, say N.
>>>>>> +
>>>>>>  menu "Special HID drivers"
>>>>>
>>>>> I suspect this change is related to a build error I ran into today:
>>>>>
>>>>>   MODPOST Module.symvers
>>>>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
>>>>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
>>>>>
>>>>> The config where this occurred had this:
>>>>>
>>>>> CONFIG_HID=y
>>>>> CONFIG_HID_MULTITOUCH=m
>>>>> CONFIG_HID_HAPTIC=m
>>>>>
>>>>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
>>>>
>>>> Sure, but that's just covering up the problem.
>>>>> First, I get this build error:
>>>>
>>>> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
>>>> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
>>>>
>>
>> ISTM that tristate is incompatible with this newly added Makefile
>> line:
>>
>> +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
>>
>> hid-* lists files that should be builtin, not loadable modules.
>> These should all be hid-y.  AFAIK, hid-m is not useful.
>> (A maintainer can correct me as needed.)

More correctly, any .o that is listed as being built as part of
hid.o should is going to be controlled by CONFIG_HID and should
not its own have a Kconfig symbol at all.

E.g. here:
 hid-y                  := hid-core.o hid-input.o hid-quirks.o
hid-core, hid-input, and hid-quirks don't have their own
Kconfig symbols.



>> So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
>> hid-haptic.c and changing drivers/hid/Makefile to use
>> obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
>>
>> fixes the build errors for me.
>>
>> Angela, Jonathan D., is there any reason that
>> hid-haptic needs to be builtin instead of a loadable
>> module?  It's no problem for hid-multitouch.ko to call
>> into hid-haptic.ko (both as loadable modules) as long as
>> hid-haptic.ko is loaded first.
>>
> As long as hid-multitouch.ko is able to call into hid-haptic.ko I
> don't see any issues, but is there a way to enforce that when
> CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
> hid-multitouch.ko?

I only know of two possibilities though there may be more.

a. use request_module(true, "hid-haptic");

This would probably be used in the hid core somewhere, afterthe device matching is done.

b. use udev. When a device that needs hid-multitouch is
discovered, have udev load both hid-haptic and hid-multitouch.


I see that hid-haptic.h is written so that it has stubs for
when CONFIG_HID_HAPTIC is not enabled. Can hid-multitouch
operate (in a reduced capacity) when HID_HAPTIC is not enabled?
So that they are separate modules and hid-multitouch is not
dependent on hid-haptic?

There is probably a use case for hid-multitouch without having
hid-haptic loaded since hid-multitouch existed without having
hid-haptic around at all.

It seems that you want both of them loaded. And then Lucas
has reported a build error when HID_HAPTIC=m and
HID_MULTITOUCH=y, so either (like Lucas said) HID_HAPTIC
should be bool, not tristate; or in Kconfig,
HID_MULTITOUCH should depend on HID_HAPTIC, which would not
allow the problem config that Lucas reported.
But that forces devices that want HID_MULTITOUCH to also
have HID_HAPTIC loaded, even though they may not need it.


-- 
~Randy

Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Jonathan Denose 3 months, 3 weeks ago
On Fri, Oct 10, 2025 at 5:52 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
>
>
> On 10/10/25 1:30 PM, Jonathan Denose wrote:
> > Hi all,
> >
> > Thanks for looking into this.
> >
> > On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >> Hi,
> >>
> >> I think I found it... see below.
> >>
> >>
> >> On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> >>> [Top-Posting for easier consumption]
> >>>
> >>> Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> >>> same error yesterday here:
> >>> https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> >>>
> >>> Lucas there suggested:
> >>> """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> >>> hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> >>> Kconfig updated."""
> >>>
> >>> And Randy: Thx for the closer investigation! It explains some of the
> >>> "that feels odd, am I holding this wrong" feeling I had when reporting this.
> >>>
> >>> Ciao, Thorsten
> >>>
> >>> On 10/10/25 06:50, Randy Dunlap wrote:
> >>>> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> >>>>> On 8/19/25 01:08, Jonathan Denose wrote:
> >>>>>> From: Angela Czubak <aczubak@google.com>
> >>>>>>
> >>>>>> Define a new structure that contains simple haptic device configuration
> >>>>>> as well as current state.
> >>>>>> Add functions that recognize auto trigger and manual trigger reports
> >>>>>> as well as save their addresses.Hi,
> >>>>>> Verify that the pressure unit is either grams or newtons.
> >>>>>> Mark the input device as a haptic touchpad if the unit is correct and
> >>>>>> the reports are found.
> >>>>>>  [...]
> >>>>>> +config HID_HAPTIC
> >>>>>> +  tristate "Haptic touchpad support"
> >>>>>> +  default n
> >>>>>> +  help
> >>>>>> +  Support for touchpads with force sensors and haptic actuators instead of a
> >>>>>> +  traditional button.
> >>>>>> +  Adds extra parsing and FF device for the hid multitouch driver.
> >>>>>> +  It can be used for Elan 2703 haptic touchpad.
> >>>>>> +
> >>>>>> +  If unsure, say N.
> >>>>>> +
> >>>>>>  menu "Special HID drivers"
> >>>>>
> >>>>> I suspect this change is related to a build error I ran into today:
> >>>>>
> >>>>>   MODPOST Module.symvers
> >>>>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> >>>>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> >>>>>
> >>>>> The config where this occurred had this:
> >>>>>
> >>>>> CONFIG_HID=y
> >>>>> CONFIG_HID_MULTITOUCH=m
> >>>>> CONFIG_HID_HAPTIC=m
> >>>>>
> >>>>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> >>>>
> >>>> Sure, but that's just covering up the problem.
> >>>>> First, I get this build error:
> >>>>
> >>>> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> >>>> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> >>>>
> >>
> >> ISTM that tristate is incompatible with this newly added Makefile
> >> line:
> >>
> >> +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> >>
> >> hid-* lists files that should be builtin, not loadable modules.
> >> These should all be hid-y.  AFAIK, hid-m is not useful.
> >> (A maintainer can correct me as needed.)
>
> More correctly, any .o that is listed as being built as part of
> hid.o should is going to be controlled by CONFIG_HID and should
> not its own have a Kconfig symbol at all.
>
> E.g. here:
>  hid-y                  := hid-core.o hid-input.o hid-quirks.o
> hid-core, hid-input, and hid-quirks don't have their own
> Kconfig symbols.
>
>
>
> >> So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
> >> hid-haptic.c and changing drivers/hid/Makefile to use
> >> obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
> >>
> >> fixes the build errors for me.
> >>
> >> Angela, Jonathan D., is there any reason that
> >> hid-haptic needs to be builtin instead of a loadable
> >> module?  It's no problem for hid-multitouch.ko to call
> >> into hid-haptic.ko (both as loadable modules) as long as
> >> hid-haptic.ko is loaded first.
> >>
> > As long as hid-multitouch.ko is able to call into hid-haptic.ko I
> > don't see any issues, but is there a way to enforce that when
> > CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
> > hid-multitouch.ko?
>
> I only know of two possibilities though there may be more.
>
> a. use request_module(true, "hid-haptic");
>
> This would probably be used in the hid core somewhere, afterthe device matching is done.
>
> b. use udev. When a device that needs hid-multitouch is
> discovered, have udev load both hid-haptic and hid-multitouch.
>
>
> I see that hid-haptic.h is written so that it has stubs for
> when CONFIG_HID_HAPTIC is not enabled. Can hid-multitouch
> operate (in a reduced capacity) when HID_HAPTIC is not enabled?
> So that they are separate modules and hid-multitouch is not
> dependent on hid-haptic?
>
> There is probably a use case for hid-multitouch without having
> hid-haptic loaded since hid-multitouch existed without having
> hid-haptic around at all.
>
> It seems that you want both of them loaded. And then Lucas
> has reported a build error when HID_HAPTIC=m and
> HID_MULTITOUCH=y, so either (like Lucas said) HID_HAPTIC
> should be bool, not tristate; or in Kconfig,
> HID_MULTITOUCH should depend on HID_HAPTIC, which would not
> allow the problem config that Lucas reported.
> But that forces devices that want HID_MULTITOUCH to also
> have HID_HAPTIC loaded, even though they may not need it.
>
The idea behind these patches was that hid-haptic would depend on
hid-multitouch but not the other way around. I am fine changing
HID_HAPTIC to bool. That's what I had it as initially, but I was asked
to change it.

If everyone else is fine with that, I can send out a patch.
> --
> ~Randy
>
-- 
Jonathan
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Benjamin Tissoires 3 months, 3 weeks ago
On Oct 13 2025, Jonathan Denose wrote:
> On Fri, Oct 10, 2025 at 5:52 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> >
> >
> > On 10/10/25 1:30 PM, Jonathan Denose wrote:
> > > Hi all,
> > >
> > > Thanks for looking into this.
> > >
> > > On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> > >>
> > >> Hi,
> > >>
> > >> I think I found it... see below.
> > >>
> > >>
> > >> On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> > >>> [Top-Posting for easier consumption]
> > >>>
> > >>> Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> > >>> same error yesterday here:
> > >>> https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> > >>>
> > >>> Lucas there suggested:
> > >>> """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> > >>> hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> > >>> Kconfig updated."""
> > >>>
> > >>> And Randy: Thx for the closer investigation! It explains some of the
> > >>> "that feels odd, am I holding this wrong" feeling I had when reporting this.
> > >>>
> > >>> Ciao, Thorsten
> > >>>
> > >>> On 10/10/25 06:50, Randy Dunlap wrote:
> > >>>> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> > >>>>> On 8/19/25 01:08, Jonathan Denose wrote:
> > >>>>>> From: Angela Czubak <aczubak@google.com>
> > >>>>>>
> > >>>>>> Define a new structure that contains simple haptic device configuration
> > >>>>>> as well as current state.
> > >>>>>> Add functions that recognize auto trigger and manual trigger reports
> > >>>>>> as well as save their addresses.Hi,
> > >>>>>> Verify that the pressure unit is either grams or newtons.
> > >>>>>> Mark the input device as a haptic touchpad if the unit is correct and
> > >>>>>> the reports are found.
> > >>>>>>  [...]
> > >>>>>> +config HID_HAPTIC
> > >>>>>> +  tristate "Haptic touchpad support"
> > >>>>>> +  default n
> > >>>>>> +  help
> > >>>>>> +  Support for touchpads with force sensors and haptic actuators instead of a
> > >>>>>> +  traditional button.
> > >>>>>> +  Adds extra parsing and FF device for the hid multitouch driver.
> > >>>>>> +  It can be used for Elan 2703 haptic touchpad.
> > >>>>>> +
> > >>>>>> +  If unsure, say N.
> > >>>>>> +
> > >>>>>>  menu "Special HID drivers"
> > >>>>>
> > >>>>> I suspect this change is related to a build error I ran into today:
> > >>>>>
> > >>>>>   MODPOST Module.symvers
> > >>>>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> > >>>>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> > >>>>>
> > >>>>> The config where this occurred had this:
> > >>>>>
> > >>>>> CONFIG_HID=y
> > >>>>> CONFIG_HID_MULTITOUCH=m
> > >>>>> CONFIG_HID_HAPTIC=m
> > >>>>>
> > >>>>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> > >>>>
> > >>>> Sure, but that's just covering up the problem.
> > >>>>> First, I get this build error:
> > >>>>
> > >>>> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> > >>>> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> > >>>>
> > >>
> > >> ISTM that tristate is incompatible with this newly added Makefile
> > >> line:
> > >>
> > >> +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> > >>
> > >> hid-* lists files that should be builtin, not loadable modules.
> > >> These should all be hid-y.  AFAIK, hid-m is not useful.
> > >> (A maintainer can correct me as needed.)
> >
> > More correctly, any .o that is listed as being built as part of
> > hid.o should is going to be controlled by CONFIG_HID and should
> > not its own have a Kconfig symbol at all.
> >
> > E.g. here:
> >  hid-y                  := hid-core.o hid-input.o hid-quirks.o
> > hid-core, hid-input, and hid-quirks don't have their own
> > Kconfig symbols.
> >
> >
> >
> > >> So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
> > >> hid-haptic.c and changing drivers/hid/Makefile to use
> > >> obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
> > >>
> > >> fixes the build errors for me.
> > >>
> > >> Angela, Jonathan D., is there any reason that
> > >> hid-haptic needs to be builtin instead of a loadable
> > >> module?  It's no problem for hid-multitouch.ko to call
> > >> into hid-haptic.ko (both as loadable modules) as long as
> > >> hid-haptic.ko is loaded first.
> > >>
> > > As long as hid-multitouch.ko is able to call into hid-haptic.ko I
> > > don't see any issues, but is there a way to enforce that when
> > > CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
> > > hid-multitouch.ko?
> >
> > I only know of two possibilities though there may be more.
> >
> > a. use request_module(true, "hid-haptic");
> >
> > This would probably be used in the hid core somewhere, afterthe device matching is done.
> >
> > b. use udev. When a device that needs hid-multitouch is
> > discovered, have udev load both hid-haptic and hid-multitouch.
> >
> >
> > I see that hid-haptic.h is written so that it has stubs for
> > when CONFIG_HID_HAPTIC is not enabled. Can hid-multitouch
> > operate (in a reduced capacity) when HID_HAPTIC is not enabled?
> > So that they are separate modules and hid-multitouch is not
> > dependent on hid-haptic?
> >
> > There is probably a use case for hid-multitouch without having
> > hid-haptic loaded since hid-multitouch existed without having
> > hid-haptic around at all.
> >
> > It seems that you want both of them loaded. And then Lucas
> > has reported a build error when HID_HAPTIC=m and
> > HID_MULTITOUCH=y, so either (like Lucas said) HID_HAPTIC
> > should be bool, not tristate; or in Kconfig,
> > HID_MULTITOUCH should depend on HID_HAPTIC, which would not
> > allow the problem config that Lucas reported.
> > But that forces devices that want HID_MULTITOUCH to also
> > have HID_HAPTIC loaded, even though they may not need it.

One way around it is to declare a stub struct haptic_operations and let
hid-haptic.ko fill in the function pointers when it loads and remove
them when it unloads. But it can be a little bit tedious, especially
because making it properly working involves RCUs (we don't want to have
mutexes everywhere).

> >
> The idea behind these patches was that hid-haptic would depend on
> hid-multitouch but not the other way around. I am fine changing
> HID_HAPTIC to bool. That's what I had it as initially, but I was asked
> to change it.
> 
> If everyone else is fine with that, I can send out a patch.

I'd still prefer hid-haptic to be tristate, just because
input_ff_memless is tristate as well. Right now distributions don't
support the FF bits, so enforcing this into the kernel seems a little
bit harsh on them and difficult to debug for early adopters.

That being said, that build failure is pretty bad. So please send a
(temporary) fix ASAP. If making it boolean solves the issue, then yes,
send a boolean fix and then we can revisit it. But right now the urgency
is to fix that.

And if making it proper tristate is too hard, then we can leave with
bool.

Cheers,
Benjamin

> > --
> > ~Randy
> >
> -- 
> Jonathan
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Jonathan Denose 3 months, 3 weeks ago
On Mon, Oct 13, 2025 at 9:29 AM Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> On Oct 13 2025, Jonathan Denose wrote:
> > On Fri, Oct 10, 2025 at 5:52 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> > >
> > >
> > >
> > > On 10/10/25 1:30 PM, Jonathan Denose wrote:
> > > > Hi all,
> > > >
> > > > Thanks for looking into this.
> > > >
> > > > On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > >>
> > > >> Hi,
> > > >>
> > > >> I think I found it... see below.
> > > >>
> > > >>
> > > >> On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> > > >>> [Top-Posting for easier consumption]
> > > >>>
> > > >>> Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> > > >>> same error yesterday here:
> > > >>> https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> > > >>>
> > > >>> Lucas there suggested:
> > > >>> """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> > > >>> hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> > > >>> Kconfig updated."""
> > > >>>
> > > >>> And Randy: Thx for the closer investigation! It explains some of the
> > > >>> "that feels odd, am I holding this wrong" feeling I had when reporting this.
> > > >>>
> > > >>> Ciao, Thorsten
> > > >>>
> > > >>> On 10/10/25 06:50, Randy Dunlap wrote:
> > > >>>> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> > > >>>>> On 8/19/25 01:08, Jonathan Denose wrote:
> > > >>>>>> From: Angela Czubak <aczubak@google.com>
> > > >>>>>>
> > > >>>>>> Define a new structure that contains simple haptic device configuration
> > > >>>>>> as well as current state.
> > > >>>>>> Add functions that recognize auto trigger and manual trigger reports
> > > >>>>>> as well as save their addresses.Hi,
> > > >>>>>> Verify that the pressure unit is either grams or newtons.
> > > >>>>>> Mark the input device as a haptic touchpad if the unit is correct and
> > > >>>>>> the reports are found.
> > > >>>>>>  [...]
> > > >>>>>> +config HID_HAPTIC
> > > >>>>>> +  tristate "Haptic touchpad support"
> > > >>>>>> +  default n
> > > >>>>>> +  help
> > > >>>>>> +  Support for touchpads with force sensors and haptic actuators instead of a
> > > >>>>>> +  traditional button.
> > > >>>>>> +  Adds extra parsing and FF device for the hid multitouch driver.
> > > >>>>>> +  It can be used for Elan 2703 haptic touchpad.
> > > >>>>>> +
> > > >>>>>> +  If unsure, say N.
> > > >>>>>> +
> > > >>>>>>  menu "Special HID drivers"
> > > >>>>>
> > > >>>>> I suspect this change is related to a build error I ran into today:
> > > >>>>>
> > > >>>>>   MODPOST Module.symvers
> > > >>>>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> > > >>>>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> > > >>>>>
> > > >>>>> The config where this occurred had this:
> > > >>>>>
> > > >>>>> CONFIG_HID=y
> > > >>>>> CONFIG_HID_MULTITOUCH=m
> > > >>>>> CONFIG_HID_HAPTIC=m
> > > >>>>>
> > > >>>>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> > > >>>>
> > > >>>> Sure, but that's just covering up the problem.
> > > >>>>> First, I get this build error:
> > > >>>>
> > > >>>> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> > > >>>> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> > > >>>>
> > > >>
> > > >> ISTM that tristate is incompatible with this newly added Makefile
> > > >> line:
> > > >>
> > > >> +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> > > >>
> > > >> hid-* lists files that should be builtin, not loadable modules.
> > > >> These should all be hid-y.  AFAIK, hid-m is not useful.
> > > >> (A maintainer can correct me as needed.)
> > >
> > > More correctly, any .o that is listed as being built as part of
> > > hid.o should is going to be controlled by CONFIG_HID and should
> > > not its own have a Kconfig symbol at all.
> > >
> > > E.g. here:
> > >  hid-y                  := hid-core.o hid-input.o hid-quirks.o
> > > hid-core, hid-input, and hid-quirks don't have their own
> > > Kconfig symbols.
> > >
> > >
> > >
> > > >> So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
> > > >> hid-haptic.c and changing drivers/hid/Makefile to use
> > > >> obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
> > > >>
> > > >> fixes the build errors for me.
> > > >>
> > > >> Angela, Jonathan D., is there any reason that
> > > >> hid-haptic needs to be builtin instead of a loadable
> > > >> module?  It's no problem for hid-multitouch.ko to call
> > > >> into hid-haptic.ko (both as loadable modules) as long as
> > > >> hid-haptic.ko is loaded first.
> > > >>
> > > > As long as hid-multitouch.ko is able to call into hid-haptic.ko I
> > > > don't see any issues, but is there a way to enforce that when
> > > > CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
> > > > hid-multitouch.ko?
> > >
> > > I only know of two possibilities though there may be more.
> > >
> > > a. use request_module(true, "hid-haptic");
> > >
> > > This would probably be used in the hid core somewhere, afterthe device matching is done.
> > >
> > > b. use udev. When a device that needs hid-multitouch is
> > > discovered, have udev load both hid-haptic and hid-multitouch.
> > >
> > >
> > > I see that hid-haptic.h is written so that it has stubs for
> > > when CONFIG_HID_HAPTIC is not enabled. Can hid-multitouch
> > > operate (in a reduced capacity) when HID_HAPTIC is not enabled?
> > > So that they are separate modules and hid-multitouch is not
> > > dependent on hid-haptic?
> > >
> > > There is probably a use case for hid-multitouch without having
> > > hid-haptic loaded since hid-multitouch existed without having
> > > hid-haptic around at all.
> > >
> > > It seems that you want both of them loaded. And then Lucas
> > > has reported a build error when HID_HAPTIC=m and
> > > HID_MULTITOUCH=y, so either (like Lucas said) HID_HAPTIC
> > > should be bool, not tristate; or in Kconfig,
> > > HID_MULTITOUCH should depend on HID_HAPTIC, which would not
> > > allow the problem config that Lucas reported.
> > > But that forces devices that want HID_MULTITOUCH to also
> > > have HID_HAPTIC loaded, even though they may not need it.
>
> One way around it is to declare a stub struct haptic_operations and let
> hid-haptic.ko fill in the function pointers when it loads and remove
> them when it unloads. But it can be a little bit tedious, especially
> because making it properly working involves RCUs (we don't want to have
> mutexes everywhere).
>
> > >
> > The idea behind these patches was that hid-haptic would depend on
> > hid-multitouch but not the other way around. I am fine changing
> > HID_HAPTIC to bool. That's what I had it as initially, but I was asked
> > to change it.
> >
> > If everyone else is fine with that, I can send out a patch.
>
> I'd still prefer hid-haptic to be tristate, just because
> input_ff_memless is tristate as well. Right now distributions don't
> support the FF bits, so enforcing this into the kernel seems a little
> bit harsh on them and difficult to debug for early adopters.
>
> That being said, that build failure is pretty bad. So please send a
> (temporary) fix ASAP. If making it boolean solves the issue, then yes,
> send a boolean fix and then we can revisit it. But right now the urgency
> is to fix that.
>
> And if making it proper tristate is too hard, then we can leave with
> bool.
>
> Cheers,
> Benjamin

Changing to bool instead of tristate resolved the build error.

Submitted the patch:
https://lore.kernel.org/linux-input/20251013-hid-haptic-kconfig-fix-v1-1-b1ad90732625@google.com/
-- 
Jonathan
Re: [PATCH v3 04/11] HID: haptic: introduce hid_haptic_device
Posted by Lucas GISSOT 4 months ago
Hi,
I applied Randy's patch and built with CONFIG_HID_MULTITOUCH=m and
CONFIG_HID_HAPTIC=m, it builts; but there is an ld error on hid_haptic_*
functions as soon as CONFIG_HID_MULTITOUCH is changed to yes.

Is this .config not something desired, and then HID_HAPTIC should not be
a tristate (if I understood correctly), or is there another problem?

Thanks,

Lucas

On Fri, Oct 10, 2025 at 03:30:05PM -0500, Jonathan Denose wrote:
> Hi all,
> 
> Thanks for looking into this.
> 
> On Fri, Oct 10, 2025 at 1:55 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> > Hi,
> >
> > I think I found it... see below.
> >
> >
> > On 10/9/25 11:48 PM, Thorsten Leemhuis wrote:
> > > [Top-Posting for easier consumption]
> > >
> > > Mainly writing this mail to bring Lucas GISSOT in here, who reported the
> > > same error yesterday here:
> > > https://lore.kernel.org/all/aOgvA8Jiofcnk2xb@ARSENIURE.localdomain/
> > >
> > > Lucas there suggested:
> > > """but it seems to me that the #if IS_ENABLED(CONFIG_HID_HAPTIC) in
> > > hid-haptic.h should be replaced by IS_BUILTIN(CONFIG_HID_HAPTIC) and
> > > Kconfig updated."""
> > >
> > > And Randy: Thx for the closer investigation! It explains some of the
> > > "that feels odd, am I holding this wrong" feeling I had when reporting this.
> > >
> > > Ciao, Thorsten
> > >
> > > On 10/10/25 06:50, Randy Dunlap wrote:
> > >> On 10/9/25 7:43 AM, Thorsten Leemhuis wrote:
> > >>> On 8/19/25 01:08, Jonathan Denose wrote:
> > >>>> From: Angela Czubak <aczubak@google.com>
> > >>>>
> > >>>> Define a new structure that contains simple haptic device configuration
> > >>>> as well as current state.
> > >>>> Add functions that recognize auto trigger and manual trigger reports
> > >>>> as well as save their addresses.Hi,
> > >>>> Verify that the pressure unit is either grams or newtons.
> > >>>> Mark the input device as a haptic touchpad if the unit is correct and
> > >>>> the reports are found.
> > >>>>  [...]
> > >>>> +config HID_HAPTIC
> > >>>> +  tristate "Haptic touchpad support"
> > >>>> +  default n
> > >>>> +  help
> > >>>> +  Support for touchpads with force sensors and haptic actuators instead of a
> > >>>> +  traditional button.
> > >>>> +  Adds extra parsing and FF device for the hid multitouch driver.
> > >>>> +  It can be used for Elan 2703 haptic touchpad.
> > >>>> +
> > >>>> +  If unsure, say N.
> > >>>> +
> > >>>>  menu "Special HID drivers"
> > >>>
> > >>> I suspect this change is related to a build error I ran into today:
> > >>>
> > >>>   MODPOST Module.symvers
> > >>> ERROR: modpost: "hid_haptic_init" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_pressure_increase" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_check_pressure_unit" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_input_configured" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_input_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_feature_mapping" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> ERROR: modpost: "hid_haptic_pressure_reset" [drivers/hid/hid-multitouch.ko] undefined!
> > >>> make[3]: *** [/home/thl/var/linux.dev/scripts/Makefile.modpost:147: Module.symvers] Error 1
> > >>>
> > >>> The config where this occurred had this:
> > >>>
> > >>> CONFIG_HID=y
> > >>> CONFIG_HID_MULTITOUCH=m
> > >>> CONFIG_HID_HAPTIC=m
> > >>>
> > >>> Changing the latter to "CONFIG_HID_HAPTIC=y" fixed the problem for me.
> > >>
> > >> Sure, but that's just covering up the problem.
> > >>> First, I get this build error:
> > >>
> > >> ERROR: modpost: missing MODULE_LICENSE() in drivers/hid/hid-haptic.o
> > >> WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-haptic.o
> > >>
> >
> > ISTM that tristate is incompatible with this newly added Makefile
> > line:
> >
> > +hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> >
> > hid-* lists files that should be builtin, not loadable modules.
> > These should all be hid-y.  AFAIK, hid-m is not useful.
> > (A maintainer can correct me as needed.)
> >
> > So adding a MODULE_LICENSE() and MODULE_DESCRIPTION() to
> > hid-haptic.c and changing drivers/hid/Makefile to use
> > obj-$(CONFIG_HID_HAPTIC_        += hid-haptic.o
> >
> > fixes the build errors for me.
> >
> > Angela, Jonathan D., is there any reason that
> > hid-haptic needs to be builtin instead of a loadable
> > module?  It's no problem for hid-multitouch.ko to call
> > into hid-haptic.ko (both as loadable modules) as long as
> > hid-haptic.ko is loaded first.
> >
> As long as hid-multitouch.ko is able to call into hid-haptic.ko I
> don't see any issues, but is there a way to enforce that when
> CONFIG_HID_HAPTIC is enabled, hid-haptic.ko will be loaded before
> hid-multitouch.ko?
> >
> > Thanks.
> >
> > ~Randy
> > ---
> > ---
> >  drivers/hid/hid-haptic.c |    3 +++
> >  1 file changed, 3 insertions(+)
> >
> > --- linux.orig/drivers/hid/hid-haptic.c
> > +++ linux/drivers/hid/hid-haptic.c
> > @@ -10,6 +10,9 @@
> >
> >  #include "hid-haptic.h"
> >
> > +MODULE_DESCRIPTION("HID haptic touchpad support");
> > +MODULE_LICENSE("GPL");
> > +
> >  void hid_haptic_feature_mapping(struct hid_device *hdev,
> >                                 struct hid_haptic_device *haptic,
> >                                 struct hid_field *field, struct hid_usage *usage)
> > ---
> >  drivers/hid/Makefile |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > --- linux.orig/drivers/hid/Makefile
> > +++ linux/drivers/hid/Makefile
> > @@ -4,7 +4,8 @@
> >  #
> >  hid-y                  := hid-core.o hid-input.o hid-quirks.o
> >  hid-$(CONFIG_DEBUG_FS)         += hid-debug.o
> > -hid-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> > +
> > +obj-$(CONFIG_HID_HAPTIC)       += hid-haptic.o
> >
> >  obj-$(CONFIG_HID_BPF)          += bpf/
> >
> >
> --
> Jonathan