rpi continued

4. Get the module source

# You should still be root after the chroot command
cd /
git clone git://gitorious.org/hid-aureal-kernel-module/hid-aureal-kernel-module.git

5. Prep for adding a new module

Copy the module source into the driver directory. I decided to put in it in the directory that seemed to be similar. Note the use of the wildcard in “raspberrypi-linux*”.  The trailing letters seem to change occassionally.

cd raspberrypi-linux-*/drivers/hid/usbhid/
cp /hid-aureal-kernel-module/aureal-id.h .
cp /hid-aureal-kernel-module/hid-aureal.c .

Edit the kernel configuration to include this new module.

nano Kconfig

Under these lines:

comment "USB Input Devices"
        depends on USB

Add the following text

config HID_AUREAL
        tristate "Aureal fix"
        default m
        help
          Aureal fix

Edit the Makefile

nano Makefile

At the end of the file add:

obj-$(CONFIG_HID_AUREAL)        += hid-aureal.o

6. Configure kernel

# The following needs to be done once
apt-get install libncurses5-dev
# Start the configuration menu
cd /raspberrypi-linux-*
make ARCH=arm menuconfig

You will be given a menu selection with a bunch of options. Go to “Device Drivers” -> “HID Devices”. You should see an “M” next to “Aureal fix”.

Select “USB Human Interface Device (full HID) support” and hit the “m” key so that “M” is shown next to this option also.

Exit out of the menu and make sure to save the configuration.

7. Rebuild

I’ve uploaded a modified version of the build script that will rebuild the kernel and regenerate the output.

cd /
wget http://kaytat.com/rebuild.sh
sh rebuild.sh

8. Install the new kernel onto the rpi

Copy the output to the pi using scp

# You should still be root after the chroot command
cd /
scp kernel-*.gz pi@192.168.3.14:/home/pi

You will need to modify 192.168.3.14 to the IP address of the rpi. This command will ask for a password. It’s “raspberry”.

SSH into the pi and install. I use Putty for SSH. The username is pi and password is the same as above. Then run:

sudo -s
cd /
tar -xzf /home/pi/kernel-rootfs-latest-hardfp.tar.gz
cd boot
tar -xzf /home/pi/kernel-vfat-latest-hardfp.tar.gz
nano /etc/rc.local

Near the very end, just before “exit 0” add the following lines:

/sbin/rmmod usbhid || true
/sbin/modprobe hid-aureal || true
/sbin/modprobe usbhid || true

The “|| true” is necessary due to the -e switch in #!/bin/sh. Save the file and then reboot.  This is actually the main part of this whole exercise.  I did all this so that I could make kernel modules and then be able to unload them, and then reload them in the proper order.

reboot

That should be it.

9. Verify

On the pi, run

dmesg

You should see

aureal 0003:0755:2626.0001: fixing Aureal Cy se W-01RN USB_V3.1 report descriptor. Keyboard Logical Maximum = 101

The key is the “fixing” part since that word comes from the module we built.