Atari to USB Driver


68 posts   Page 1 of 3   1, 2, 3
by drumminhands » Sat Mar 09, 2013 6:30 pm
I could use a little help. I'm new to both the Raspberry Pi and to Linux. I have the Pi running Stela with no problems. I purchased a USB device to allow me to plug in the original Atari controllers http://www.amazon.com/gp/product/B007ZS35CU/. I like this one because it uses one USB port for two controllers.

But the driver for the device has some issues. Someone wrote a fix for the drivers here: https://github.com/robmcmullen/hid-atari-retrobit. However, it will not load in Debian/Raspbian. Check my link here for the errors: http://www.flickr.com/photos/drumminhan ... hotostream

I'm looking for some advice. Could I find the missing kernels and load them into the Raspberry Pi, or do I need to figure out how to port code on github to work on what the Raspberry PI already has?

Thanks.
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Sun Mar 10, 2013 8:23 am
It looks like it needs /lib/modules/3.6.11+/build
I think this is generated when you build the kernel.
I noticed you can also run make depend. It also has something to do with dependencies. Not sure how.
There are tutorials that describe how to rebuild the Pi Kernel. Some say it takes hours if you do it on the Pi itself and recommend cross compiling on a x86 linux setup.
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by saberman » Mon Mar 11, 2013 1:53 pm
A different way around the problem would be to build a GPIO interface for the joysticks and use something like the GPIO keyboard driver in this thread:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=78&t=29962

Assuming you just need up, down, left, right and fire for 2 joysticks there are enough pins for you to build a 2 input GPIO adaptor.
Posts: 15
Joined: Sun Feb 24, 2013 8:29 pm
by drumminhands » Sat Mar 16, 2013 10:02 pm
saberman, I have seen that post too. I think that I want to explore this route first. I'd like to be able to use the hardware if possible.

Maybe someone can help me out. I've made it a bit further. I rebuilding directly on the pi, which does take some time. I'm following this post on rebuilding the kernel (which I have never done before): http://mitchtech.net/raspberry-pi-kernel-compile/. I made it to:
Code: Select all
make modules_install INSTALL_MOD_PATH=../modules/


That gets the modules on my pi. Then I was able to get the first bit of the driver to work. But I had to change a line in his Makefile from:
Code: Select all
KERNELDIR ?= /lib/modules/$(shell uname -r)/build

to
Code: Select all
KERNELDIR ?= ~/raspberrypi/modules/lib/modules/3.6.11-cutdown+/build


But, it compiled and produced the hid-atari-retrobit module. Now I am having trouble with the next step. I am supposed to:
Code: Select all
rmmod ./hid-atari-retrobit.ko; rmmod usbhid; insmod ./hid-atari-retrobit.ko ; modprobe usbhid


Below are my errors, as I step through each line:
Code: Select all
pi@raspberrypi ~/hid-atari-retrobit-master $ rmmod ./hid-atari-retrobit.ko
Error: Module hid_atari_retrobit is not currently loaded
pi@raspberrypi ~/hid-atari-retrobit-master $ rmmod usbhid
libkmod: ERROR ../libkmod/libkmod-module.c:1802 kmod_module_get_holders: could not open '/sys/module/usbhid/holders': No such file or directory
Error: Module usbhid is in use
pi@raspberrypi ~/hid-atari-retrobit-master $ insmod ./hid-atari-retrobit.ko
Error: could not insert module ./hid-atari-retrobit.ko: Operation not permitted
pi@raspberrypi ~/hid-atari-retrobit-master $ modprobe usbhid
pi@raspberrypi ~/hid-atari-retrobit-master $ sudo rmmod usbhid
libkmod: ERROR ../libkmod/libkmod-module.c:1802 kmod_module_get_holders: could not open '/sys/module/usbhid/holders': No such file or directory
Error: Module usbhid is in use
pi@raspberrypi ~/hid-atari-retrobit-master $ sudo insmod ./hid-atari-retrobit.koError: could not insert module ./hid-atari-retrobit.ko: Invalid module format
pi@raspberrypi ~/hid-atari-retrobit-master $ sudo modprobe usbhid


What am I doing wrong?
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Sun Mar 17, 2013 8:07 am
You will need to remove any usb keyboards and the usb atari adapter to allow for the rmmod usbhid.
The easiest way to do it would be over an ssh link.
When a kernel is build, the included modules depend upon the kernel config file. A driver kan be embedded in the kernel or loaded as module when needed. It can also be excluded (not build).
Some stuff can't be loaded as module as the kernel wouldn't work without it.
It looks like the atari driver isn't embedded in the kernel, so it's probably set as disabled in the kernel config file. If you got it build, you might not need to rmmod it first. (since it's not loaded)
Also be aware that any kernel update you make afterwards can break your changes again. (So don't update anymore or add the command to leave the kernel alone)
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by drumminhands » Sun Mar 17, 2013 5:22 pm
obcd, thanks for the info. I have been testing using ssh and no usb ports logged in. First, I booted again this morning with nothing plugged into the usb at all and ssh in:

Code: Select all
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
pi@raspberrypi ~ $ rmmod usbhid
libkmod: ERROR ../libkmod/libkmod-module.c:1802 kmod_module_get_holders: could not open '/sys/module/usbhid/holders': No such file or directory
Error: Module usbhid is in use
pi@raspberrypi ~ $ cd hid-atari-retrobit-master
pi@raspberrypi ~/hid-atari-retrobit-master $ insmod ./hid-atari-retrobit.ko
Error: could not insert module ./hid-atari-retrobit.ko: Operation not permitted
pi@raspberrypi ~/hid-atari-retrobit-master $ sudo insmod ./hid-atari-retrobit.ko
Error: could not insert module ./hid-atari-retrobit.ko: Invalid module format
pi@raspberrypi ~/hid-atari-retrobit-master $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1292:4154 Innomedia


At the end of that bit I tried plugging in the Atari to USB adapter to see it in the list. Then I plugged in the keyboard to log into the Pi directly and try and play the game.
Code: Select all
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 04fc:05d8 Sunplus Technology Co., Ltd Wireless keyboard/mouse
Bus 001 Device 005: ID 1292:4154 Innomedia


Same problems. Any other tricks I could try?
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Mon Mar 18, 2013 8:34 am
You will need to get rid of all the errors you see when you run the commands.
Are you sure that the hid-atari-retrobit.ko is one you compiled yourself? The "invalid module format" could indicate that it's a driver for a different kernel. Maybe you didn't install the kernel and modules you compiled yourself which could explain it.
Does "sudo rmmod usbhid" make a difference compared to "rmmod usbhid"?
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by drumminhands » Tue Mar 19, 2013 1:13 pm
sudo rmmod usbhid has the same problem. See my 3-17 code output. I had already tried it.
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Tue Mar 19, 2013 3:38 pm
Sorry, but I only saw the "sudo insmod" for the atari module, not a "sudo rmmod usbhid".
How about that kernel assumption. Did you install the kernel you compiled yourself?
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by drumminhands » Tue Mar 19, 2013 4:16 pm
I think so, but this is definitely a new place for me. I've never rebuilt a kernel before. I tried this part:
Code: Select all
pi@raspberrypi ~/hid-atari-retrobit-master $ rmmod ./hid-atari-retrobit.ko
Error: Module hid_atari_retrobit is not currently loaded


But it did not take. I was making the kernel following the steps from http://mitchtech.net/raspberry-pi-kernel-compile/. But I only made it up to
Code: Select all
make modules_install INSTALL_MOD_PATH=../modules/


Do I need to go further in the steps? I guess I still don't have a good grasp on what it means to build the kernel or to install the kernel.
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Tue Mar 19, 2013 5:56 pm
It's not my speciallity either. You could run uname -a to figure out what kernel is running.
Mine normally gives me a build number of #1. The kernel is somewhere hidden in the kernel src folder hierarchy and needs to be renamed to kernel.bin (or kernel.img) and copied over to the boot partition of the sd card. As I am used to cross compiling, the procedure might be different in my case. It's the same for the modules. I have to copy them over to their correct location manually as well.
I'll check your compiling tutorials when I have a little more time. I will also pass the link of the methods I am using.
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by drumminhands » Tue Mar 19, 2013 6:13 pm
Oh, I have to copy the kernel and the modules over to boot. I did not do that. I'm not sure which folders I should copy over to. I'll have to do some more digging to understand. Thanks for all the help so far. I really appreciate you giving the time to a noob.
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by obcd » Wed Mar 20, 2013 7:39 am
~/raspberrypi/linux/arch/arm/boot/Image --> This is kerel.img
So that one should go in the boot folder on your sd card.

After creating the modules we need /lib/firmware and the /lib/modules/3.6.11+ root contents and kernel folder

Those shoud be copied to the /lib folder (Not the boot folder)
Code: Select all
 make modules_install INSTALL_MOD_PATH=/lib/modules/

Should likely place the modules directly in the correct location.
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by obcd » Wed Mar 20, 2013 7:57 am
http://elinux.org/Rpi_kernel_compilation
http://lumux.co.uk/2012/06/07/realtek-r ... aspberrypi

In the second link, you can skip the part that describes the integration of the wifi driver.

To use the same configuration as my working Pi image, this is how I do it:

we need a .config file that describes our kernel:
on the pi:
mkdir conf
zcat /proc/config.gz > /home/pi/conf/.config
copy this .config to the linux folder of the build environment (note that due to the dot in front it's invisible for the linux environment.)

Your tutorial also describes cross compiling on an ubuntu system.
Your tutorial assumes that the Pi sd card is mounted on the ubuntu system. This isn't described in detail.
Posts: 908
Joined: Sun Jul 29, 2012 9:06 pm
by raskitoma » Thu Jul 18, 2013 6:22 am
Hi guys:

I'm triying to use this method to make a workaround for the retrolink snes usb adapter. I have the same problem (up/left not detected)

I have no skills compiling drivers, so please if you can give me any advice help me!

Btw, I'm in the same point, I've already compiled the "driver" but cannot load it.

Thanks,
--
RPi rev B (512Mb)
2 SD cards:
SD 1: Retropie
SD 2: PyKaraoke (mic already works!)

Trying to use an old SNES as enclosure...
Posts: 8
Joined: Wed Jul 17, 2013 5:27 pm
by drumminhands » Thu Jul 18, 2013 6:20 pm
Sorry, this is way over my head. I ended up buying this part and it works just fine on the Pi: http://www.raphnet-tech.com/products/atari2usb/
Posts: 25
Joined: Wed Mar 06, 2013 4:37 pm
Location: Boston, MA
by teeth_03 » Mon Jul 22, 2013 12:20 pm
I was thinking about trying one of those retrobit adapters until I read that it really only works well in Windows.

I'm not guessing someone who knows what they are doing could get it working?

The Retrobit 2 port adapter would be the perfect fit for a Model A Atari emulator box :D
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am
by teeth_03 » Thu Jul 25, 2013 11:54 am
Or if no one can get this working, I would buy a GPIO adapter if anyone made them...
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am
by raskitoma » Thu Jul 25, 2013 1:29 pm
I'll try to do something tomorrow. Let me read some Debian guides there. Last time I need something to be accomplished in my raspi, after no answers here, I found a fix in a Debian forum..
--
RPi rev B (512Mb)
2 SD cards:
SD 1: Retropie
SD 2: PyKaraoke (mic already works!)

Trying to use an old SNES as enclosure...
Posts: 8
Joined: Wed Jul 17, 2013 5:27 pm
by teeth_03 » Sat Jul 27, 2013 1:41 am
Sounds interesting, good luck
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am
by teeth_03 » Sun Aug 04, 2013 1:22 pm
Have you by any chance have any updates on this?
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am
by JTCook » Sun Dec 22, 2013 2:32 am
I have posted about this issue on the Raspberry PI github, but it doesn't seem to have much traction :(

https://github.com/raspberrypi/linux/issues/432
Posts: 16
Joined: Tue Nov 12, 2013 1:53 am
by sviudes » Tue Dec 24, 2013 4:20 pm
I have compiled the module, but the command
Code: Select all
rmmod usbhid
tells me that usbhid is in use. It's the only issue, because
Code: Select all
insmod ./hid-atari-retrobit.ko
is not giving me any error messages.

Nobody knows how to get working
Code: Select all
rmmod usbhid
?
Posts: 4
Joined: Tue Dec 24, 2013 4:16 pm
by teeth_03 » Wed Dec 25, 2013 10:38 am
Someone suggested to remove any USB keyboards and try doing it over SSH.
Posts: 284
Joined: Sat Sep 08, 2012 12:02 am
by sviudes » Thu Dec 26, 2013 10:57 am
I removed all usb devices, and I used ssh. But Raspberry pi has an integrated usb hub, maybe this is the cause?
Posts: 4
Joined: Tue Dec 24, 2013 4:16 pm