USB serial console on the GP2X

2006-01-13 08:34:43 PST

Tags: , , ,

So an enterprising lad by the name of gfoot on the GP2X forums has backported the linux 2.6 USB gadget serial module to the 2.4 kernel and compiled it for the GP2X [Thread, module].

Once you get the module, a fellow named luteijn wrote a script to set up a one shot bash prompt on the GP2X waiting for a connection (the script must be run each time you want to connect, because disconnecting kills the bash session) while the menu runs [bash script]. Then just drop the script and module on an SD card in the same directory and run the script from the utility menu of the GP2X. It will then be ready to receive connections. Once the g_serial module is loaded and working you can’t use the GP2X’s USB storage device emulation at the same time, so I came up with unbash.gpu:



rmmod g_serial
cd /usr/gp2x
exec ./gp2xmenu > /dev/null 2>&1

On the client side, you need to have the usbserial and cdc_acm modules loaded (both found in the USB section of the Kernel menu). If you get this right, /dev/ttyACM0 should show up, which is your tty -> USB -> GP2X device.

Once that’s done right you have to setup minicom. Run minicom -s so that you go into setup before minicom initializes. Go into ‘Serial port setup’ and change the Serial Device to /dev/ttyACM0, and hit F to turn off Hardware Flow Control. Exit that menu and go into ‘Modem and dialing’, and hit A and clear the entire ‘Init String’ (it’s useless for this purpose). Then you should be good to go. Save the setup for easy reuse and then exit the menu and you should be greeted by a bash# prompt on your GP2X.

Screen has subsequently been ported to the GP2X. You’ll probably want to add the ‘-m’ switch when running minicom, as this makes it use ALT-key instead of CTRL-A-key for accessing it’s menus. Using ‘-m’ it won’t overlap with screen’s CTRL-A commands.

Obligatory screenshot

2 Responses to “USB serial console on the GP2X”

  1. I modified the script slightly so that it is now in two parts – one does the line setup, the other invokes the shell as a 1-liner and puts it in the background. I invoke it from STerm rather than from the menu system, and have a shell on both the device itself and the hyperterminal session from the PC. Now I need to find the command to output to the TV from the command line, so I can do PIP on the flat screen TV with the main display as the terminal shell and the inset display as the graphics output – neat dev environment and time to start coding! This is going to be *so* much nicer to write for than the GP32 – for which to be honest I wrote one program (tailgunner) then gave up. Way too much hassle!

    Now if only we could run a filing system over the serial at the same time as a shell… hmmm, didn’t I see somewhere that someone had got ppp going?


  2. very cool thanks for this !

Leave a Reply

Valid XHTML 1.0!
Valid CSS!
This is a personal web page. Things said here do not represent the position of my employer. is proudly powered by WordPress
Entries (RSS) and Comments (RSS).
22 queries. 0.384 seconds.