PDA

View Full Version : linux terminal emulator


ddlawrence
03-12-09, 10:05 PM
Hi. Is anyone out there using linux and talking to 'Pods?
What is the terminal emulator you are using?
Are you talking thru USB-RS232 adaptor?

thanks....don

remi
05-06-09, 11:52 AM
Hi Don,

I use gtkterm with my ServoPod-USB and it works fine. I use the USB serial emulation, thus specifying /dev/ttyUSB0 as the serial line but I suppose it will work the same using a regular serial line.

I tried minicom, cu and kermit before gtkterm but they didn't work.

The following little perl program also helps for sending words thru the command line:


#!/usr/bin/perl
#

use Time::HiRes qw(usleep);

open(S, ">/dev/ttyUSB0");
select S;
$| = 1;

for($i = 0; $i < length($ARGV[0]); $i++) {

print substr($ARGV[0], $i, 1);
usleep(10000);
}

print "\r\n";


and this one to send whole files:


#!/usr/bin/perl
#

use Time::HiRes qw(usleep);

open(S, ">/dev/ttyUSB0");
select S;
$| = 1;

while(<>) {

chomp;

for($i = 0; $i < length($_); $i++) {
print substr($_, $i, 1);
usleep(10000);
}
print "\r\n";
usleep(100000);
}


Change /dev/ttyUSB0 to your serial line and ensure you selected the proper speed (e.g. stty 115200 &lt;/dev/ttyUSB0).


Sincerely,
Remi

ddlawrence
05-07-09, 09:07 AM
Thanks, I'll try it.............don

ddlawrence
05-29-09, 09:39 PM
Hi Don,

I use gtkterm with my ServoPod-USB and it works fine. I use the USB serial emulation, thus specifying /dev/ttyUSB0 as the serial line but I suppose it will work the same using a regular serial line.

I tried minicom, cu and kermit before gtkterm but they didn't work.

Change /dev/ttyUSB0 to your serial line and ensure you selected the proper speed (e.g. stty 115200 &lt;/dev/ttyUSB0).

Sincerely,
Remi

Hi Remi. I finally got gtkterm going on my Linux notebook PC.
When I go into port configuration I get the message:

No valid serial device found in /dev, sorry !
You should have at least one of these :
/dev/ttyS*
/dev/tts/*
/dev/ttyUSB*
/dev/usb/tts/*

So I have to configure the USB for tty with stty or something.
You seem to have alot of experience with this, can you help me?

thanks......don

remi
06-01-09, 05:06 PM
Hi Don,

it sounds like you don't have the device driver properly loaded for the FTDI USB-Serial converter embedded in the ServoPod-USB or you don't have the corresponding entries in your /dev hierarchy. As a first check, you could plug the ServoPod-USB USB cable to an USB port of your notebook and then look at the output of the dmesg command. You should see something like


[5274820.573825] usb 2-2: new full speed USB device using uhci_hcd and address 16
[5274820.779262] usb 2-2: configuration #1 chosen from 1 choice
[5274820.784677] ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected
[5274820.784677] ftdi_sio: Detected FT232RL
[5274820.784677] usb 2-2: FTDI USB Serial Device converter now attached to ttyUSB0
[5274820.792008] usb 2-2: New USB device found, idVendor=0403, idProduct=6001
[5274820.792008] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[5274820.792008] usb 2-2: Product: FT232R USB UART
[5274820.792008] usb 2-2: Manufacturer: FTDI
[5274820.792008] usb 2-2: SerialNumber: A8008ifQ


(this output was made using my XBee USB carrier board because my ServoPod-UDB is currently using a RS232 communications to another XBee module but my XBee USB carrier board uses the same chip as the ServoPod-USB).

If you don't see this messages, it may indicate that you don't have the FTDI driver. If you get something esle in the dmesg output, could you copy it on a reply to this thread ? The driver is included in recent kernels (i.e. 2.6.9 or greater or 2.4.30 or greater). You can check your kernel version using the uname -r command. If you have such a recent kernel, maybe you have to recompile it and enable the FTDI driver in the kernel configuration. You can check if the driver is loaded as a module using a lsmod|grep ftdi_sio. You can eventually check if you have the FTDI module using a find /lib/modules/$(uname -r) -name 'ftdi_sio*' and try to load it manually (modprobe ftdi_sio ; modprobe usbserial). What linux distro are you using ?

If you see messages in the dmesg output corresponding to the FTDI USB serial driver, maybe you don't have the /dev/ttyUSB0 special file or you don't have access to it. First, you may issue a ls -l /dev/ttyUSB0 command to see if this file exists and if you have sufficient permission to read/write from/to it. If you don't have this special file, you may create it with a mknod /dev/ttyUSB0 c 188 0 and then a proper chown and/or chmod to grant permissions to users/groups you want to access to the USB Serial. If you have an udev filesystem mounted in /dev (which is the case for recent Ubuntu and Debians) , you normally don't have to to this.

If you don't have a too exotic (for me) distribution, I could try using the same distribution as yours and tell you if I can get some results.

Hope it will help.

Sincerely,
Remi

ddlawrence
06-01-09, 11:02 PM
Hi Don,

it sounds like you don't have the device driver properly loaded for the FTDI USB-Serial converter embedded in the ServoPod-USB or you don't have the corresponding entries in your /dev hierarchy. As a first check, you could plug the ServoPod-USB USB cable to an USB port of your notebook and then look at the output of the dmesg command. You should see something like


[5274820.573825] usb 2-2: new full speed USB device using uhci_hcd and address 16
[5274820.779262] usb 2-2: configuration #1 chosen from 1 choice
[5274820.784677] ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected
[5274820.784677] ftdi_sio: Detected FT232RL
[5274820.784677] usb 2-2: FTDI USB Serial Device converter now attached to ttyUSB0
[5274820.792008] usb 2-2: New USB device found, idVendor=0403, idProduct=6001
[5274820.792008] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[5274820.792008] usb 2-2: Product: FT232R USB UART
[5274820.792008] usb 2-2: Manufacturer: FTDI
[5274820.792008] usb 2-2: SerialNumber: A8008ifQ


(this output was made using my XBee USB carrier board because my ServoPod-UDB is currently using a RS232 communications to another XBee module but my XBee USB carrier board uses the same chip as the ServoPod-USB).

If you don't see this messages, it may indicate that you don't have the FTDI driver. If you get something esle in the dmesg output, could you copy it on a reply to this thread ? The driver is included in recent kernels (i.e. 2.6.9 or greater or 2.4.30 or greater). You can check your kernel version using the uname -r command. If you have such a recent kernel, maybe you have to recompile it and enable the FTDI driver in the kernel configuration. You can check if the driver is loaded as a module using a lsmod|grep ftdi_sio. You can eventually check if you have the FTDI module using a find /lib/modules/$(uname -r) -name 'ftdi_sio*' and try to load it manually (modprobe ftdi_sio ; modprobe usbserial). What linux distro are you using ?

If you see messages in the dmesg output corresponding to the FTDI USB serial driver, maybe you don't have the /dev/ttyUSB0 special file or you don't have access to it. First, you may issue a ls -l /dev/ttyUSB0 command to see if this file exists and if you have sufficient permission to read/write from/to it. If you don't have this special file, you may create it with a mknod /dev/ttyUSB0 c 188 0 and then a proper chown and/or chmod to grant permissions to users/groups you want to access to the USB Serial. If you have an udev filesystem mounted in /dev (which is the case for recent Ubuntu and Debians) , you normally don't have to to this.

If you don't have a too exotic (for me) distribution, I could try using the same distribution as yours and tell you if I can get some results.

Hope it will help.

Sincerely,
Remi

Hi Remi. Wow this is major. I am talking to a PlugAPod via RS232, not the ServoPod.
My linux box is an Acer Aspire notebook running 'Linpus Lite', a Taiwanese distro.
The kernel is 2.6.23.9lw.
I am using a USB2.0 to RS232 cable which happens to use the ftdi_sio chip.
A nice coincidence. However, there is no ftdi_sio module installed.
I got a driver CD with the cable that contains the ftdi_sio tar file.
But my little notebook does not have the ability to compile, I believe.
I has no hard disk. I do not want to recompile the kernel, can I just compile the module?
I will have to decide what to do next. I used to do QNX systems 20 years ago,
but his is slowing me down. Is there a good linux manual for nuts & bolts stuff?
I will try to get a linux hack over for a few beers and sort this out.

thanks........don

remi
06-03-09, 04:56 AM
Hi Don,

yes, it's possible to compile only modules and not the whole kernel. Try to dowload the following files: usbserial.ko (http://ct44.free.fr/tmp/usbserial.ko) and ftdi_sio.ko (http://ct44.free.fr/tmp/ftdi_sio.ko) and copy them to your /lib/modules/2.6.23.9lw/kernel/drivers/usb/serial/ directory and then, run a depmod -a command. You will have to execute the copy and depmod commands with root priviledges. I've followed this document (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230895424/all) to compile these modules.

You will find plenty of readings on linux on The Linux Documentation Project (http://tldp.org/) website. You can find good books on linux for a less specific information too. I'm pretty sure you can find linux activists near you (you can start from this page (http://www.linux.org/groups/) to locate them). I'd be happy to help you for a few beers :) but I'm afraid I'm a bit too far away.

Sincerely,
Remi

ddlawrence
06-04-09, 10:21 PM
OK. Thanks, I'll give it a try.............don

ddlawrence
06-05-09, 09:30 PM
OK. Thanks, I'll give it a try.............don
Big problems. I think I messed up the USB configuration. The keyboard, mouse and USB ports are locked up. I am trying to recover from the recovery dvd. But I do not have a USB optical drive and I ran out of beer for my linux pal here. Will keep you posted. Life is tough on a shoestring budget.

regards.........don

remi
06-06-09, 06:18 AM
Hi Don,

I'm sorry if my advices are the cause of your problems :( Normally, the usbserial and ftdi_sio modules shouldn't be loaded unless the FTDI USB-serial converter is plugged in an USB port. Did you try a reboot (a complete reboot, not just a suspend or hibernation) without the USB-Serial converter being plugged in an USB port ?

At what moment did it crash ? After the depmod -a ? After the USB-serial converter being plugged in ? After a reboot ?

Normally you should be able to boot in some rescue mode without a DVD (by telling the bootloader to start a shell at an early stage of the boot) but the method is dependant of your boot loader. I try to download linpus lite and try and I tell you. Another solution could be to boot from an USB stick. I test and tell you.

Regards,
Remi

remi
06-08-09, 04:42 PM
Hi Don,

did you manage to do something for your notebook ? Maybe you could have a look to this doc (http://dailycupoftech.com/2008/09/02/diy-acer-aspire-one-recovery-usb-device/) explaining how to recover the linpus OS on an Aspire One using a usb device.

I've tried to install both linpus (from the linpus website) and the Acer Aspire One recovery disk. The linpus installation was ok but was in chinese (not practical for me because I don't know any word of chinese) and the Acer Aspire One disk does not want to run on my computer (maybe because it's not an aspire one). I'm still trying...

Could you tell me a little more about your crash, especially at what moment of the boot it crashes and after what operation the crash occured ?

Sincerely,
Remi

remi
06-08-09, 05:05 PM
Just one more thing...

From I've seen of the Acer Linpus Recovery disk, it reinstalls a fresh system from the factory default installation. Every data on the flash is reset too. So if you have any data you'd like to keep on your flash, you should try to boot a live distribution from an USB device to copy your data before reinstalling.

Maybe you can follow this guide (https://help.ubuntu.com/community/AspireOne) (2nd part) and this one (https://help.ubuntu.com/community/Installation/FromUSBStick) if you are in this case. Maybe it could be a good start to try the Ubuntu distro too. It's a really great linux distro !

Sincerely,
Remi

ddlawrence
06-12-09, 10:44 PM
Hi Don,

I'm sorry if my advices are the cause of your problems :( Normally, the usbserial and ftdi_sio modules shouldn't be loaded unless the FTDI USB-serial converter is plugged in an USB port. Did you try a reboot (a complete reboot, not just a suspend or hibernation) without the USB-Serial converter being plugged in an USB port ?

At what moment did it crash ? After the depmod -a ? After the USB-serial converter being plugged in ? After a reboot ?

Remi
Hi Remi. The usb-rs232 converter was plugged in all the time I was working on it. I followed your instructions as a superuser. I do not know what depmod does, I assume something to do with module dependencies. I think it worked, there were no messages. After that I did a stty command, which had no effect. The computer continued to work fine until I rebooted it (shutdown). Then the mouse and keyboard did not respond at all (they are usb). After several unsuccessful tries at memorystick booting, I found a friend with a similar problem who is willing to buy a USB optical drive and lend it to me if I fix his too. Do not worry about causing me problems with your advice, it probably wasn't you. Your advice and links were very good. I learned alot. I blame the Linux monolithic architecture and lack of design/documentation leadership. I would have replied sooner, but my notebook was also my internet access machine, and I am waiting for the optical drive before I go any further. I had no important data on the notebook flash, so there is no loss there either. So, thanx again, I will keep you posted.

later.........don

remi
06-15-09, 05:32 AM
Hi Don,

I hope your problems will be resolved soonly. As you guessed, the depmod -a command allows to compute the module dependancies (stored in the /lib/modules/$(uname -r)/modules.dep file). This file is used by the modprobe command to automatically load modules needed by the insertion of a given module. In facts, the modules allow a not-so-monolithic approach of the linux kernel. They can be loaded and unloaded on demand. That's the reason why I told you to try to boot your netbook without the USB-Serial adapted being pluged, because, in this case, the corresponding modules are not loaded. Anyway, because the modules are working in kernel mode, it's always a good idea to have an alternate boot device on the hand when doing manipulations at this level. For a future try, you may test the modules by not copying them in the modules hierarchy (/lib/modules/$(uname -r)/kernel/drivers/usb/serial/), not computing the module dependancies (no depmod -a command) and loading them manually using insmod ftdi_sio.ko and then insmod usbserial.ko commands.

I've never seen a side effect of an USB device to another, but there may be. Of course, the depmod -a command can have a side effect affecting the USB HID too (e.g. if for some reason, a module needed by the USB keyboard and mouse drivers is no more in the dependancies list or is conflicting with the FTDI driver).

The good news are that if you could issue a stty &lt;/dev/ttyUSB0 without error, that means that your USB-Serial converter was correctly detected by the FTDI driver.

Sincerely,
Remi

ddlawrence
06-17-09, 03:50 AM
Hi Remi. I finally got it. Or rather my Aussie linux hack pal got it. Once we reinstalled the OS, he followed your installation and configuration directions and voila! Merci. He was impressed by your thoroughness. Mind you that is after he drank all my beer again...

later...............don

remi
06-17-09, 11:01 AM
Hi Don,

happy to see that your problem as been solved :)

Sincerely,
Remi

ddlawrence
06-17-09, 11:14 PM
Hi Again Remi. I am not done yet. I am trying to send files to the PlugAPod. The send raw file function of gtkterm has no flow control capability that I can see, it just spews the whole file and the Pod cannot keep up. I ran your perl script that you posted from the shell. It worked!

perl RemiSend < filename

OK all, we have a linux terminal emulator running! It was a difficult for me, my Linux skill level is low. Bye Bye billion dollar Billie! I hate Microsoft so much, now I am free of it! Almost.

thanks again Remi

remi
06-20-09, 01:34 PM
Hi Don,

I ran into similar problems (that's the reason why I wrote those little perl scripts). The cause is that (at least for me), neither hardware flow control (using RTS/CTS lines on the serial line) nor XON-XOFF (not supported on the 'pod, as I've understood) is available. I've read on the ServoPod-USB documentation that RTS/CTS flow control can be emulated using PD0 and PD2 but I didn't try (and I didn't really understood how to do this actually).

The values of the timers (usleep()) are quite big on the script I posted in this thread. To make things going faster, I've had good results with an usleep(500) in the inner for loop (delay of 500 microseconds between each character) and an usleep(100000) (delay of 100 milliseconds after each line), and this even with a XBee radio link between my laptop and the ServoPod-USB, but I think it depends of the hardware too.

Regards,
Remi

ddlawrence
07-23-09, 11:57 PM
Hi Remi. My linux notebook PC began to have internet connection problems so I had to reinstall the OS again. I have gtkterm running and installed ftdi_sio.ko and usbserial.ko.
When I rebooted with the USB-Serial converter plugged in and ran dmesg I got:

drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected
usb 2-2: FTDI USB Serial Device converter now attached to ttyUSB0
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

So I think the driver was loaded OK. I want to check with you before I proceed further. My next command would be:

stty 115200 </dev/ttyUSB0

Is this correct? Then I should be good to go with gtkterm.
I am doing this myself. My Aussie pal was a great help, but I need to learn this stuff myself. And save beer too..........

thanks..............don

ddlawrence
07-24-09, 07:17 PM
I got it working. The baud rate can be set from gtkterm itself.
The stty 115200 .... command wasn't necessary. I think that hung up
my USB before.
Actually it worked without a problem, it wasn't as hard as I thought.

later............don