Closed OBrezhniev closed 7 years ago
This line:
modprobe: FATAL: Module hid_generic is builtin
means that the hid_generic module has been built in to your kernel. So the modprobe -r
command won't work. Instead you'll need to manually unbind the device from the hid_generic
driver and then bind it to the new hid-asus-fte
driver.
You should be able to do that with the following commands:
sudo bash -c 'echo 0018:0B05:0101.0003 > /sys/bus/hid/drivers/hid-generic/unbind'
sudo bash -c 'echo 0018:0B05:0101.0003 > /sys/bus/hid/drivers/hid-asus-fte/bind'
Thanks @redmcg, that works! I only had to change id string to 0018:0B05:0101.0007. How can I make it persistent?
I'm not 100% sure (as I haven't tested with hid_generic
compiled in to the kernel) but if you add the module to your initrd
- I'm hoping the kernel will pick it first.
I haven't used Fedora but I think you can use dracut
to add a module. During my research I found this:
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#_adding_kernel_modules
So I think the command would be:
dracut -fv --add-drivers hid-asus-fte
but you might know better than I do!
@OBrezhniev How's it going? Are you happy for us to close this issue?
We've created a new issue (#16) to address the errors you saw in your log so I just want to make sure this is working for you with hid_generic
compiled in to the kernel.
I tried adding driver to initrd with dracut, but it doesn't make kernel choose hid-asus-fte.
I can create init script to rebind device, but may be you know a better way.
I've just modified the dkms.conf
in my fork of this repo. You can find it here: https://github.com/redmcg/hid-asus-fte-dkms
Instead of unloading the hid_generic
module (which won't work in your setup) it tries to unbind the device from its current driver before loading the new module.
If you like you can try cloning from my repo and running dkms-add.sh
. Let me know if this resolves the issue.
No, it doesn't work for me again. Tomorrow I'll try to write udev rule using your script from dkms.conf
(when I run it in bash it works fine):
sudo bash -c "modprobe -r hid_asus_fte; dev=\`find /sys/bus/hid/drivers/ -name '*:0B05:0101.*' 2> /dev/null\` && [ q\$dev != q ] && echo \`basename \$dev\` > \`dirname \$dev\`/unbind; modprobe -i hid_asus_fte"
@OBrezhniev Could you try to update the driver from source: https://github.com/vlasenko/hid-asus-dkms#user-content-updating-to-the-latest-driver-version
There were some changes added to drop modprobe hacks and use module.alias instead for the device
Ok, I'll try in a few hours.
@vlasenko I've updated, but ./dkms-add.sh failed as I already have hid-asus
module bundled with fedora kernel and modprobe hid-asus
loads it.
Will try revision before refactoring.
@OBrezhniev Actually it is valid for DKMS to replace modules with the same name. Why do you think it fails? Is there any indication in dmesg that hid-generic is used for the device instead of hid-asus?
How do you know the wrong hid-asus has been picked up?
With build of e3f9616 I get:
$ dmesg | grep -i hid
[ 1.023195] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.023221] usbcore: registered new interface driver usbhid
[ 1.023221] usbhid: USB HID core driver
[ 2.292463] hid-generic 0003:0458:0185.0001: hiddev0,hidraw0: USB HID v1.10 Device [MOSART Semi. Wireless Mouse] on usb-0000:00:14.0-6/input0
[ 2.348221] hid-generic 0003:0458:0185.0002: input,hiddev0,hidraw1: USB HID v1.10 Mouse [MOSART Semi. Wireless Mouse] on usb-0000:00:14.0-6/input1
[ 4.246217] hid_asus_fte: loading out-of-tree module taints kernel.
[ 4.257678] hid_asus_fte: module verification failed: signature and/or required key missing - tainting kernel
[ 9.716301] i2c_hid i2c-FTE1001:00: failed to reset device.
[ 10.761558] i2c_hid i2c-FTE1001:00: error in i2c_hid_init_report size:633 / ret_size:0
[ 10.764991] i2c_hid i2c-FTE1001:00: error in i2c_hid_init_report size:131 / ret_size:0
[ 10.765959] hid-generic 0018:0B05:0101.0003: input,hidraw2: I2C HID v1.00 Mouse [FTE1001:00 0B05:0101] on i2c-FTE1001:00
Same thing on master:
$ dmesg | grep hid
[ 1.021255] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.021281] usbcore: registered new interface driver usbhid
[ 1.021281] usbhid: USB HID core driver
[ 2.284196] hid-generic 0003:0458:0185.0001: hiddev0,hidraw0: USB HID v1.10 Device [MOSART Semi. Wireless Mouse] on usb-0000:00:14.0-6/input0
[ 2.339602] hid-generic 0003:0458:0185.0002: input,hiddev0,hidraw1: USB HID v1.10 Mouse [MOSART Semi. Wireless Mouse] on usb-0000:00:14.0-6/input1
[ 4.252223] hid_asus: loading out-of-tree module taints kernel.
[ 4.284591] hid_asus: module verification failed: signature and/or required key missing - tainting kernel
[ 9.715658] i2c_hid i2c-FTE1001:00: failed to reset device.
[ 10.760849] i2c_hid i2c-FTE1001:00: error in i2c_hid_init_report size:633 / ret_size:0
[ 10.764250] i2c_hid i2c-FTE1001:00: error in i2c_hid_init_report size:131 / ret_size:0
[ 10.765174] hid-generic 0018:0B05:0101.0003: input,hidraw2: I2C HID v1.00 Mouse [FTE1001:00 0B05:0101] on i2c-FTE1001:00
Previous time I haven't tried to reboot because of an error message from ./dkms-add.sh
like this:
...
DKMS: install completed.
Rebinding 0018:0B05:0101.0005 to hid-asus
sh: line 0: echo: write error: No such device
sh: line 0: echo: write error: No such device
I had checked /sys/bus/hid/drivers/hid-asus/bind - and it hadn't existed, because of bundled hid-asus was loaded.
In both cases running ./dev-attach.sh
after reboot rebinds device successfully.
Yes, I'm not sure we can solve this in DKMS driver. We are not aware of reliable way to specify on boot that "hid-asus" should be used for device and not "hid-generic". Current way of trying to catch device early using ACPI ID: "FTE1*" does not guarantee that the device will be attached to our driver. When this code will be submitted into Linux kernel we will modify hid core as well and flag that the device has special driver, so that hid core don't load hid-generic for the device.
So for your case the only work around we can propose for DKMS driver is manually rebinding the driver for now after boot.
If you happen to find another solution, please let us know.
Thanks
@OBrezhniev
Can you please try the following udev rule:
ACTION=="add" ENV{MODALIAS}=="hid:b0018g0001v00000B05p00000101", RUN+="/bin/sh -c 'modprobe -i hid-asus; D=`basename %p`; echo $D > /sys/bus/hid/drivers/hid-generic/unbind; echo $D > /sys/bus/hid/drivers/hid-asus/bind'"
I tested this in a file called:
/etc/udev/rules.d/41-hid-asus.rules
I tested the above rule with a number of different kernel configurations and it worked for all except when the pre-existing hid-asus.c
(the current asus driver that supports just keyboard) was compiled in to the kernel. This was because modprobe
didn't work - but insmod
did. So I changed the rule to be:
ACTION=="add" ENV{MODALIAS}=="hid:b0018g0001v00000B05p00000101", RUN+="/bin/sh -c 'kname=`uname -r`; insmod `find /lib/modules/$kname -name hid-asus.ko ! -wholename /lib/modules/$kname/kernel/drivers/hid/hid-asus.ko`; D=`basename %p`; echo $D > /sys/bus/hid/drivers/hid-generic/unbind; echo $D > /sys/bus/hid/drivers/hid-asus/bind'"
This worked for all kernel configs I tested.
@vlasenko I've made a commit to my fork which creates a udev file with the above content when you run dkms-add.sh
(and removes it on dkms-remove.sh
). Let me know if you want me to push it here.
@redmcg Great! Brendan, push it here as well, please.
@vlasenko Done. Note that I removed the MODULE_ALIAS
declaration - just because it shouldn't be needed with the udev rule and it makes the DKMS pretty much the same as what we plan submit to the kernel. I'm happy for it to be added back if you find its needed though.
@redmcg Yes, sure, I think MODULE_ALIAS is not needed, when udev rule is used. Thanks!
Thanks @redmcg, @vlasenko for your great work! Now everything works super fine!
That's great to hear! Thanks for helping us test.
Hi, I'm running Fedora 24 on Asus Zenbook Pro UX501VW. There are some errors on driver load.
Let me know if you need more debug info.