Closed johnjelinek closed 8 years ago
Do you have your kernel headers installed?
I don't. :laughing: oy vey
ok, I installed the kernel headers, next error:
$ make
make -C /lib/modules/4.1.13-v7+/build M=/home/pi/steamcontroller-linux-kernel modules
make[1]: Entering directory '/usr/src/linux-headers-4.1.13-v7+'
CC [M] /home/pi/steamcontroller-linux-kernel/hid-valve-sc.o
./scripts/recordmcount: 1: ./scripts/recordmcount: Syntax error: end of file unexpected
scripts/Makefile.build:264: recipe for target '/home/pi/steamcontroller-linux-kernel/hid-valve-sc.o' failed
make[2]: *** [/home/pi/steamcontroller-linux-kernel/hid-valve-sc.o] Error 2
Makefile:1384: recipe for target '_module_/home/pi/steamcontroller-linux-kernel' failed
make[1]: *** [_module_/home/pi/steamcontroller-linux-kernel] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.1.13-v7+'
Makefile:9: recipe for target 'default' failed
make: *** [default] Error 2
oh -- it didn't cross-compile correctly:
$ file /usr/src/linux-headers-4.1.13-v7+/scripts/recordmcount
/usr/src/linux-headers-4.1.13-v7+/scripts/recordmcount: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=b9ffd83129e7b1c8fe5548ecf587b1b1cf0e632b, not stripped
I'm not quite sure how to do this right.
I don't. :laughing: oy vey
That looks complicated. This is a small module and you should be able to compile it directly on the raspberry pi. And if raspbian works like any debian, downloading the kernel-headers package should be enough.
If you are cross-compiling a simple "make" won't work as it uses the source from the current loaded kernel. Use something like make KERNELDIR=/path/to/raspbian/kernel/source
(plus your cross-compile options) to specify which source to use.
Edit: or use the PREFIX = /home/[USER]/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi- make ARCH=arm CROSS_COMPILE=$(PREFIX) -C /home/[USER]/linux M=$(SRC) modules
from your guide, it should work better. Otherwise you need to edit my Makefile since it does not pass the ARCH and CROSS_COMPILE variables.
The raspberry pi firmware and such is proprietary, so you can grab the headers from apt-get.
— Sent from Mailbox
On Thu, Jan 21, 2016 at 9:13 AM, Clément Vuchener notifications@github.com wrote:
I don't. :laughing: oy vey That looks complicated. This is a small module and you should be able to compile it directly on the raspberry pi. And if raspbian works like any debian, downloading the kernel-headers package should be enough.
If you are cross-compiling a simple "make" won't work as it uses the source from the current loaded kernel. Use something like
make KERNELDIR=/path/to/raspbian/kernel/source
to specify which source to use.Reply to this email directly or view it on GitHub: https://github.com/cvuchener/steamcontroller-linux-kernel/issues/2#issuecomment-173601795
and I'm cross-compiling because I don't want to wait 2 hours for the build to finish
— Sent from Mailbox
On Thu, Jan 21, 2016 at 9:13 AM, Clément Vuchener notifications@github.com wrote:
I don't. :laughing: oy vey That looks complicated. This is a small module and you should be able to compile it directly on the raspberry pi. And if raspbian works like any debian, downloading the kernel-headers package should be enough.
If you are cross-compiling a simple "make" won't work as it uses the source from the current loaded kernel. Use something like
make KERNELDIR=/path/to/raspbian/kernel/source
to specify which source to use.Reply to this email directly or view it on GitHub: https://github.com/cvuchener/steamcontroller-linux-kernel/issues/2#issuecomment-173601795
I looked a little into it and I understand that the linux-headers package does not exist because the kernel comes from the raspberry pi foundation and they don't have the knowledge or manpower to make the package.
I guess that you are stuck with this method then. You may prefer to use a user space driver, I am not sure this driver is worth all the effort. I actually wrote a kernel driver because it was easier (in my situation) for quickly testing my understanding of the protocol.
:sob: it's building.
after 14 hours, I've got a deb
of the linux headers. I was able to run make and make install. I installed the 90-valve-sc.rules
to /etc/udev/rules.d/90-valve-sc.rules
(the path would be helpful in the README) and ran sudo udevadm control --reload
. Unfortunately, without xbox driver emulation, like https://github.com/ynsta/steamcontroller/blob/master/scripts/sc-xbox.py, the driver doesn't work in EmulationStation for the Raspberry Pi. Also, evtest
didn't really verify for me that everything was working. I guess I'll go back to the other driver for now.
Also, evtest didn't really verify for me that everything was working. I guess I'll go back to the other driver for now.
Did the input device exist? Any message in the kernel log?
Ya, the input device was in lsusb
. How do I check the kernel logs?
— Sent from Mailbox
On Sat, Jan 23, 2016 at 3:20 AM, Clément Vuchener notifications@github.com wrote:
Also, evtest didn't really verify for me that everything was working. I guess I'll go back to the other driver for now.
Did the input device exist? Any message in the kernel log?
Reply to this email directly or view it on GitHub: https://github.com/cvuchener/steamcontroller-linux-kernel/issues/2#issuecomment-174165337
Ya, the input device was in
lsusb
.
lsusb list usb devices not input devices. Use evtest.
Example for my laptop:
$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Sleep Button
/dev/input/event2: Lid Switch
/dev/input/event3: Power Button
/dev/input/event4: AT Translated Set 2 keyboard
/dev/input/event5: ETPS/2 Elantech Touchpad
/dev/input/event6: Video Bus
/dev/input/event7: Video Bus
/dev/input/event8: Chicony USB 2.0 Camera
/dev/input/event9: HDA Intel PCH Mic
/dev/input/event10: HDA Intel PCH Headphone
/dev/input/event11: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12: Valve Software Steam Controller
/dev/input/event13: Valve Software Steam Controller (FC54924F54)
12 is the global mouse/keyboard device from the receiver, it works with generic HID and is not managed by my driver, the wired controller has two separate devices for mouse and keyboard and you should ignore them as well.
13 (the one with the serial in its name) is the connected controller exposed as a gamepad. Since it is a gamepad event13 should be readable as a non-root user, but it is better to start testing as root in case something went wrong with the permissions.
How do I check the kernel logs?
dmesg
or journalctl -k
. Look for lines with "valve-sc".
It may help to add #define DEBUG
in hid-valve-sc.c before the #include
lines and recompile the module.
And also enabling debug printing in the kernel with the command sudo sysctl kernel.printk=7
. Although errors should be printed without that.
hrmm ... yesterday it was showing up in evtest as event0
, but today it's not even showing up.
$ lsusb
Bus 001 Device 007: ID 1997:2433
Bus 001 Device 006: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
Bus 001 Device 005: ID 28de:1142
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@retropie:~ $ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event1: Mini Keyboard
/dev/input/event2: Mini Keyboard
there's nothing w/ valve-sc
in dmesg
and
$ journalctl -k
No journal files were found.
I recompiled with #define DEBUG
and I set sudo sysctl kernel.printk=7
, no difference.
Check that the module is loaded: lsmod | grep hid_valve_sc
Check that the correct driver is used: readlink /sys/bus/hid/devices/0003\:28DE\:1142.*/driver
should be a symlink to valve-sc. If it is hid-generic, this might be a problem with the udev rule not correctly rebind the device.
Also you need replug the receiver after installing the driver and reloading udev rules. I should add that to the README.
I did a reboot, that should be the equivalent of a replug, no?
— Sent from Mailbox
On Sat, Jan 23, 2016 at 8:20 AM, Clément Vuchener notifications@github.com wrote:
Also you need replug the receiver after installing the driver and reloading udev rules. I should add that to the README.
Reply to this email directly or view it on GitHub: https://github.com/cvuchener/steamcontroller-linux-kernel/issues/2#issuecomment-174189709
Yes
This driver is working really good now.