marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Fri Feb 13, 2015 4:10 pm

LucaToni wrote:Questions RE: Db9_gpio_rpi

- In what cases would extra hardware be required specifically?
I'm referring to those controllers which have ICs that do not operate correctly with 3.3V. Most C64/Amiga-age joysticks are purely switch-based and work like a charm. The MD/Saturn controllers I've tested were fine with 3.3V, but there may be some exceptions.
LucaToni wrote:- Raspberry Pi B+ has 40 GPIO pins (instead of 26), does that mean more controllers can be used simultaneously, say 4?
Yeah, but the driver needs to be updated for that.
LucaToni wrote:- Are 3rd party 6-button Mega Drive pads included or is it just original brand ones?
I've only tested an original 6-btn MD controller, and based on the earlier posts there's apparently issues with 3rd-party ones.
LucaToni wrote:- How do I tell if my joystick is TTL, RTL, DTL, etc.?
-- For example, SpeedPad by Logic3 (6-button Sega Mega Drive pad with a mode button and a turbo switch too).
You'd need to open the controller and check the details of the IC(s) inside it. Probably just easier to test if it works or not.
LucaToni wrote:- SN74LVC245AN by Texas Instruments is probably the most easily and cheapest available. However on the first page of its datasheet it says:...
- Just like many other instructions by manufacturers/distributors/tutorials for use of a level shifter, use in conjunction with a pull-up resister is stated. But of how many ohms?
You don't necessarily need to worry about powerup/down behavior, but 10Kohm is a suitable value for a generic pullup resistor.
LucaToni wrote:...
- Can this image and table be updated for B+ model, please? Or are there no changes, even if 4 controllers (if possible) were to be added?
I'll check if the pins are the same, and update the table if necessary.
LucaToni wrote:...
- Do the +2 buttons in ID 6 refer to the Start and Mode buttons and does having a turbo switch make any difference here in terms of compatibility?
They refer to Start and Mode. I don't see a reason why a turbo switch would break compatibility.
LucaToni wrote: [*]There also other questions like: 'Is it one level shifter (and resister) per controller?', 'Is additional power supply needed?', 'Where can I find a detail tutorial/schematic - a bit like what mahjongg posted above - for connecting DB9 (Sega Mega Drive) controllers, but that is a bit more clear/thorough/noob-proof?' - which if would be answered would help immeasurably.[/list]
I'll see if I can add some extra information to the wiki to clear out the connections in different scenarios.

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 1:37 am

Any advice for getting this working on the new raspberry pi 2? I modified the retropie setup script to pull the headers from this folder, but still seeing:

Code: Select all

[email protected] ~ $ sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,0
ERROR: could not insert 'gamecon_gpio_rpi': Exec format error

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 9:58 am

bcrawford wrote:Any advice for getting this working on the new raspberry pi 2? I modified the retropie setup script to pull the headers from this folder, but still seeing:

Code: Select all

[email protected] ~ $ sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,0
ERROR: could not insert 'gamecon_gpio_rpi': Exec format error
I'm still testing with the generation of new headers for Pi2, and I found a bug in that build which probably causes your error. I fixed that and put updated headers here along with Pi1 headers, but I don't have a Pi2 yet to verify that the module build / operation works correctly on Pi2.

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 2:30 pm

marqs wrote:
bcrawford wrote:Any advice for getting this working on the new raspberry pi 2? I modified the retropie setup script to pull the headers from this folder, but still seeing:

Code: Select all

[email protected] ~ $ sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,0
ERROR: could not insert 'gamecon_gpio_rpi': Exec format error
I'm still testing with the generation of new headers for Pi2, and I found a bug in that build which probably causes your error. I fixed that and put updated headers here along with Pi1 headers, but I don't have a Pi2 yet to verify that the module build / operation works correctly on Pi2.
marqs, thanks for all your hard work on this project. It is greatly appreciated. I removed the old headers, gamecon, and db9 packages and tried using the new headers you put up, but now I'm getting a different error message:

Code: Select all

[email protected] ~ $ sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,0
ERROR: could not insert 'gamecon_gpio_rpi': Device or resource busy
And running tail on the kernel log gives:

Code: Select all

[email protected] ~ $ tail /var/log/kern.log
Feb 14 09:21:55 RasPi2 kernel: [   71.784965] [<800252c0>] (warn_slowpath_null) from [<8001d418>] (__arm_ioremap_pfn_caller+0x184/0x1a8)
Feb 14 09:21:55 RasPi2 kernel: [   71.784990] [<8001d418>] (__arm_ioremap_pfn_caller) from [<8001d498>] (__arm_ioremap_caller+0x5c/0x64)
Feb 14 09:21:55 RasPi2 kernel: [   71.785013] [<8001d498>] (__arm_ioremap_caller) from [<8001d19c>] (__arm_ioremap+0x24/0x2c)
Feb 14 09:21:55 RasPi2 kernel: [   71.785046] [<8001d19c>] (__arm_ioremap) from [<7f084024>] (gc_init+0x24/0x9cc [gamecon_gpio_rpi])
Feb 14 09:21:55 RasPi2 kernel: [   71.785089] [<7f084024>] (gc_init [gamecon_gpio_rpi]) from [<80008854>] (do_one_initcall+0x90/0x1d8)
Feb 14 09:21:55 RasPi2 kernel: [   71.785117] [<80008854>] (do_one_initcall) from [<80095070>] (load_module+0x1b48/0x2004)
Feb 14 09:21:55 RasPi2 kernel: [   71.785141] [<80095070>] (load_module) from [<80095618>] (SyS_init_module+0xec/0x100)
Feb 14 09:21:55 RasPi2 kernel: [   71.785166] [<80095618>] (SyS_init_module) from [<8000ebc0>] (ret_fast_syscall+0x0/0x48)
Feb 14 09:21:55 RasPi2 kernel: [   71.785180] ---[ end trace 0f72d0a80bc8295c ]---
Feb 14 09:21:55 RasPi2 kernel: [   71.785192] gamecon_gpio_rpi: io remap failed
Here's the code from the gamecon install:

Code: Select all

= = = = = = = = = = = = = = = = = = = = =
Installing Gamecon driver
= = = = = = = = = = = = = = = = = = = = =


Starting installation.
dpkg-query: no packages found matching linux-headers-3.18.7-v7+
--2015-02-14 09:13:26--  http://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb
Resolving www.niksula.hut.fi (www.niksula.hut.fi)... 130.233.43.7
Connecting to www.niksula.hut.fi (www.niksula.hut.fi)|130.233.43.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8538794 (8.1M) [application/octet-stream]
Saving to: `linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb'

     0K .......... .......... .......... .......... ..........  0%  129K 64s
    50K .......... .......... .......... .......... ..........  1%  379K 43s
   100K .......... .......... .......... .......... ..........  1%  409K 35s
   150K .......... .......... .......... .......... ..........  2% 6.25M 26s
   200K .......... .......... .......... .......... ..........  2%  421K 25s
   250K .......... .......... .......... .......... ..........  3% 5.80M 21s
   300K .......... .......... .......... .......... ..........  4% 5.22M 18s
   350K .......... .......... .......... .......... ..........  4% 4.87M 16s
   400K .......... .......... .......... .......... ..........  5%  493K 16s
   450K .......... .......... .......... .......... ..........  5% 4.94M 14s
   500K .......... .......... .......... .......... ..........  6% 5.59M 13s
   550K .......... .......... .......... .......... ..........  7% 5.51M 12s
   600K .......... .......... .......... .......... ..........  7% 5.24M 11s
   650K .......... .......... .......... .......... ..........  8% 5.57M 10s
   700K .......... .......... .......... .......... ..........  8%  614K 10s
   750K .......... .......... .......... .......... ..........  9% 5.16M 10s
   800K .......... .......... .......... .......... .......... 10% 4.79M 9s
   850K .......... .......... .......... .......... .......... 10% 6.01M 9s
   900K .......... .......... .......... .......... .......... 11% 5.51M 8s
   950K .......... .......... .......... .......... .......... 11% 5.74M 8s
  1000K .......... .......... .......... .......... .......... 12% 5.22M 7s
  1050K .......... .......... .......... .......... .......... 13% 5.55M 7s
  1100K .......... .......... .......... .......... .......... 13% 4.77M 7s
  1150K .......... .......... .......... .......... .......... 14% 5.49M 7s
  1200K .......... .......... .......... .......... .......... 14% 5.30M 6s
  1250K .......... .......... .......... .......... .......... 15% 1.23M 6s
  1300K .......... .......... .......... .......... .......... 16% 5.79M 6s
  1350K .......... .......... .......... .......... .......... 16% 5.76M 6s
  1400K .......... .......... .......... .......... .......... 17% 5.24M 6s
  1450K .......... .......... .......... .......... .......... 17% 5.07M 5s
  1500K .......... .......... .......... .......... .......... 18% 5.63M 5s
  1550K .......... .......... .......... .......... .......... 19% 5.01M 5s
  1600K .......... .......... .......... .......... .......... 19% 5.74M 5s
  1650K .......... .......... .......... .......... .......... 20% 4.82M 5s
  1700K .......... .......... .......... .......... .......... 20% 4.86M 5s
  1750K .......... .......... .......... .......... .......... 21% 6.25M 5s
  1800K .......... .......... .......... .......... .......... 22% 5.51M 4s
  1850K .......... .......... .......... .......... .......... 22% 5.45M 4s
  1900K .......... .......... .......... .......... .......... 23%  258K 5s
  1950K .......... .......... .......... .......... .......... 23% 2.66M 5s
  2000K .......... .......... .......... .......... .......... 24% 7.58M 5s
  2050K .......... .......... .......... .......... .......... 25% 11.5M 4s
  2100K .......... .......... .......... .......... .......... 25% 65.6K 6s
  2150K .......... .......... .......... .......... .......... 26% 5.73M 6s
  2200K .......... .......... .......... .......... .......... 26% 5.72M 6s
  2250K .......... .......... .......... .......... .......... 27% 5.78M 6s
  2300K .......... .......... .......... .......... .......... 28% 5.81M 6s
  2350K .......... .......... .......... .......... .......... 28% 6.65M 6s
  2400K .......... .......... .......... .......... .......... 29% 6.72M 6s
  2450K .......... .......... .......... .......... .......... 29% 6.64M 5s
  2500K .......... .......... .......... .......... .......... 30% 5.84M 5s
  2550K .......... .......... .......... .......... .......... 31% 6.98M 5s
  2600K .......... .......... .......... .......... .......... 31% 6.24M 5s
  2650K .......... .......... .......... .......... .......... 32% 6.37M 5s
  2700K .......... .......... .......... .......... .......... 32% 4.91M 5s
  2750K .......... .......... .......... .......... .......... 33% 5.52M 5s
  2800K .......... .......... .......... .......... .......... 34% 5.38M 5s
  2850K .......... .......... .......... .......... .......... 34% 5.40M 4s
  2900K .......... .......... .......... .......... .......... 35% 4.84M 4s
  2950K .......... .......... .......... .......... .......... 35% 5.45M 4s
  3000K .......... .......... .......... .......... .......... 36% 19.4M 4s
  3050K .......... .......... .......... .......... .......... 37% 42.2M 4s
  3100K .......... .......... .......... .......... .......... 37% 37.5M 4s
  3150K .......... .......... .......... .......... .......... 38% 46.7M 4s
  3200K .......... .......... .......... .......... .......... 38% 46.5M 4s
  3250K .......... .......... .......... .......... .......... 39% 42.3M 4s
  3300K .......... .......... .......... .......... .......... 40% 36.4M 4s
  3350K .......... .......... .......... .......... .......... 40%  521K 4s
  3400K .......... .......... .......... .......... .......... 41%  129K 4s
  3450K .......... .......... .......... .......... .......... 41%  381K 4s
  3500K .......... .......... .......... .......... .......... 42%  394K 4s
  3550K .......... .......... .......... .......... .......... 43%  401K 4s
  3600K .......... .......... .......... .......... .......... 43% 5.15M 4s
  3650K .......... .......... .......... .......... .......... 44% 1.96M 4s
  3700K .......... .......... .......... .......... .......... 44%  507K 4s
  3750K .......... .......... .......... .......... .......... 45% 5.49M 4s
  3800K .......... .......... .......... .......... .......... 46% 2.40M 4s
  3850K .......... .......... .......... .......... .......... 46%  515K 4s
  3900K .......... .......... .......... .......... .......... 47% 4.60M 4s
  3950K .......... .......... .......... .......... .......... 47% 6.91M 4s
  4000K .......... .......... .......... .......... .......... 48% 5.22M 4s
  4050K .......... .......... .......... .......... .......... 49% 1.32M 4s
  4100K .......... .......... .......... .......... .......... 49%  749K 4s
  4150K .......... .......... .......... .......... .......... 50% 5.93M 4s
  4200K .......... .......... .......... .......... .......... 50% 4.71M 4s
  4250K .......... .......... .......... .......... .......... 51% 6.13M 3s
  4300K .......... .......... .......... .......... .......... 52% 5.35M 3s
  4350K .......... .......... .......... .......... .......... 52% 5.32M 3s
  4400K .......... .......... .......... .......... .......... 53% 5.48M 3s
  4450K .......... .......... .......... .......... .......... 53%  651K 3s
  4500K .......... .......... .......... .......... .......... 54% 5.10M 3s
  4550K .......... .......... .......... .......... .......... 55% 6.06M 3s
  4600K .......... .......... .......... .......... .......... 55% 5.58M 3s
  4650K .......... .......... .......... .......... .......... 56% 5.07M 3s
  4700K .......... .......... .......... .......... .......... 56% 5.69M 3s
  4750K .......... .......... .......... .......... .......... 57% 5.07M 3s
  4800K .......... .......... .......... .......... .......... 58% 5.37M 3s
  4850K .......... .......... .......... .......... .......... 58% 5.45M 3s
  4900K .......... .......... .......... .......... .......... 59% 5.34M 3s
  4950K .......... .......... .......... .......... .......... 59% 4.85M 3s
  5000K .......... .......... .......... .......... .......... 60% 1.37M 3s
  5050K .......... .......... .......... .......... .......... 61% 5.13M 2s
  5100K .......... .......... .......... .......... .......... 61% 5.73M 2s
  5150K .......... .......... .......... .......... .......... 62% 5.42M 2s
  5200K .......... .......... .......... .......... .......... 62% 5.15M 2s
  5250K .......... .......... .......... .......... .......... 63% 5.87M 2s
  5300K .......... .......... .......... .......... .......... 64% 5.08M 2s
  5350K .......... .......... .......... .......... .......... 64% 5.24M 2s
  5400K .......... .......... .......... .......... .......... 65% 4.90M 2s
  5450K .......... .......... .......... .......... .......... 65% 5.21M 2s
  5500K .......... .......... .......... .......... .......... 66% 4.95M 2s
  5550K .......... .......... .......... .......... .......... 67% 5.10M 2s
  5600K .......... .......... .......... .......... .......... 67% 3.48M 2s
  5650K .......... .......... .......... .......... .......... 68% 2.53M 2s
  5700K .......... .......... .......... .......... .......... 68% 4.66M 2s
  5750K .......... .......... .......... .......... .......... 69% 2.74M 2s
  5800K .......... .......... .......... .......... .......... 70% 2.63M 2s
  5850K .......... .......... .......... .......... .......... 70% 2.52M 2s
  5900K .......... .......... .......... .......... .......... 71% 2.70M 2s
  5950K .......... .......... .......... .......... .......... 71% 5.45M 2s
  6000K .......... .......... .......... .......... .......... 72% 2.45M 2s
  6050K .......... .......... .......... .......... .......... 73%  258K 2s
  6100K .......... .......... .......... .......... .......... 73% 3.02M 2s
  6150K .......... .......... .......... .......... .......... 74% 8.40M 2s
  6200K .......... .......... .......... .......... .......... 74% 10.9M 1s
  6250K .......... .......... .......... .......... .......... 75% 11.9M 1s
  6300K .......... .......... .......... .......... .......... 76% 11.7M 1s
  6350K .......... .......... .......... .......... .......... 76% 10.4M 1s
  6400K .......... .......... .......... .......... .......... 77% 11.9M 1s
  6450K .......... .......... .......... .......... .......... 77% 11.4M 1s
  6500K .......... .......... .......... .......... .......... 78% 1.57M 1s
  6550K .......... .......... .......... .......... .......... 79% 12.4M 1s
  6600K .......... .......... .......... .......... .......... 79% 6.94M 1s
  6650K .......... .......... .......... .......... .......... 80% 5.14M 1s
  6700K .......... .......... .......... .......... .......... 80% 4.42M 1s
  6750K .......... .......... .......... .......... .......... 81% 5.22M 1s
  6800K .......... .......... .......... .......... .......... 82% 5.14M 1s
  6850K .......... .......... .......... .......... .......... 82% 5.50M 1s
  6900K .......... .......... .......... .......... .......... 83%  983K 1s
  6950K .......... .......... .......... .......... .......... 83% 2.12M 1s
  7000K .......... .......... .......... .......... .......... 84% 5.14M 1s
  7050K .......... .......... .......... .......... .......... 85% 4.85M 1s
  7100K .......... .......... .......... .......... .......... 85% 5.34M 1s
  7150K .......... .......... .......... .......... .......... 86% 2.09M 1s
  7200K .......... .......... .......... .......... .......... 86% 4.20M 1s
  7250K .......... .......... .......... .......... .......... 87%  833K 1s
  7300K .......... .......... .......... .......... .......... 88% 3.18M 1s
  7350K .......... .......... .......... .......... .......... 88% 4.89M 1s
  7400K .......... .......... .......... .......... .......... 89% 5.07M 1s
  7450K .......... .......... .......... .......... .......... 89% 3.70M 1s
  7500K .......... .......... .......... .......... .......... 90% 3.80M 0s
  7550K .......... .......... .......... .......... .......... 91% 1.02M 0s
  7600K .......... .......... .......... .......... .......... 91% 1.71M 0s
  7650K .......... .......... .......... .......... .......... 92% 3.35M 0s
  7700K .......... .......... .......... .......... .......... 92% 3.96M 0s
  7750K .......... .......... .......... .......... .......... 93% 4.74M 0s
  7800K .......... .......... .......... .......... .......... 94% 4.60M 0s
  7850K .......... .......... .......... .......... .......... 94% 4.23M 0s
  7900K .......... .......... .......... .......... .......... 95%  769K 0s
  7950K .......... .......... .......... .......... .......... 95% 3.90M 0s
  8000K .......... .......... .......... .......... .......... 96% 3.51M 0s
  8050K .......... .......... .......... .......... .......... 97% 3.28M 0s
  8100K .......... .......... .......... .......... .......... 97% 3.47M 0s
  8150K .......... .......... .......... .......... .......... 98% 3.96M 0s
  8200K .......... .......... .......... .......... .......... 98% 1.35M 0s
  8250K .......... .......... .......... .......... .......... 99% 1.65M 0s
  8300K .......... .......... .......... ........             100% 2.98M=5.1s

2015-02-14 09:13:31 (1.60 MB/s) - `linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb' saved [8538794/8538794]

Selecting previously unselected package linux-headers-3.18.7-v7+.
(Reading database ... 90855 files and directories currently installed.)
Unpacking linux-headers-3.18.7-v7+ (from linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb) ...
Setting up linux-headers-3.18.7-v7+ (3.18.7-v7+-2) ...
make: Entering directory '/usr/src/linux-headers-3.18.7-v7+'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/current.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  WRAP    arch/arm/include/generated/asm/exec.h
  WRAP    arch/arm/include/generated/asm/hash.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  WRAP    arch/arm/include/generated/asm/ipcbuf.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/mcs_spinlock.h
  WRAP    arch/arm/include/generated/asm/msgbuf.h
  WRAP    arch/arm/include/generated/asm/param.h
  WRAP    arch/arm/include/generated/asm/parport.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/preempt.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/rwsem.h
  WRAP    arch/arm/include/generated/asm/scatterlist.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/segment.h
  WRAP    arch/arm/include/generated/asm/sembuf.h
  WRAP    arch/arm/include/generated/asm/serial.h
  WRAP    arch/arm/include/generated/asm/shmbuf.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/simd.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  WRAP    arch/arm/include/generated/asm/socket.h
  WRAP    arch/arm/include/generated/asm/sockios.h
  WRAP    arch/arm/include/generated/asm/termbits.h
  WRAP    arch/arm/include/generated/asm/termios.h
  WRAP    arch/arm/include/generated/asm/timex.h
  WRAP    arch/arm/include/generated/asm/trace_clock.h
  WRAP    arch/arm/include/generated/asm/unaligned.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
grep: scripts/../arch/x86/syscalls/syscall_32.tbl: No such file or directory
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/parse.tab.c
  HOSTCC  scripts/genksyms/parse.tab.o
  SHIPPED scripts/genksyms/lex.lex.c
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
make: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'
dpkg-query: no packages found matching gamecon-gpio-rpi-dkms
--2015-02-14 09:16:09--  http://www.niksula.hut.fi/~mhiienka/Rpi/gamecon-gpio-rpi-dkms_0.9_all.deb
Resolving www.niksula.hut.fi (www.niksula.hut.fi)... 130.233.43.7
Connecting to www.niksula.hut.fi (www.niksula.hut.fi)|130.233.43.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15178 (15K) [application/octet-stream]
Saving to: `gamecon-gpio-rpi-dkms_0.9_all.deb'

     0K .......... ....                                       100% 62.2K=0.2s

2015-02-14 09:16:10 (62.2 KB/s) - `gamecon-gpio-rpi-dkms_0.9_all.deb' saved [15178/15178]

Selecting previously unselected package gamecon-gpio-rpi-dkms.
(Reading database ... 103644 files and directories currently installed.)
Unpacking gamecon-gpio-rpi-dkms (from gamecon-gpio-rpi-dkms_0.9_all.deb) ...
Setting up gamecon-gpio-rpi-dkms (0.9) ...
Loading new gamecon_gpio_rpi-0.9 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Done.

gamecon_gpio_rpi:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.18.7-v7+/updates/dkms/

depmod.....

DKMS: install completed.
dpkg-query: no packages found matching db9-gpio-rpi-dkms
--2015-02-14 09:16:36--  http://www.niksula.hut.fi/~mhiienka/Rpi/db9-gpio-rpi-dkms_0.7_all.deb
Resolving www.niksula.hut.fi (www.niksula.hut.fi)... 130.233.43.7
Connecting to www.niksula.hut.fi (www.niksula.hut.fi)|130.233.43.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13370 (13K) [application/octet-stream]
Saving to: `db9-gpio-rpi-dkms_0.7_all.deb'

     0K .......... ...                                        100% 53.2K=0.2s

2015-02-14 09:16:37 (53.2 KB/s) - `db9-gpio-rpi-dkms_0.7_all.deb' saved [13370/13370]

Selecting previously unselected package db9-gpio-rpi-dkms.
(Reading database ... 103652 files and directories currently installed.)
Unpacking db9-gpio-rpi-dkms (from db9-gpio-rpi-dkms_0.7_all.deb) ...
Setting up db9-gpio-rpi-dkms (0.7) ...
Loading new db9_gpio_rpi-0.7 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Done.

db9_gpio_rpi:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.18.7-v7+/updates/dkms/

depmod....

DKMS: install completed.

If you need any help with getting this working, I am glad to help in any way I can. Please let me know. Thanks!
Last edited by bcrawford on Sat Feb 14, 2015 3:16 pm, edited 1 time in total.

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 3:15 pm

Yep the adress of the register has changed on rpi 2 : https://github.com/digitalLumberjack/mk ... _rpi.c#L47

marqs I think your headers might work though, i'll take a look with my drivers.

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 4:09 pm

Well done marqs, your kernels are ok.

Bad news is you'll have to modify your drivers...

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 4:45 pm

DigitalLumberjack wrote:Well done marqs, your kernels are ok.

Bad news is you'll have to modify your drivers...
I was having a look at the recent commits you have made on your drivers. Is getting the getting the gamecon drivers working on rpi2 just a matter of changing the base address of the register, or are there other factors to consider?

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 4:48 pm

No it's just the conditional on the line you see.

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 5:38 pm

Ok, so I attempted to make the necessary changes to the driver. I download the gamecon deb file and unpackaged it:

Code: Select all

[email protected] ~/temp/gamecon $ dpkg-deb -x ../gamecon-gpio-rpi-dkms_0.9_all.deb .
[email protected]2 ~/temp/gamecon $ dpkg-deb -e ../gamecon-gpio-rpi-dkms_0.9_all.deb 
Then I modified the driver, usr/src/gamecon_gpio_rpi-0.9, as follows:

Original:

Code: Select all

#define BCM2708_PERI_BASE        0x20000000
#define GPIO_BASE                (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
Change:

Code: Select all

#ifdef RPI2
#define BCM2708_PERI_BASE        0x3F000000
#else
#define BCM2708_PERI_BASE        0x20000000
#endif
#define GPIO_BASE                (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
Then I repackaged:

Code: Select all

[email protected] ~/temp/gamecon $ dpkg-deb -b . /home/pi/gamecon-gpio-rpi-dkms_0.9_all.deb
dpkg-deb: building package `gamecon-gpio-rpi-dkms' in `/home/pi/gamecon-gpio-rpi-dkms_0.9_all.deb'.
Then reinstalled both the headers and the driver:

Code: Select all

[email protected] ~ $ sudo dpkg -i linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb 
Selecting previously unselected package linux-headers-3.18.7-v7+.
(Reading database ... 90855 files and directories currently installed.)
Unpacking linux-headers-3.18.7-v7+ (from linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb) ...
Setting up linux-headers-3.18.7-v7+ (3.18.7-v7+-2) ...
make: Entering directory '/usr/src/linux-headers-3.18.7-v7+'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/current.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  WRAP    arch/arm/include/generated/asm/exec.h
  WRAP    arch/arm/include/generated/asm/hash.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  WRAP    arch/arm/include/generated/asm/ipcbuf.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/mcs_spinlock.h
  WRAP    arch/arm/include/generated/asm/msgbuf.h
  WRAP    arch/arm/include/generated/asm/param.h
  WRAP    arch/arm/include/generated/asm/parport.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/preempt.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/rwsem.h
  WRAP    arch/arm/include/generated/asm/scatterlist.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/segment.h
  WRAP    arch/arm/include/generated/asm/sembuf.h
  WRAP    arch/arm/include/generated/asm/serial.h
  WRAP    arch/arm/include/generated/asm/shmbuf.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/simd.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  WRAP    arch/arm/include/generated/asm/socket.h
  WRAP    arch/arm/include/generated/asm/sockios.h
  WRAP    arch/arm/include/generated/asm/termbits.h
  WRAP    arch/arm/include/generated/asm/termios.h
  WRAP    arch/arm/include/generated/asm/timex.h
  WRAP    arch/arm/include/generated/asm/trace_clock.h
  WRAP    arch/arm/include/generated/asm/unaligned.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
grep: scripts/../arch/x86/syscalls/syscall_32.tbl: No such file or directory
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/parse.tab.c
  HOSTCC  scripts/genksyms/parse.tab.o
  SHIPPED scripts/genksyms/lex.lex.c
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
make: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'
[email protected] ~ $ sudo dpkg -i gamecon-gpio-rpi-dkms_0.9_all.deb 
Selecting previously unselected package gamecon-gpio-rpi-dkms.
(Reading database ... 103644 files and directories currently installed.)
Unpacking gamecon-gpio-rpi-dkms (from gamecon-gpio-rpi-dkms_0.9_all.deb) ...
Setting up gamecon-gpio-rpi-dkms (0.9) ...
Loading new gamecon_gpio_rpi-0.9 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Done.

gamecon_gpio_rpi:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.18.7-v7+/updates/dkms/

depmod....

DKMS: install completed.
But, unfortunately I still get the same output from modprobe and tail on the kernel log:

Code: Select all

[email protected] ~ $ sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,0
ERROR: could not insert 'gamecon_gpio_rpi': Device or resource busy
[email protected] ~ $ tail /var/log/kern.log 
Feb 14 12:30:58 RasPi2 kernel: [ 4587.113934] [<800252c0>] (warn_slowpath_null) from [<8001d418>] (__arm_ioremap_pfn_caller+0x184/0x1a8)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.113960] [<8001d418>] (__arm_ioremap_pfn_caller) from [<8001d498>] (__arm_ioremap_caller+0x5c/0x64)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.113983] [<8001d498>] (__arm_ioremap_caller) from [<8001d19c>] (__arm_ioremap+0x24/0x2c)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114016] [<8001d19c>] (__arm_ioremap) from [<7f084024>] (gc_init+0x24/0x9cc [gamecon_gpio_rpi])
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114061] [<7f084024>] (gc_init [gamecon_gpio_rpi]) from [<80008854>] (do_one_initcall+0x90/0x1d8)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114088] [<80008854>] (do_one_initcall) from [<80095070>] (load_module+0x1b48/0x2004)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114113] [<80095070>] (load_module) from [<80095618>] (SyS_init_module+0xec/0x100)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114138] [<80095618>] (SyS_init_module) from [<8000ebc0>] (ret_fast_syscall+0x0/0x48)
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114153] ---[ end trace cba32672301f02dc ]---
Feb 14 12:30:58 RasPi2 kernel: [ 4587.114164] gamecon_gpio_rpi: io remap failed


Apologies for the long post, but I have very little experience modifying deb packages and I just wanted to make sure I went about it right.

Should I give it a try without the conditional directive? Or is there somewhere else that the RPI2 define needs to be set? Any help would be greatly appreciated. Thanks!

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 5:45 pm

Just hardcode it for your compilation, like

Code: Select all

#define BCM2708_PERI_BASE        0x3F000000
because the RPI2 is a variable you must pass make in order to pass it to gcc...
Look at https://github.com/digitalLumberjack/mk ... r/Makefile

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 5:55 pm

DigitalLumberjack wrote:Just hardcode it for your compilation, like

Code: Select all

#define BCM2708_PERI_BASE        0x3F000000
because the RPI2 is a variable you must pass make in order to pass it to gcc...
Look at https://github.com/digitalLumberjack/mk ... r/Makefile
Thanks for your help DigitalLumberjack! I will give this a try shortly. One quick question: So the Makefile passes RPI2 as a directive to gcc, which passes it to the source file as it's being compiled. What passes RPI2 to the Makefile?

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 14, 2015 6:10 pm

DigitalLumberjack wrote:Just hardcode it for your compilation, like

Code: Select all

#define BCM2708_PERI_BASE        0x3F000000
That did it! Again, thanks for your help.

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 21, 2015 12:13 pm

hi guys, another time here with PSX controller...
I'm trying a fresh retropie image with psx controller : at the startup the analog light could be turned on tapping the analog button, so I launch "sudo modprobe gamecon_gpio_rpi map=0,0,7,7,0,0 psx_delay=14" in the console but suddenly the analog light turns off and also tapping the analog button it doesn't turn on again... obviously jstest doesn't work!

I can't figure out what is the problem... Could you help me?

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 21, 2015 3:06 pm

andreatax wrote:hi guys, another time here with PSX controller...
I'm trying a fresh retropie image with psx controller : at the startup the analog light could be turned on tapping the analog button, so I launch "sudo modprobe gamecon_gpio_rpi map=0,0,7,7,0,0 psx_delay=14" in the console but suddenly the analog light turns off and also tapping the analog button it doesn't turn on again... obviously jstest doesn't work!

I can't figure out what is the problem... Could you help me?
Hi andreatax,

I just set up a psx controller on my Pi2 last weekend so maybe I can be of some help. Here's a few things to consider:
  • - What model and revision of the raspberry pi are you using?

    - Are you using the correct pinout for the psx controller? (attention == psx_sel, command == psx_cmd, clock == psx_clk,)(Also pins 3, 8, and 9 from the psx controller are unused)

    - From the call to modprobe, it looks like you have two controllers hooked up to GPIO pins 7 and 26 (using the 1 - 26 pin numbering scheme). Double check this to make sure.

    - After running the modprobe command, have you tried running

    Code: Select all

    $ tail /var/log/kern/log
    to see what the result of the modprobe command is?
If none of these things help, post back with some more information and we'll see if we can get you up and running. Good luck!

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 21, 2015 4:34 pm

thank you for the reply, I'm on a Rpi B
my map is = 0,0,0,0,7,7 ( I copied the wrong ) so data is on pin 3 (GPIO2)

the kern.log says:
Input: PSX controller as /devices/virtual/input/input2
PSX controller data pin connected to GPIO2

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 21, 2015 5:44 pm

andreatax wrote:thank you for the reply, I'm on a Rpi B
my map is = 0,0,0,0,7,7 ( I copied the wrong ) so data is on pin 3 (GPIO2)

the kern.log says:
Input: PSX controller as /devices/virtual/input/input2
PSX controller data pin connected to GPIO2
Hmmm, usually no matter what pin I hookup to, I'll see the first controller on /devices/virtual/input/input0. Do you have any or have you had any other controllers hooked? Perhaps you had another set up that is interfering with things. Do you see any modprobe commands when you run the following:

Code: Select all

cat /etc/modules
Also, do you have two psx controllers hooked up? If not, you only need to run modprobe using a map for one controller (i.e, 0,0,0,0,7,0).

Another thing to consider:
marqs wrote:you should always run "rmmod gamecon_gpio_rpi" between consecutive modprobe commands
If all else fails, I would suggest moving the data onto pin 7 (GPIO4) and try running modprobe again (map=0,0,7) after a reboot. That's where I have my psx controller hooked up (my controller is one of the earlier versions without the analog sticks, but I wouldn't think that would make a difference).

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sat Feb 21, 2015 8:57 pm

No other controller and no modprobe commands with "cat", no result switching GPIO port... :cry:

Anytime I launch "modprobe gamecon_gpio_rpi ...." seems that Rpi stops to communicate to the PSX controller, also stopping current ( analog light turns off )

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Fri Feb 27, 2015 9:52 pm

I had a chance to test 3rd-party 6-button MD controller today, and encountered the same problems reported here earlier. The funcitionality was fixed by increasing the access time delay (DB9_GENESIS_DELAY). I just updated both gamecon and db9 drivers to be compatible with Rpi2, and included the MD controller fix there. The updated drivers are now available here, and downloadable with RetroPie-Setup in a few days.

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sat Feb 28, 2015 3:26 pm

Nice work marqs, thanks :)

snoopyk
Posts: 18
Joined: Wed Feb 25, 2015 4:07 pm
Location: czech
Contact: Website

Re: Multi-console gamepad driver for GPIO

Sun Mar 01, 2015 1:26 pm

Marqs very thanks my Sega megadrive 6button by RADICA work in retropie on RPI2 YEAH :D

driftking96
Posts: 20
Joined: Sun Mar 10, 2013 8:48 pm
Location: Scarborough, Ontario, Canada

Re: Multi-console gamepad driver for GPIO

Wed Mar 04, 2015 7:12 pm

Hey guys,
Sorry if this is a really basic question but is there a clear step-by-step guide to install a PS2 steering wheel on the Raspberry Pi 2 and does the PS2 steering wheel act the same way as a PSx or even PS2 controller? And is there anyway to connect the PS2 steering wheel to the RPi 2 and use C++ to control the actions like accelerate, brake, reverse and turning etc.?

Thank you very much and really appreciate your help

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Wed Mar 04, 2015 10:53 pm

driftking96 wrote:Hey guys,
Sorry if this is a really basic question but is there a clear step-by-step guide to install a PS2 steering wheel on the Raspberry Pi 2 and does the PS2 steering wheel act the same way as a PSx or even PS2 controller? And is there anyway to connect the PS2 steering wheel to the RPi 2 and use C++ to control the actions like accelerate, brake, reverse and turning etc.?

Thank you very much and really appreciate your help
There is no step-by-step guide, but the setup is same as connecting a normal PS2 controller to GPIO. A PS2 wheel should also act the same way PS2 controller. The connection diagram is following (psx pinout):

Code: Select all

Rpi pin				PSX controller pin

P1-01 (3.3V)  ====      5 (power/3.3V)
GPIO14        --->      2 (command)
GPIO15        --->      6 (select)
GPIO18        --->      7 (clock)
GPIOXX        <---      1 (data)
P1-06 (GND)   ====      4 (ground)
If you connect the data pin to GPIO4, use the following command to load the driver (as root):

Code: Select all

modprobe gamecon_gpio_rpi map=0,0,7 psx_delay=25
I didn't understand your last question. You'd want to connect the wheel simultaneously to a PS2 and control it via RPi2?

kevinfol
Posts: 2
Joined: Thu Mar 05, 2015 11:22 pm

Re: Multi-console gamepad driver for GPIO

Thu Mar 05, 2015 11:49 pm

Hey marqs!
Great job on this module! I just upgraded to a RPi2 and I can't seem to get gamecon_rpio_rpi working with retropie. For some reason, the installation fails.

Code: Select all

Starting installation.
make: Entering directory '/usr/src/linux-headers-3.18.7-v7+'
scripts/Makefile.clean:17: drivers/infiniband/hw/amso1100/Makefile: No such file or directory
make[4]: *** No rule to make target 'drivers/infiniband/hw/amso1100/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/infiniband/hw/amso1100' failed
make[3]: [drivers/infiniband/hw/amso1100] Error 2 (ignored)
scripts/Makefile.clean:17: drivers/infiniband/ulp/srp/Makefile: No such file or directory
make[4]: *** No rule to make target 'drivers/infiniband/ulp/srp/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/infiniband/ulp/srp' failed
make[3]: [drivers/infiniband/ulp/srp] Error 2 (ignored)
scripts/Makefile.clean:17: drivers/scsi/cxgbi/cxgb3i/Makefile: No such file or directory
make[4]: *** No rule to make target 'drivers/scsi/cxgbi/cxgb3i/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/scsi/cxgbi/cxgb3i' failed
make[3]: [drivers/scsi/cxgbi/cxgb3i] Error 2 (ignored)
scripts/Makefile.clean:17: drivers/scsi/cxgbi/cxgb4i/Makefile: No such file or directory
make[4]: *** No rule to make target 'drivers/scsi/cxgbi/cxgb4i/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/scsi/cxgbi/cxgb4i' failed
make[3]: [drivers/scsi/cxgbi/cxgb4i] Error 2 (ignored)
scripts/Makefile.clean:17: drivers/scsi/osd/Makefile: No such file or directory
make[3]: *** No rule to make target 'drivers/scsi/osd/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/scsi/osd' failed
make[2]: [drivers/scsi/osd] Error 2 (ignored)
scripts/Makefile.clean:17: drivers/usb/host/whci/Makefile: No such file or directory
make[4]: *** No rule to make target 'drivers/usb/host/whci/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'drivers/usb/host/whci' failed
make[3]: [drivers/usb/host/whci] Error 2 (ignored)
scripts/Makefile.clean:17: fs/exofs/Makefile: No such file or directory
make[2]: *** No rule to make target 'fs/exofs/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'fs/exofs' failed
make[1]: [fs/exofs] Error 2 (ignored)
fs/hostfs/Makefile:11: arch/um/scripts/Makefile.rules: No such file or directory
make[2]: *** No rule to make target 'arch/um/scripts/Makefile.rules'.  Stop.
scripts/Makefile.clean:92: recipe for target 'fs/hostfs' failed
make[1]: [fs/hostfs] Error 2 (ignored)
scripts/Makefile.clean:17: fs/nfs/objlayout/Makefile: No such file or directory
make[3]: *** No rule to make target 'fs/nfs/objlayout/Makefile'.  Stop.
scripts/Makefile.clean:92: recipe for target 'fs/nfs/objlayout' failed
make[2]: [fs/nfs/objlayout] Error 2 (ignored)
ls: cannot access ./Documentation/DocBook/media/*.b64: No such file or directory
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config include/generated
  CLEAN   .config Module.symvers
make: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'
make: Entering directory '/usr/src/linux-headers-3.18.7-v7+'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
*
* Restart config...
*
*
* Support for small TFT LCD display modules
*
Support for small TFT LCD display modules (FB_TFT) [N/m/y] (NEW) aborted!

Console input/output is redirected. Run 'make oldconfig' to update configuration.

scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 1
Makefile:541: recipe for target 'silentoldconfig' failed
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'modules_prepare'.  Stop.
make: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'

------------------------------
Deleting module version: 0.7
completely from the DKMS tree.
------------------------------
Done.
Loading new db9_gpio_rpi-0.7 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Error! Bad return status for module build on kernel: 3.18.7-v7+ (armv7l)
Consult /var/lib/dkms/db9_gpio_rpi/0.7/build/make.log for more information.

------------------------------
Deleting module version: 0.9
completely from the DKMS tree.
------------------------------
Done.
Loading new gamecon_gpio_rpi-0.9 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Error! Bad return status for module build on kernel: 3.18.7-v7+ (armv7l)
Consult /var/lib/dkms/gamecon_gpio_rpi/0.9/build/make.log for more information.
--2015-03-05 23:35:14--  http://www.niksula.hut.fi/~mhiienka/Rpi/gamecon-gpio-rpi-dkms_1.0_all.deb
Resolving www.niksula.hut.fi (www.niksula.hut.fi)... 130.233.43.7
Connecting to www.niksula.hut.fi (www.niksula.hut.fi)|130.233.43.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14114 (14K) [application/octet-stream]
Saving to: `gamecon-gpio-rpi-dkms_1.0_all.deb'

     0K .......... ...                                        100% 44.5K=0.3s

2015-03-05 23:35:15 (44.5 KB/s) - `gamecon-gpio-rpi-dkms_1.0_all.deb' saved [14114/14114]

(Reading database ... 65670 files and directories currently installed.)
Preparing to replace gamecon-gpio-rpi-dkms 0.9 (using gamecon-gpio-rpi-dkms_1.0_all.deb) ...

------------------------------
Deleting module version: 0.9
completely from the DKMS tree.
------------------------------
Done.
Unpacking replacement gamecon-gpio-rpi-dkms ...
Setting up gamecon-gpio-rpi-dkms (1.0) ...
Loading new gamecon_gpio_rpi-1.0 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Error! Bad return status for module build on kernel: 3.18.7-v7+ (armv7l)
Consult /var/lib/dkms/gamecon_gpio_rpi/1.0/build/make.log for more information.
--2015-03-05 23:35:24--  http://www.niksula.hut.fi/~mhiienka/Rpi/db9-gpio-rpi-dkms_1.0_all.deb
Resolving www.niksula.hut.fi (www.niksula.hut.fi)... 130.233.43.7
Connecting to www.niksula.hut.fi (www.niksula.hut.fi)|130.233.43.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12438 (12K) [application/octet-stream]
Saving to: `db9-gpio-rpi-dkms_1.0_all.deb'

     0K .......... ..                                         100% 38.3K=0.3s

2015-03-05 23:35:24 (38.3 KB/s) - `db9-gpio-rpi-dkms_1.0_all.deb' saved [12438/12438]

(Reading database ... 65670 files and directories currently installed.)
Preparing to replace db9-gpio-rpi-dkms 0.7 (using db9-gpio-rpi-dkms_1.0_all.deb) ...

------------------------------
Deleting module version: 0.7
completely from the DKMS tree.
------------------------------
Done.
Unpacking replacement db9-gpio-rpi-dkms ...
Setting up db9-gpio-rpi-dkms (1.0) ...
Loading new db9_gpio_rpi-1.0 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building for architecture armv7l
Building initial module for 3.18.7-v7+
Error! Bad return status for module build on kernel: 3.18.7-v7+ (armv7l)
Consult /var/lib/dkms/db9_gpio_rpi/1.0/build/make.log for more information.
ERROR: Module gamecon_gpio_rpi not found.

with this make.log

Code: Select all

DKMS make.log for gamecon_gpio_rpi-1.0 for kernel 3.18.7-v7+ (armv7l)
Thu Mar  5 23:35:20 UTC 2015
make -C /lib/modules/3.18.7-v7+/build M=/var/lib/dkms/gamecon_gpio_rpi/1.0/build modules
make[1]: Entering directory '/usr/src/linux-headers-3.18.7-v7+'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump ./Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /var/lib/dkms/gamecon_gpio_rpi/1.0/build/gamecon_gpio_rpi.o
In file included from <command-line>:0:0:
././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: No such file or directory
compilation terminated.
scripts/Makefile.build:263: recipe for target '/var/lib/dkms/gamecon_gpio_rpi/1.0/build/gamecon_gpio_rpi.o' failed
make[2]: *** [/var/lib/dkms/gamecon_gpio_rpi/1.0/build/gamecon_gpio_rpi.o] Error 1
Makefile:1381: recipe for target '_module_/var/lib/dkms/gamecon_gpio_rpi/1.0/build' failed
make[1]: *** [_module_/var/lib/dkms/gamecon_gpio_rpi/1.0/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
any ideas as to why this is not compiling?

Thanks a bunch

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Fri Mar 06, 2015 4:00 pm

kevinfol wrote:Hey marqs!
Great job on this module! I just upgraded to a RPi2 and I can't seem to get gamecon_rpio_rpi working with retropie. For some reason, the installation fails.

Code: Select all

scripts/kconfig/conf --silentoldconfig Kconfig
*
* Restart config...
*
*
* Support for small TFT LCD display modules
*
Support for small TFT LCD display modules (FB_TFT) [N/m/y] (NEW) aborted!

Console input/output is redirected. Run 'make oldconfig' to update configuration.

scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 1
Makefile:541: recipe for target 'silentoldconfig' failed
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'modules_prepare'.  Stop.
make: Leaving directory '/usr/src/linux-headers-3.18.7-v7+'
It seems that kernel headers configuration was aborted as it went to interactive mode for some reason. Try running the following as root, and just press enter if there are prompts on TFT LCD configs or such:

Code: Select all

zcat /proc/config.gz > /usr/src/linux-headers-3.18.7-v7+/.config
make -C /usr/src/linux-headers-3.18.7-v7+ modules_prepare
That should configure the headers properly, and possibly rebuild the drivers (if not, run also "dpkg-reconfigure gamecon-gpio-rpi-dkms")

kevinfol
Posts: 2
Joined: Thu Mar 05, 2015 11:22 pm

Re: Multi-console gamepad driver for GPIO

Fri Mar 06, 2015 5:52 pm

Awesome! Worked perfectly. Thanks marqs

EDIT: After doing that, i ended up with "exec format error" like bcrawfords above. So i used rpi-update to get the newest kernel. Then I reinstalled the driver through retropie_setup and everything works perfect now.

Return to “Gaming”