Usb controller for Pico-8 on PocketC.H.I.P?


#12

why not just add chip to the input group in /etc/group?

I downloaded the file @computermouth posted aboive and put it in the location, plugged in the xbone controller, dmesg showed the device as a microsoft controller, but its not working in pico-8. of course I am using the onboard usb port as I dont have a powered USB hub(yet), but the controller just flashes a few times then powers off(as opposed to the light staying on when plugged into my pc). pico log shows zero controllers…

I may try the ps3 bt controller in a bit, but I have some other stuff I want to try out first.


#13

I’ve been searching all over for an answer to why SDL was not detecting my iBuffalo controller. Just like @chrisjaure mentioned, SDL uses /dev/input/event* for gamepad input capture. However, my user (chip) did not have permission to access these, so it was failing silently.

As @Coded mentioned, to grant the chip user access, add the chip user to the input group.

sudo nano /etc/group

Arrow down to the line that says:

input:x:101:

to:

input:x:101:chip

Type control+x, to exit. It will prompt you to save the file. Type y, then return to save the file and quit the nano text editor. Restart your PocketCHIP and SDL will now be able to read the gamepad input.


Xbox Controller for Windows in PICO-8?
#14

On Debian-based systems, you can do the same with just

sudo adduser chip input

Then log out and back in, as previously.


#15

Even better, thanks!


#16

Okay, so… just asking again because at this point it is still unclear to me…

Has ANYONE successfully used a USB controller to control Pico-8 on the PocketC.H.I.P yet?

And a followup question if the first question is answered with a “yes”: How do I accomplish this? Tell me your secrets! I will buy the same controller if I have to…


How to pair a DualShock 4 controller with PocketC.H.I.P
#17

Yes! Here’s how I got mine working (using a combination of the tips above).

  1. Add ‘chip’ as a member of the input group.
    sudo adduser chip input

  2. Restart your machine.

  3. Copy the sdl controller config file from Github.

    cd /home/chip/.lexaloffle/pico-8
    wget https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
    mv gamecontrollerdb.txt /home/chip/.lexaloffle/pico-8/sdl_controllers.txt

  4. When you first start pico-8, the controller will not work. You must first background the app (by pressing the home button) and then click the pico-8 icon again. It should now work.

  5. The controller I’m using is the Buffalo Classic USB Game Pad. You can find it on Amazon here. Works perfectly!

I also have a USB NES controller, but the mapping file doesn’t detect the B button :confused: I’ll have to work on that one.


No matter what I try, my gamepad isn't used by pico-8 [SOLVED - IGNORE]
Chip usb controller help
[SOLVED] NextThing USB controller not working on Pico8 on PocketCHIP
#18

Thanks, @greysonp!

So, I was asking this same question over at the Pico-8 forums and a very nice fellow was helping me out… I did everything he said, but still couldn’t get it to work. When you replied I figured I’d wait until I got the same controller as you to try, but today I thought ‘what the heck…’ and tried using what I got. To my surprise, it actually worked! Well, sort of… both the “A” & “B” buttons do the same thing… they both seem to control the “X” button in Pico-8, and so I have no control for the “Z” button. Is this what you are experiencing with your other controller? I may still buy that same Buffalo controller that you got to work…

This is what I entered into the controller.txt… The nice fellow from the Pico-8 forums helped figure it out since there wasn’t one existing for my controller, and the sdl gamepad thing wasn’t ready yet for Linux:

03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,start:b9,dpup:a4,dpdown:a0,dpleft:a1,dpright:a2,platform:Linux,


#19

Ahh, yes, I’m experiencing something similar! Basically everything on the NES controller I have works except the B button, which does nothing.

I’ll have to try that SDL config when I get the chance. I’d really just like step-by-step instructions on how to generate them. I’ve seen an app that works on Mac and Windows, but there’s no Linux version yet. If anyone has some step-by-step instructions on how to do it on command line, please share! Otherwise I may open a separate thread on the PICO-8 forums or something.


#20

This guy Matt might know…

http://www.lexaloffle.com/bbs/?pid=23128#p23128


#21

Got my iBuffalo controller in the mail today, and it works like a charm! This makes playing Pico-8 approximately 7 million times easier… thanks @greysonp !


#22

Oh perfect! That’s great to hear :slight_smile:


#23

Been reading this and following the instructions. I’m stuck at the point of renaming the file to sdl_controllers.txt because my pocketCHIP can not do the underscore ( _ ) character. Pressing SHIFT+_ (the dash key) fails everyone time. SHIFT+(any letter) gives me Caps, but never an underscore. Completely frustrating!


#24

Sounds like a key map issue, because it works for me.

Do you have a ~/.Xmodmap file? If so (and I expect so), does using it like so help:

xmodmap ~/.Xmodmap

On my system the file has a capital X, even though the program has a lowercase X.


Xbox Controller for Windows in PICO-8?
#25

I tried to use the Microsoft Xbox 360 Controller.
But the driver did not work without.

chip@chip:~$ lsusb |grep -i xbox
Bus 002 Device 002: ID 045e:028e Microsoft Corp. Xbox360 Controller
[ 7803.920000] usb 2-1: USB disconnect, device number 3
[ 7807.160000] usb 2-1: new full-speed USB device number 4 using ohci-platform
[ 7807.390000] usb 2-1: New USB device found, idVendor=045e, idProduct=028e
[ 7807.390000] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7807.390000] usb 2-1: Product: Controller
[ 7807.390000] usb 2-1: Manufacturer: ©Microsoft Corporation
[ 7807.390000] usb 2-1: SerialNumber: 00AXXXX
$ find /lib/modules -name xpad.ko
$ ls /lib/modules/uname -r/kernel/drivers/input/joystick/xpad.ko
ls: cannot access

In addition to your procedure now works in the following manner.

  • My DebianPC

$ sudo apt install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
$ git clone https://github.com/NextThingCo/CHIP-linux.git
$ cd CHIP-linux
$ git checkout -b debian/4.3.0-ntc-4 origin/debian/4.3.0-ntc-4
$ mv .config .config.org
$ scp chip@chip.local:/boot/config-4.3.0-ntc .
$ cp config-4.3.0-ntc ./.config
$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- menuconfig
$ diff config-4.3.0-ntc .config
1494c1494,1496
< # CONFIG_JOYSTICK_XPAD is not set

CONFIG_JOYSTICK_XPAD=m
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -j 4
$ scp drivers/input/joystick/xpad.ko chip@chip.local:/tmp

  • My PocketCHIP

$ sudo mkdir -p sudo mkdir -p /lib/modules/4.3.0+/kernel/drivers/input/joystick
$ sudo cp /tmp/xpad.ko /lib/modules/4.3.0+/kernel/drivers/input/joystick
$ sudo depmod -a
$ sudo modprobe xpad.ko
$ dmesg | tail
:
[ 114.720000] usb 2-1: new full-speed USB device number 2 using ohci-platform
[ 114.950000] usb 2-1: New USB device found, idVendor=045e, idProduct=028e
[ 114.950000] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 114.950000] usb 2-1: Product: Controller
[ 114.950000] usb 2-1: Manufacturer: ©Microsoft Corporation
[ 114.950000] usb 2-1: SerialNumber: 00AXXXX
[ 307.310000] input: Microsoft X-Box 360 pad as /devices/platform/soc@01c00000/1c14400.usb/usb2/2-1/2-1:1.0/input/input3
[ 307.310000] usbcore: registered new interface driver xpad

Set aside the compiled file.(xpad.ko)
https://drive.google.com/file/d/0B5fRgu3RmfsBRl9HTlhCdG9QMlk/view?usp=sharing

I’m sorry in clumsy English.


Xbox 360 Wired Controller to -> PocketCHIP (HELP!)
Xbox wired controller recognized in kernel but not working
#26

strange, it works for me too. Meanwhile you can try to plug an usb keyboard for renaming that particular file.
The important thing is to start pico8 TWICE to make controller work.


#27

You don’t have to start Pico-8 twice, I’m pretty sure there’s just the problem of a static “title screen” in the PocketCHIP edition which isn’t actually part of Pico-8. You have to get past that part to splore first.

Also I have successfully paired a Nintendo Wiimote to my PocketCHIP (by bluetooth) and it detects the D-pad correctly but doesn’t have mappings for any of the other buttons, so… Anybody got bluetooth on their main computer and can run that SDL2 Gamepad Tool to write a mapping for it? :stuck_out_tongue:

EDIT: After some searching, I think I’ve found what we need. https://github.com/spurious/SDL-mirror/blob/master/test/controllermap.c Download SDL2’s source and compile the test/controllermap.c program, then we can use that to make mappings in a primitive fashion. Now I should be able to make a “sideways wiimote for playing Pico-8” mapping, update the gamecontrollerdb.txt, write a guide to the entire process so anyone else who happens to have a convinient old wireless brick of a controller lying around can do it, and win the game.

If I don’t get lazy, anyway.

EDIT2: Hmm. Looks like Wiimotes aren’t usable. They have some kind of wacky legacy peripheral mapping that assigns the arrow keys to the D-pad and the volume up/down keys to the + and - buttons and nothing else does anything. SDL2 doesn’t detect it as a gamepad, so only the D-pad does anything in Pico-8, and of course it’s mapped the wrong direction to be useful. Oh well.

I wrote the guide to writing your own SDL2 gamepad configurations anyway. Here you go.


#28

I’ve added the 8bitdo zero to my fork of the SDL_GameControllerDB on github
I’ve done a pull request but until it’s pulled, the file is here:


#29

I used controllermap to create one that works for the Retro-Link Wired NES Style USB Controller. Here is my sdl_controllers.txt:

03000000790000001100000010010000,USB Gamepad ,platform:Linux,a:b2,b:b1,back:b8,start:b9,leftx:a0,lefty:a1,

It maps both buttons and the axis correctly, and the start button works too!


#30

Hi all!
I can’t make my controller work.
(https://www.amazon.it/dp/B01FY22WYK/ref=cm_sw_r_cp_apa_.gd3xbM55Y8W6)
I’ve basically done the two steps necessary to configure the controller

  • add the user chip tp input
  • installed controllermap, used it to recognize and create my controller mappings ( which went fine) , copied the mapping in sdl_controllers.txt
    Once opened pico-8, nothing works, even after rebooting.
    I’ve tried various combinations( controllermap uses an xbox layout, so i’ve tried to set my axis to the left stick and the right stick) but pico seems not to recognize it at all.
    What i’m missing ? Are there any other tests i can do out of pico-8 to test my controller?
    Thanks anyone :slight_smile:

#31

Nevermind, i backgrounded pico once opened and passed the static screen, restarted it and it works! It is a strange glitch… i think we need to ask zep to remove that…