New IT forum Follow us on Twitter
23 May 2012, 04:59:43 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: EFIKA MX now in stock!
 
   Home   SHOP Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Serial Console  (Read 3197 times)
pts
New IT customer
Newbie
*
Posts: 16


« on: 08 November 2009, 02:07:17 pm »

Hi
Some documentation on configuring a Host for serial console usb driver
Serial console is for following boot process and also if no network access exist
+ RTFM

It's done in 2 steps
  • Get serial working with any device, name /dev/ttyUSB1
  • Get serial working with a uniq specic device name /dev/ttySP<xxx> here 879 is used as an example

This works for Fedora 9,10 with SheevaPlug console is on ttyUSB1

As root or sudo do
Load USB serial driver
Code:
modprobe ftdi_sio vendor=0x9e88 product=0x9e8f

Connect miniUSB to SheevaPlug

Note   Product and SerialNumber from syslog (/var/log/messages)

Nov 19 11:41:12 dax kernel: usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 19 11:41:12 dax kernel: usb 1-1.1: Product: SheevaPlug JTAGKey FT2232D B
Nov 19 11:41:12 dax kernel: usb 1-1.1: Manufacturer: FTDI
Nov 19 11:41:12 dax kernel: usb 1-1.1: SerialNumber: FTSFBVPM
Nov 19 11:48:31 dax kernel: usb 1-1.1: USB disconnect, address 33
Nov 19 11:48:31 dax kernel: ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
Nov 19 11:48:31 dax kernel: ftdi_sio 1-1.1:1.0: device disconnected
Nov 19 11:48:31 dax kernel: ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1


With USB connected: Check with udevinfo   to verify name/value of ATTRS{serial}
Code:
udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB1)|grep serial

Inspired from http://plugcomputer.org/plugforum/index.php?topic=84.0

For this example SerialNumer, ATTRS{serial} is "FTSFBVPM"
Use udev modprobe and to create a link to the proper ttyUSB

Code:
cat >>/etc/udev/rules.d/97-sheeva-serial.rules<<EOF
SYSFS{idProduct}=="9e8f",SYSFS{idVendor}=="9e88",ATTRS{serial}=="FTSFBVPM",ACTION=="add",RUN+="/sbin/modprobe -q ftdi-sio product=0x9e8f vendor=0x9e88",SYMLINK+="ttySP879"
SYSFS{idProduct}=="9e8f",SYSFS{idVendor}=="9e88",ATTRS{serial}=="Serialyyy",ACTION=="add",RUN+="/sbin/modprobe -q ftdi-sio product=0x9e8f vendor=0x9e88",SYMLINK+="ttySPyyy"

SYSFS{idProduct}=="9e8f",SYSFS{idVendor}=="9e88",ACTION=="add",RUN+="/sbin/modprobe -q ftdi-sio product=0x9e8f vendor=0x9e88",SYMLINK+"USB[0-1]"
EOF
Update Serial, xxx, yyy to reflect your units.
I use a name of ttySP<xxx> where '<xxx>' is the last 3 digits of serial number of the unit.
sp<xxx> also as the hostname and for dhcp.
I use xxx=879 in this example, please update to reflect actual number
Add as many as you have Sheeva Plug devices

What you get is a sym link to the proper device, and you also get ownership of device if you are logged in att the console
Ownership can also be set in the udev rules

Restart udev
Console permissions, anybody logged in at host console will get these
Code:
cat >>/etc/security/console.perms.d/51-SheevaPlug.perms <<EOF
# device classes -- these are shell-style globs
<sheeva>=/dev/ttyUSB1 /dev/ttySP879

# permission definitions
<console>  0600 <sheeva>      0660 root.uucp
EOF

Create Minicom rc file -- please update to your name and file location of minirc
Code:
cat  >>/etc/minirc.Sheeva <<EOF
# Machine-generated file - use "minicom -s" to change parameters.
pu port             /dev/ttySP879
pu baudrate         115200
pu bits             8
pu parity           N
pu stopbits         1
pu minit            
pu mreset          
pu mhangup          
pu backspace        DEL
pu rtscts           No
pu xonxoff          No
EOF

Amend minicom setup to reflect the ttySP<xxx> name
as a user start minicom Sheeva to get a serial console to SheevaPlug
Code:
minicom SP879

It's possible to start minicom by watching the link creation in the /dev
Install inotify-tools - command-line programs providing a simple interface to inotify

Use inotify and when the USB serial is started a minicom session is started
The 'ls -l' is a delay to allow console.perms to run
Code:
inotifywait -e create /dev && ls -l /dev/ttySP879 && minicom SP879
« Last Edit: 22 November 2009, 08:35:49 pm by pts » Logged

/Per
NewIT_Jason
New IT Technical Staff
Administrator
Sr. Member
*****
Posts: 252



« Reply #1 on: 09 November 2009, 12:32:45 am »

Thanks Per, i am sure users will find this very useful.
Logged
pts
New IT customer
Newbie
*
Posts: 16


« Reply #2 on: 17 November 2009, 05:32:03 pm »

I will update serial console with more host OS and also howto use consoles for several plugs.
I currently run variants of
Fedora 9
Centos5 which is like Fedora 9
Ubuntu 9.10
Fedora 10 soon Fedora 12

I'm going to test opensolaris with ZFS (I have had big trouble with silent data corruption on large files, 30GB)
Maybe ?
Logged

/Per
NewIT_Marcus
Administrator
Hero Member
*****
Posts: 960


« Reply #3 on: 17 November 2009, 06:17:19 pm »

I will update serial console with more host OS and also howto use consoles for several plugs.
I currently run variants of
Fedora 9
Centos5 which is like Fedora 9
Ubuntu 9.10
Fedora 10 soon Fedora 12

I'm going to test opensolaris with ZFS (I have had big trouble with silent data corruption on large files, 30GB)
Maybe ?

Thank you, pts.

We use Ubuntu, and I did notice a change between 9.04 jaunty jackalope and 9.10 karmic koala.

Under 9.04, two ports - typically /dev/ttyUSB0 and /dev/ttyUSB2 would appear. Now, under 9.10, only one appears and dmesg shows:

Code:
[ 1091.168049] usb 2-1: new full speed USB device using ohci_hcd and address 2
[ 1091.403290] usb 2-1: configuration #1 chosen from 1 choice
[ 1091.411407] usb 2-1: Ignoring serial port reserved for JTAG
[ 1091.416320] ftdi_sio 2-1:1.1: FTDI USB Serial Device converter detected
[ 1091.416379] usb 2-1: Detected FT2232C
[ 1091.416384] usb 2-1: Number of endpoints 2
[ 1091.416389] usb 2-1: Endpoint 1 MaxPacketSize 64
[ 1091.416394] usb 2-1: Endpoint 2 MaxPacketSize 64
[ 1091.416398] usb 2-1: Setting MaxPacketSize 64
[ 1091.428604] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0

Note "Ignoring serial port reserved for JTAG"

After disconnecting and reconnecting a different SheevaPlug, the port numbers can rise, so for instance I've been up to /dev/ttyUSB48.

I'm happy to use cu, so my serial console command is:

Code:
cu -s 115200 -l /dev/ttyUSB1

And don't forget there's lots of relevant info at plugcomputer.org
Logged
akc42
New IT customer
Newbie
*
Posts: 19


« Reply #4 on: 18 November 2009, 02:41:28 am »


I'm happy to use cu, so my serial console command is:

Code:
cu -s 115200 -l /dev/ttyUSB1

And don't forget there's lots of relevant info at plugcomputer.org


I have found "screen" to work quite well.  I use Debian on my other machines, and it seems to always give me ttyUSB0

Code:
screen /dev/ttyUSB0 115200

Control A D detatches from the terminal

One thing both cu and screen seem to do, is restrict screen size if you run aptitude interactively(or other single screen based display such as htop).  Before running the app, I have a full screen in use, afterwards just a small area that was used by the application.
Logged
NewIT_Marcus
Administrator
Hero Member
*****
Posts: 960


« Reply #5 on: 18 November 2009, 05:23:13 pm »


One thing both cu and screen seem to do, is restrict screen size if you run aptitude interactively(or other single screen based display such as htop).  Before running the app, I have a full screen in use, afterwards just a small area that was used by the application.

I'd spotted that, but hadn't figured out the reason, Now I know. Thank you.
Logged
pts
New IT customer
Newbie
*
Posts: 16


« Reply #6 on: 19 November 2009, 09:56:31 am »


I have found "screen" to work quite well.  I use Debian on my other machines, and it seems to always give me ttyUSB0

Code:
screen /dev/ttyUSB0 115200


Does not work on fedora 10 (Screen version 4.00.03 (FAU) 23-Oct-06)
Could not find a PTTY
ubuntu uses Screen version 4.00.03jw4 (FAU) 2-May-06
screen is a virtual terminal manager it does not normaly talk to devices, what version are you using ?
 
Logged

/Per
pts
New IT customer
Newbie
*
Posts: 16


« Reply #7 on: 19 November 2009, 03:26:53 pm »

Added improvments.
Fedora 10 naming
Use of SheevaPlug device names connected to serialNumber as reported by udev.
You will always have the same name for a specific device, easier to do automated testing and building.

Next is getting it to run on ubuntu 9.xx
After that I may do some cleaning up and restructuring
Logged

/Per
pts
New IT customer
Newbie
*
Posts: 16


« Reply #8 on: 21 November 2009, 06:27:43 pm »

cu (call unix) is part of uucp rpm if anyone wants to use it.
Logged

/Per
akc42
New IT customer
Newbie
*
Posts: 19


« Reply #9 on: 25 November 2009, 06:53:36 pm »


I have found "screen" to work quite well.  I use Debian on my other machines, and it seems to always give me ttyUSB0

Code:
screen /dev/ttyUSB0 115200


Does not work on fedora 10 (Screen version 4.00.03 (FAU) 23-Oct-06)
Could not find a PTTY
ubuntu uses Screen version 4.00.03jw4 (FAU) 2-May-06
screen is a virtual terminal manager it does not normaly talk to devices, what version are you using ?
 


The above version on Debian Unstable

I am currently logged in via Ubuntu 8.04 on my Dell Mini 12 and it says it is the same version without the jw4 tail

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!