Marc's Public Blog - Linux Hacking

All | Arduino | Bm | Btrfs | Cars | Clubbing | Diving | Electronics | Exercising | Flying | Hiking | Linux | Linuxha | Public | Rc | Snow | Solar | Trips
Generated on 2014-11-20 21:52:06 by Rig3 0.4-440

This page has a few of my blog entries about linux, but my main linux page is here
Picture of Linus


>>> Back to post index <<<

2012/12/05 Serial Console With WR703N
π 2012-12-05 00:00 in Linux
I was looking for a cheap one port serial console server I could use to monitor a server far away. Turns out they are quite expensive, so I looked at making my own.

I ended up being told to look at a WR703N which can be had for around $25, either from china, or sometimes a US location like amazon . Another option is the mostly identical TL-MR3020

Both have an openwrt distribution which you can get from http://wiki.openwrt.org/toh/tp-link/tl-wr703n and http://wiki.openwrt.org/toh/tp-link/tl-mr3020

One way to get serial could be to open the device and with a bit of soldering and a level converter, one is supposed to get a serial port off the bare chip. That was more time than I was willing to put in, so I just used the built in USB port and a PL2303 USB-serial converter.

Unfortunately, the USB support on those devices has a bug there full speed USB devices (i.e. USB1) do not work reliably and in the case of a serial converter, it'll hang after a minute of use or two.

This is described in a long thread at https://forum.openwrt.org/viewtopic.php?id=39956&p=4 but you can jump to post #84. Basically the fix is to use a passive high speed (USB2) hub, and plug your USB1 device into it. No USB power required, and a cheap $10 USB hub works fine.

Next, get an old USB key, format it with ext4 as explained below, and edit /etc/rc.local on the router to mount the USB stick. This allows logging the serial session without writing to the main flash of your device, since that's not replaceable.

Ok, so the end cost is between $40 and $50, but you get a super small linux capable router that acts as serial console server, can log the output and provide ssh access. Still not bad... (I used a free 64MB USB key I had lying around).

/etc/rc.local:

# Get the card ready with # mkfs.ext4 /dev/sdc1 # tune2fs -c0 -i0 -m0 /dev/sdc1 # opkg install kmod-fs-ext4 mount -o noatime,commit=600,data=writeback /dev/sda1 /mnt

cd /mnt # opkg install kmod-usb-serial-pl2303 # opkg install screen # This will dump serial logs in /mnt on your USB key screen -m -d -L /dev/ttyUSB0 115200

# If you don't want screen, you can try minicom or microcom # http://www.damnsmalllinux.org/f/topic-3-7-11379-0.html


More pages: October 2014 May 2014 April 2014 March 2014 January 2014 November 2013 September 2013 May 2013 March 2013 January 2013 December 2012 August 2012 May 2012 March 2012 January 2012 December 2011 August 2011 July 2011 January 2011 October 2010 August 2010 June 2010 April 2010 March 2010 January 2010 December 2009 November 2009 September 2009 August 2009 July 2009 May 2009 January 2009 December 2008 November 2008 October 2008 January 2008 November 2007 August 2007 July 2006 January 2006 August 2005 April 2005 November 2004 March 2004 February 2004

>>> Back to post index <<<