Skip to content

Instantly share code, notes, and snippets.

@matt-allan
Last active November 3, 2017 16:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matt-allan/7cc74bf2457e972670ba to your computer and use it in GitHub Desktop.
Save matt-allan/7cc74bf2457e972670ba to your computer and use it in GitHub Desktop.
setup dragonrise controllers with crouton

To make dragonrise n64 and snes controllers work with my crouton xfce4/ubuntu chroot, I had to recompile the kernel with support for the hid_dr module. These are the steps to get the controllers working. Almost all steps are taken from the sources listed below. All commands are entered in the chroot's terminal, not the chronos shell.

sudo apt-get install git-core make kernel-package
cd ~
git clone https://chromium.googlesource.com/chromiumos/third_party/kernel -b chromeos-3.8
cd kernel
nano chromeos/config/base.config

type ctrl-w, type 'error_on_warning' and press enter to find the line you need to edit.

Change CONFIG_ERROR_ON_WARNING=y to CONFIG_ERROR_ON_WARNING=n

tpe ctrl-w. type 'dragonrise and press enter to find the next line:

change: #CONFIG_HID_DRAGONRISE is not set to: CONFIG_HID_DRAGONRISE=m

ctrl-x, y, and enter to save.

./chromeos/scripts/prepareconfig chromeos-intel-pineview

make oldconfig

When it prompts you about the controller just press enter.

make

once the kernel builds, create the rc.local at the crouton tutorial

nano /etc/rc.local

enter copy and paste w/ ctrl-shift-v then save.

sudo chmod +x /etc/rc.local

logout of the chroot and reboot.

cd ~/kernel

sudo make modules_install

sudo depmod -a

sudo chmod 0666 /sys/module/lsm/parameters/module_locking

echo 0 > /sys/module/lsm/parameters/module_locking

sudo insmod drivers/hid/hid-dr.ko

sudo modprobe hid_dir

Now plugin the controller, type dmesg, and the last line should look like this:

[21269.780448] dragonrise 0003:0079:0011.0007: input,hidraw0: USB HID v1.10 Joystick [USB Gamepad ] on usb-0000:00:14.0-8/input0

Now you can edit your rc.local to make controllers work on every reboot:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# unmount bindmounts /lib/modules from enter-chroot
for m in `cat /proc/mounts | /usr/bin/cut -d ' ' -f2 | grep /lib/modules| grep -v "^/$" `; do
        umount "$m"
done
echo 0

# disable module locking and try to load vboxdrv
if [ `find /lib/modules -name hid-dr.ko` ]; then
    chmod 0666 /sys/module/lsm/parameters/module_locking
    echo 0 > /sys/module/lsm/parameters/module_locking

    modprobe hid-dr

    i="0"
    while [ $i -lt 5 ]; do
        loaded=$( cat /proc/modules|grep -o hid_dr ) || loaded="empty"
        if [ "$loaded" = "hid_dr" ]; then
            break
        fi
        sleep 1
        i=$((i+1))
    done
    echo 1 > /sys/module/lsm/parameters/module_locking
    chmod 0400 /sys/module/lsm/parameters/module_locking
fi

exit 0

sudo chmod +x /etc/rc.local

##Sources:

https://github.com/dnschneid/crouton/wiki/Build-chrome-os-kernel-and-kernel-modules https://github.com/dnschneid/crouton/wiki/Build-kernel-headers-and-install-Virtualbox-(x86) http://askubuntu.com/questions/302729/cannot-get-usb-gamepad-to-work-in-ubuntu-12-04

Copy link

ghost commented Jun 6, 2017

Hello there! Thank you for posting this. I am currently trying to get a Dance Pad that is recognized as a DragonRise gamepad working under a trusty chroot on a Samsung 3 Chromebook. However, I am getting an error: I think the problem is that the kernel that I built the module with is different from the Kernel being used by my version of trusty? I am still a newb when it comes to Kernel modules though so I am not sure what to do. Here is my output:

sudo make modules_install
INSTALL arch/x86/crypto/ablk_helper.ko
INSTALL arch/x86/crypto/aes-x86_64.ko
INSTALL arch/x86/crypto/aesni-intel.ko
INSTALL arch/x86/kernel/test_nx.ko
INSTALL crypto/af_alg.ko
INSTALL crypto/algif_hash.ko
INSTALL crypto/algif_skcipher.ko
INSTALL crypto/ccm.ko
INSTALL crypto/cmac.ko
INSTALL crypto/cryptd.ko
INSTALL crypto/deflate.ko
INSTALL crypto/lrw.ko
INSTALL crypto/michael_mic.ko
INSTALL crypto/sha512_generic.ko
INSTALL crypto/xts.ko
INSTALL drivers/block/brd.ko
INSTALL drivers/block/virtio_blk.ko
INSTALL drivers/bluetooth/ath3k.ko
INSTALL drivers/bluetooth/bcm203x.ko
INSTALL drivers/bluetooth/bfusb.ko
INSTALL drivers/bluetooth/btbcm.ko
INSTALL drivers/bluetooth/btintel.ko
INSTALL drivers/bluetooth/btrtl.ko
INSTALL drivers/bluetooth/btusb.ko
INSTALL drivers/bluetooth/hci_vhci.ko
INSTALL drivers/cdrom/cdrom.ko
INSTALL drivers/firmware/google/memconsole.ko
INSTALL drivers/gpu/drm/cirrus/cirrus.ko
INSTALL drivers/gpu/drm/evdi/evdi.ko
INSTALL drivers/gpu/drm/ttm/ttm.ko
INSTALL drivers/hid/hid-apple.ko
INSTALL drivers/hid/hid-cherry.ko
INSTALL drivers/hid/hid-dr.ko
INSTALL drivers/hid/hid-logitech-dj.ko
INSTALL drivers/hid/hid-logitech-hidpp.ko
INSTALL drivers/hid/hid-logitech-wtp.ko
INSTALL drivers/hid/hid-logitech.ko
INSTALL drivers/hid/hid-magicmouse.ko
INSTALL drivers/hid/hid-microsoft.ko
INSTALL drivers/hid/hid-multitouch.ko
INSTALL drivers/hid/hid-plantronics.ko
INSTALL drivers/hid/hid-primax.ko
INSTALL drivers/hid/hid-quickstep.ko
INSTALL drivers/hid/hid-sony.ko
INSTALL drivers/hid/hid-wiimote.ko
INSTALL drivers/i2c/busses/i2c-piix4.ko
INSTALL drivers/i2c/i2c-dev.ko
INSTALL drivers/i2c/i2c-stub.ko
INSTALL drivers/iio/industrialio.ko
INSTALL drivers/input/joydev.ko
INSTALL drivers/input/joystick/iforce/iforce.ko
INSTALL drivers/input/joystick/xpad.ko
INSTALL drivers/input/misc/uinput.ko
INSTALL drivers/input/mouse/appletouch.ko
INSTALL drivers/input/serio/ct82c710.ko
INSTALL drivers/input/serio/pcips2.ko
INSTALL drivers/input/serio/serport.ko
INSTALL drivers/input/sparse-keymap.ko
INSTALL drivers/input/tablet/wacom.ko
INSTALL drivers/input/touchscreen/usbtouchscreen.ko
INSTALL drivers/media/platform/vivi.ko
INSTALL drivers/media/usb/uvc/uvcvideo.ko
INSTALL drivers/media/v4l2-core/videobuf2-core.ko
INSTALL drivers/media/v4l2-core/videobuf2-memops.ko
INSTALL drivers/media/v4l2-core/videobuf2-vmalloc.ko
INSTALL drivers/mfd/rtsx_pci.ko
INSTALL drivers/misc/eeprom/eeprom_93cx6.ko
INSTALL drivers/mmc/card/mmc_block.ko
INSTALL drivers/mmc/card/mmc_test.ko
INSTALL drivers/mmc/core/mmc_core.ko
INSTALL drivers/mmc/host/rtsx_pci_sdmmc.ko
INSTALL drivers/mmc/host/sdhci-pci.ko
INSTALL drivers/mmc/host/sdhci.ko
INSTALL drivers/net/ethernet/broadcom/tg3.ko
INSTALL drivers/net/ethernet/intel/e100.ko
INSTALL drivers/net/ethernet/intel/e1000/e1000.ko
INSTALL drivers/net/ethernet/intel/e1000e/e1000e.ko
INSTALL drivers/net/ethernet/intel/igbvf/igbvf.ko
INSTALL drivers/net/ethernet/jme.ko
INSTALL drivers/net/ethernet/realtek/r8169.ko
INSTALL drivers/net/ppp/ppp_async.ko
INSTALL drivers/net/ppp/ppp_generic.ko
INSTALL drivers/net/slip/slhc.ko
INSTALL drivers/net/tun.ko
INSTALL drivers/net/usb/asix.ko
INSTALL drivers/net/usb/ax88179_178a.ko
INSTALL drivers/net/usb/cdc_ether.ko
INSTALL drivers/net/usb/cdc_ncm.ko
INSTALL drivers/net/usb/dm9601.ko
INSTALL drivers/net/usb/mcs7830.ko
INSTALL drivers/net/usb/net1080.ko
INSTALL drivers/net/usb/pegasus.ko
INSTALL drivers/net/usb/r8152.ko
INSTALL drivers/net/usb/rndis_host.ko
INSTALL drivers/net/usb/rtl8150.ko
INSTALL drivers/net/usb/smsc75xx.ko
INSTALL drivers/net/usb/smsc95xx.ko
INSTALL drivers/net/usb/usbnet.ko
INSTALL drivers/net/veth.ko
INSTALL drivers/net/virtio_net.ko
INSTALL drivers/net/wireless/ath/ath.ko
INSTALL drivers/net/wireless/ath/ath5k/ath5k.ko
INSTALL drivers/net/wireless/ath/ath9k/ath9k.ko
INSTALL drivers/net/wireless/ath/ath9k/ath9k_common.ko
INSTALL drivers/net/wireless/ath/ath9k/ath9k_hw.ko
INSTALL drivers/net/wireless/hostap/hostap.ko
INSTALL drivers/net/wireless/hostap/hostap_pci.ko
INSTALL drivers/net/wireless/hostap/hostap_plx.ko
INSTALL drivers/net/wireless/iwl7000/iwlwifi/iwlwifi.ko
INSTALL drivers/net/wireless/iwl7000/iwlwifi/mvm/iwlmvm.ko
INSTALL drivers/net/wireless/iwl7000/iwlwifi/xvt/iwlxvt.ko
INSTALL drivers/net/wireless/iwl7000/mac80211/iwl7000_mac80211.ko
INSTALL drivers/net/wireless/libertas_tf/libertas_tf.ko
INSTALL drivers/net/wireless/libertas_tf/libertas_tf_usb.ko
INSTALL drivers/net/wireless/mac80211_hwsim.ko
INSTALL drivers/net/wireless/mwifiex/mwifiex.ko
INSTALL drivers/net/wireless/mwifiex/mwifiex_pcie.ko
INSTALL drivers/net/wireless/rndis_wlan.ko
INSTALL drivers/net/wireless/rt2x00/rt2800lib.ko
INSTALL drivers/net/wireless/rt2x00/rt2800pci.ko
INSTALL drivers/net/wireless/rt2x00/rt2800usb.ko
INSTALL drivers/net/wireless/rt2x00/rt2x00lib.ko
INSTALL drivers/net/wireless/rt2x00/rt2x00pci.ko
INSTALL drivers/net/wireless/rt2x00/rt2x00usb.ko
INSTALL drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
INSTALL drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
INSTALL drivers/net/wireless/rtlwifi/rtlwifi.ko
INSTALL drivers/platform/x86/dell-wmi.ko
INSTALL drivers/platform/x86/hp-wmi.ko
INSTALL drivers/platform/x86/intel_menlow.ko
INSTALL drivers/platform/x86/wmi.ko
INSTALL drivers/pps/pps_core.ko
INSTALL drivers/ptp/ptp.ko
INSTALL drivers/scsi/sr_mod.ko
INSTALL drivers/spi/spi-bitbang.ko
INSTALL drivers/staging/iio/light/isl29018.ko
INSTALL drivers/staging/iio/light/tsl2563.ko
INSTALL drivers/staging/iio/light/tsl2583.ko
INSTALL drivers/staging/zram/zram.ko
INSTALL drivers/staging/zsmalloc/zsmalloc.ko
INSTALL drivers/usb/misc/ezusb.ko
INSTALL drivers/usb/serial/ch341.ko
INSTALL drivers/usb/serial/cp210x.ko
INSTALL drivers/usb/serial/ftdi_sio.ko
INSTALL drivers/usb/serial/keyspan.ko
INSTALL drivers/usb/serial/option.ko
INSTALL drivers/usb/serial/oti6858.ko
INSTALL drivers/usb/serial/pl2303.ko
INSTALL drivers/usb/serial/qcserial.ko
INSTALL drivers/usb/serial/sierra.ko
INSTALL drivers/usb/serial/usb_wwan.ko
INSTALL fs/fat/fat.ko
INSTALL fs/fat/vfat.ko
INSTALL fs/fuse/fuse.ko
INSTALL fs/hfsplus/hfsplus.ko
INSTALL fs/isofs/isofs.ko
INSTALL fs/nls/nls_ascii.ko
INSTALL fs/nls/nls_cp437.ko
INSTALL fs/nls/nls_iso8859-1.ko
INSTALL fs/nls/nls_utf8.ko
INSTALL fs/udf/udf.ko
INSTALL kernel/configs.ko
INSTALL kernel/test_module.ko
INSTALL kernel/time/udelay_test.ko
INSTALL lib/crc-itu-t.ko
INSTALL lib/crc-t10dif.ko
INSTALL lib/crc7.ko
INSTALL lib/libcrc32c.ko
INSTALL lib/zlib_deflate/zlib_deflate.ko
INSTALL net/802/p8022.ko
INSTALL net/802/psnap.ko
INSTALL net/802/stp.ko
INSTALL net/bluetooth/bluetooth.ko
INSTALL net/bluetooth/hidp/hidp.ko
INSTALL net/bluetooth/rfcomm/rfcomm.ko
INSTALL net/bridge/bridge.ko
INSTALL net/ipv4/ah4.ko
INSTALL net/ipv4/esp4.ko
INSTALL net/ipv4/ipcomp.ko
INSTALL net/ipv4/netfilter/ipt_MASQUERADE.ko
INSTALL net/ipv4/netfilter/iptable_nat.ko
INSTALL net/ipv4/netfilter/nf_nat_ipv4.ko
INSTALL net/ipv4/tcp_lp.ko
INSTALL net/ipv4/tunnel4.ko
INSTALL net/ipv4/xfrm4_mode_beet.ko
INSTALL net/ipv4/xfrm4_mode_transport.ko
INSTALL net/ipv4/xfrm4_mode_tunnel.ko
INSTALL net/ipv4/xfrm4_tunnel.ko
INSTALL net/ipv6/ah6.ko
INSTALL net/ipv6/esp6.ko
INSTALL net/ipv6/netfilter/ip6_tables.ko
INSTALL net/ipv6/netfilter/ip6t_MASQUERADE.ko
INSTALL net/ipv6/netfilter/ip6t_REJECT.ko
INSTALL net/ipv6/netfilter/ip6t_ipv6header.ko
INSTALL net/ipv6/netfilter/ip6table_filter.ko
INSTALL net/ipv6/netfilter/ip6table_mangle.ko
INSTALL net/ipv6/netfilter/ip6table_nat.ko
INSTALL net/ipv6/netfilter/nf_conntrack_ipv6.ko
INSTALL net/ipv6/netfilter/nf_defrag_ipv6.ko
INSTALL net/ipv6/netfilter/nf_nat_ipv6.ko
INSTALL net/ipv6/sit.ko
INSTALL net/ipv6/xfrm6_mode_beet.ko
INSTALL net/ipv6/xfrm6_mode_transport.ko
INSTALL net/ipv6/xfrm6_mode_tunnel.ko
INSTALL net/key/af_key.ko
INSTALL net/llc/llc.ko
INSTALL net/mac80211/mac80211.ko
INSTALL net/netfilter/nf_nat.ko
INSTALL net/netfilter/xt_TCPMSS.ko
INSTALL net/netfilter/xt_mark.ko
INSTALL net/netfilter/xt_nat.ko
INSTALL net/sched/cls_u32.ko
INSTALL net/sched/sch_codel.ko
INSTALL net/sched/sch_fq_codel.ko
INSTALL net/sched/sch_htb.ko
INSTALL net/sched/sch_ingress.ko
INSTALL net/wireless/cfg80211.ko
INSTALL net/wireless/lib80211.ko
INSTALL net/wireless/lib80211_crypt_ccmp.ko
INSTALL net/wireless/lib80211_crypt_tkip.ko
INSTALL net/wireless/lib80211_crypt_wep.ko
INSTALL net/xfrm/xfrm_ipcomp.ko
INSTALL sound/core/seq/snd-seq-device.ko
INSTALL sound/core/seq/snd-seq-dummy.ko
INSTALL sound/core/seq/snd-seq-midi-event.ko
INSTALL sound/core/seq/snd-seq-midi.ko
INSTALL sound/core/seq/snd-seq.ko
INSTALL sound/core/snd-hrtimer.ko
INSTALL sound/core/snd-hwdep.ko
INSTALL sound/core/snd-page-alloc.ko
INSTALL sound/core/snd-pcm.ko
INSTALL sound/core/snd-rawmidi.ko
INSTALL sound/core/snd-timer.ko
INSTALL sound/pci/hda/snd-hda-codec-analog.ko
INSTALL sound/pci/hda/snd-hda-codec-ca0110.ko
INSTALL sound/pci/hda/snd-hda-codec-ca0132.ko
INSTALL sound/pci/hda/snd-hda-codec-cirrus.ko
INSTALL sound/pci/hda/snd-hda-codec-cmedia.ko
INSTALL sound/pci/hda/snd-hda-codec-conexant.ko
INSTALL sound/pci/hda/snd-hda-codec-hdmi.ko
INSTALL sound/pci/hda/snd-hda-codec-idt.ko
INSTALL sound/pci/hda/snd-hda-codec-realtek.ko
INSTALL sound/pci/hda/snd-hda-codec-si3054.ko
INSTALL sound/pci/hda/snd-hda-codec-via.ko
INSTALL sound/pci/hda/snd-hda-codec.ko
INSTALL sound/pci/hda/snd-hda-intel.ko
INSTALL sound/usb/snd-usb-audio.ko
INSTALL sound/usb/snd-usbmidi-lib.ko
DEPMOD 3.8.11
(chromeos-3.8 *) kernel $ sudo depmod -a
(chromeos-3.8 *) kernel $ sudo insmod drivers/hid/hid-dr.ko
insmod: ERROR: could not insert module drivers/hid/hid-dr.ko: Invalid module format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment