robbi5/magictrackpad2-dkms

Confused with the instructions in "How to update" section of doc

D12EA177E12 opened this issue · 1 comments

The instruction says:

Extract following files to src/bcm5974...:

  • /linux-source-4.4.0/drivers/input/mouse/bcm5974.c

Extract following files to src/hid...:

  • /linux-source-4.4.0/drivers/hid/hid-apple.c
  • /linux-source-4.4.0/drivers/hid/hid-core.c
  • /linux-source-4.4.0/drivers/hid/hid-debug.c
  • /linux-source-4.4.0/drivers/hid/hid-ids.h
  • /linux-source-4.4.0/drivers/hid/hid-input.c
  • /linux-source-4.4.0/drivers/hid/hidraw.c

Why would I want to replace your drivers with those shipped with the kernel source?
I don't understand; aren't these instructions for updating to newer versions of your dkms package?

This is how I made it work on my system (Linux Mate based on Ubuntu 16.04, 4.4.0-128-generic ).
I take no responsibility for any negative side effect on your system. Use at your own risk (or, as intended, to develop your own steps).

  1. installed the kernel sources (as instructed)

  2. cd'ed into the directory containing the HID sources
    cd (where you unzipped the driver file)/magictrackpad2-dkms-master/usr/src/hid-4.4+magictrackpad2

  3. extracted the original driver sources, as we have to recompile it with the changes that make the magictrackpad work
    tar xvf /usr/src/linux-source-4.4.0/linux-source-4.4.0.tar.bz2 linux-source-4.4.0/drivers/hid/hid-apple.c
    tar xvf /usr/src/linux-source-4.4.0/linux-source-4.4.0.tar.bz2 linux-source-4.4.0/drivers/hid/hid-core.c
    tar xvf /usr/src/linux-source-4.4.0/linux-source-4.4.0.tar.bz2 linux-source-4.4.0/drivers/hid/hid-ids.h
    Please note: I have only provided the tar commands for those files for which I found a difference
    between the .orig files and the corresponding driver source files

  4. create diff files
    the patched magitrack driver zip bundle does not include diff files for the hid-related source files,
    so I had to create them myself:
    diff hid-apple.c.orig hid-apple.c > hid-apple.c.diff
    diff hid-core.c.orig hid-core.c > hid-core.c.diff
    diff hid-ids.h.orig hid-ids.h > hid-ids.h.diff
    Please note: these diff files are based on the files that come with magictrackpad2-dkms-master.zip

  5. copy the kernel files extracted in step 3) into the current directory (where you unzipped the driver file)/magictrackpad2-dkms-master/usr/src/hid-4.4+magictrackpad2
    cp linux-source-4.4.0/drivers/hid/hid-apple.c .
    cp linux-source-4.4.0/drivers/hid/hid-core.c .
    cp linux-source-4.4.0/drivers/hid/hid-ids.h .

  6. patch the kernel src files
    patch -b hid-apple.c hid-apple.c.diff
    patch -b hid-core.c hid-core.c.diff
    patch -b hid-ids.h hid-ids.h.diff

  7. uninstall the previous version
    sudo dpkg -r magictrackpad2-dkms

  8. build the new driver
    cd (where you unzipped the driver file)/magictrackpad2-dkms-master
    make
    watch out for errors...

  9. install the driver
    cd build
    sudo dpkg -i magictrackpad2-dkms_1.0.0_all.deb
    watch out for errors
    reboot