gotzl / hid-fanatecff

Driver to support FANATEC input devices, in particular ForceFeedback of various wheel-bases
GNU General Public License v2.0
151 stars 19 forks source link

Question: After Kernel Update run "make && make install" #49

Closed liszca closed 5 months ago

liszca commented 7 months ago

If I observed correctly my wheels forcefeedback stops working after kernel update. To fix it I have to run "make && make install" again, so far so good. Is it possible to have the system compile the code directly after a Kernel update and install it again?

gotzl commented 7 months ago

Yes, it is possible with DKMS. I personally don't use it, but @mcoffin has already created a package for ArchLinux using DKMS. This should work for other distros too. If your adventurous, feel free to play around with it ;) I'm not sure when I find the time for this ..

liszca commented 7 months ago

Yes, it is possible with DKMS. I personally don't use it, but @mcoffin has already created a package for ArchLinux using DKMS. This should work for other distros too. If your adventurous, feel free to play around with it ;) I'm not sure when I find the time for this ..

I completly forgot about DKMS.

Found a solution to trigger the "make && make install" command just after "update-grub" got triggered. Under Ubuntu 23.10 files for that are under "/etc/kernel/postinst.d".

There I appended "&& sudo -u liszca make -C /usr/src/Git/hid-fanatecff && make install -C /usr/src/Git/hid-fanatecff" to a specific line as can be seen in the following code.

#! /bin/sh
set -e

command -v update-grub >/dev/null || exit 0

if type systemd-detect-virt >/dev/null 2>&1 &&
   systemd-detect-virt --quiet --container; then
        exit 0
fi

set -- $DEB_MAINT_PARAMS
mode="${1#\'}"
mode="${mode%\'}"
case $0:$mode in
    # Only run on postinst configure and postrm remove, to avoid wasting
    # time by calling update-grub multiple times on upgrade and removal.
    # Also run if we have no DEB_MAINT_PARAMS, in order to work with old
    # kernel packages.
    */postinst.d/*:|*/postinst.d/*:configure|*/postrm.d/*:|*/postrm.d/*:remove)
        if [ -e /boot/grub/grub.cfg ]; then
                exec update-grub && sudo -u liszca make -C /usr/src/Git/hid-fanatecff && make install -C /usr/src/Git/hid-fanatecff && udevadm control --reload-rules && udevadm trigger
        fi
        ;;
esac

exit 0

I am not sure if it is necessary to do "make clean" or when that has to be done.

For preparation of the source I did:

sudo mkdir -p /usr/src/Git && chown -R liszca:liscza
git clone https://github.com/gotzl/hid-fanatecff.git

So I can change the code just with my local user.

SynthetikzZ commented 6 months ago

awsome i will implement this rightaway. also thank you gotzl for the friction inertia update <3

ciscoyo commented 6 months ago

yea.. im just to noobish for this and way to sacred wrecking my system with this.. xD

i always just delete the hid-fanatecff folder in /home/user/hid-fanatecff and than do the install again with the terminal commands git clone https://github.com/gotzl/hid-fanatecff.git -> cd hid-fanatecff -> make -> sudo make install .. am i doing it wrong/does this even work correctly? xD

SynthetikzZ commented 6 months ago

yea.. im just to noobish for this and way to sacred wrecking my system with this.. xD

i always just delete the hid-fanatecff folder in /home/user/hid-fanatecff and than do the install again with the terminal commands git clone https://github.com/gotzl/hid-fanatecff.git -> cd hid-fanatecff -> make -> sudo make install .. am i doing it wrong/does this even work correctly? xD

If there are no updates to the driver, you dont have to pull the repo everytime. Doing make and sudo make install is enough.

Myself has to rebuild initram after that too so driver gets loaded after reboot.

liszca commented 6 months ago

yea.. im just to noobish for this and way to sacred wrecking my system with this.. xD

i always just delete the hid-fanatecff folder in /home/user/hid-fanatecff and than do the install again with the terminal commands git clone https://github.com/gotzl/hid-fanatecff.git -> cd hid-fanatecff -> make -> sudo make install .. am i doing it wrong/does this even work correctly? xD

Not Sure what is missing, but have you tried to reload UDEV rules after sudo make install? sudo bash -c 'udevadm control --reload-rules && udevadm trigger'