Usb Gadget Serial Drivers For Gp2x Linux only for now
#1
Posted 02 January 2006 - 12:56 AM
http://www.glost.ecl...dget_serial.zip
The zip contains a prebuilt module, a test program, instructions, and sources to both.
Currently it works fine with the test program, but I haven't had any success bringing up a shell yet - I tried running getty on /dev/ttygs0, and I can see the banner in minicom, but it doesn't seem to run the login program (or the login program can't read the tty). Shrug, my test program works fine. :) If anyone can get to the bottom of this, it would be very cool.
Windows users won't be able to use this yet, unless you fancy backporting a more recent version of the gadget serial driver. The Windows drivers require something called ACM, and it's not supported by this version. When you've done that, read the instructions in Documentation/usb/gadget_serial.txt in your 2.6 kernel source - it has a .inf file for Windows to recognize the device.
For me, in Linux, a device called /dev/ttyUSB0 gets automatically created, and I just connect minicom to it. Turn off hardware flow control, and delete any modem init/reset commands. I also use 38400 8/N/1, but that was the default anyway.
Enjoy!
#5
Posted 02 January 2006 - 06:52 PM
It's pretty easy to run bash though, and you can then run your program from bash and see its output on your PC. There are some issues (Ctrl-C doesn't work for example) but it's really useful, even so.
I'd like to work on a decent debug monitor, with file uploads, killing the running app, restarting it, etc. Debugging is an interesting case - running the app in gdb is probably a good start, at least. Building gdb for the gp2x might not be fun though.
#6
Posted 02 January 2006 - 09:09 PM
Unfortunately I am new to serial devices in linux. Could you provide more information on how to set up the communication on the (USB) host side?
The kernel's documentation says it should all work by loading the usbserial driver (and creating a character device (mknod foo c 188 0)). However doing a cat or echo to this device fails because it says the device does not exist.
This is Kernel 2.6.14 btw.
#7
Posted 02 January 2006 - 09:22 PM
thebohemian, on Jan 2 2006, 03:09 PM, said:
Unfortunately I am new to serial devices in linux. Could you provide more information on how to set up the communication on the (USB) host side?
The kernel's documentation says it should all work by loading the usbserial driver (and creating a character device (mknod foo c 188 0)). However doing a cat or echo to this device fails because it says the device does not exist.
This is Kernel 2.6.14 btw.
In 2.6.14 when the usbgadget module on your PC sees the gp2x (Usually right when you've loaded the modules on the gp2x) it will create /dev/ttyUSB0 without you having to do mknod on anything.
From there you can run something against /dev/ttyUSB0 like getty or bash.
#8
Posted 02 January 2006 - 11:09 PM
Gridmark, on Jan 2 2006, 11:22 PM, said:
On my system this did not work automagically. I had to load the usbserial kernel module as such
modprobe usbserial product=0xa4a7 vendor=0x0525.
Then dmesg said it was attached to USB0 and I could exchange data.
Great stuff!
#10
Posted 03 January 2006 - 04:38 AM
gfoot, on Jan 2 2006, 08:34 PM, said:
Ah, I was using the previous version without ACM. Now I'm using the newer one, I can get everything setup. Screen detects the serial connection, logs in dmesg on the host and the client, but I am yet to get any kind of shell, with either getty (TinyLogin) or piping input into and out from bash to the tty.
Is anyone able to do this yet?
#12
Posted 03 January 2006 - 09:57 AM
#13
Posted 03 January 2006 - 03:53 PM
bash-2.05a# cat bash.gpu
#!/bin/sh
rm log.txt
sync
function log()
{
echo -e "# $*" >> log.txt
( $* 2>&1 ) | sed -e 's/^/| /' >> log.txt
echo >> log.txt
}
log insmod /lib/modules/2.4.25/kernel/drivers/usb/gadget/net2272.o
log insmod ./g_serial.o use_acm=1
log lsmod
log mknod /dev/ttygs0 c 127 0
sync
sleep 3
cd /bin
./bash --login --noprofile -i -s < /dev/ttygs0 > /dev/ttygs0 2>&1 &
cd /usr/gp2x
exec ./gp2xmenu > /dev/null 2>&1
bash-2.05a#It wil run bash in the bg, and restart the menu (you can always kill it if you need to run somethign else on the main display).
changing directories to make umount-ing of the sd card possible.
hypertm uses ctrl-c to copy selection to clipboard, but even "stty intr \#" doesn't seem to help. Maybe I'll try compiling screen for the arm.
#14
Posted 03 January 2006 - 05:39 PM
What's the difference between .gpe and .gpu, apart from where it appears in gp2xmenu? Personally I find it more convenient to have everything in the "games" menu. Not as convenient as a generic browse-everything-and-run-what-you-like launcher would be, of course!
By the way, if anyone can get this to work in ACM mode with minicom in Linux, let me know! I can only get non-ACM (bulk) mode working from a Linux host. In ACM mode, I can send from host to gp2x but not vice versa.
#15
Posted 03 January 2006 - 05:43 PM
http://luteijn.xs4al....0.2/screen.gpe
to use this, copy the .gpe to your GP2X.
make sure nand is writeable, as it wants to create a fifo there.
you'll also need to copy over the linux terminfo entry to /usr/local/share/terminfo/l/linux
Might fix the path issues, but don't hold your breath.
my linux box is not my desktop, so didn't try connecting it with that yet.
.gpu is just for convenience so it shows up as a utility.
This post has been edited by luteijn: 03 January 2006 - 06:06 PM

Sign In
Register
Help

MultiQuote
