[19. April 2013] A-400 Advanced Network Setup now available | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 [21 Jan. 2013] | A-200/A-210 [10 Aug. 2012]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
Driver for USB->RS232
10-07-2009, 03:24 PM (This post was last modified: 10-07-2009 03:25 PM by anilsen.)
Post: #1
Driver for USB->RS232
Hi.

I have a 4x2 HDMI matrix with RS232 interface and I want to control this from my popcornhour box. I want to connect a STLAB USB RS232 adapter to my popcorn box USB port and RS232 to the matrix.

Through my own application on the PopcornHour I want to control the matrix.

When I connect the adapter to the PH unit and type dmesg I get a entry in log:

usb 2-1: new full speed USB device using tangox-ohci-hcd and address 2

(I can also see in the /dev/ directory : usbdev1.1 usbdev2.1 usbdev2.2.)

How do I access the serial port from my "C" application ?

Do I need to install a driver. On the driver cd, there are some file call pl2303.c. I did not manage to compile this. Get a lot of errors

I am not a linux expert, so is there anyone that can point me in to the right direction.

André
Find all posts by this user
10-07-2009, 08:08 PM (This post was last modified: 10-07-2009 08:35 PM by bdb.)
Post: #2
RE: Driver for USB->RS232
(10-07-2009 03:24 PM)anilsen Wrote:  Do I need to install a driver. On the driver cd, there are some file call pl2303.c.
You will need a driver ... here is one I compiled earlier.
(also includes a driver for the ftdi equivalent, an ati rf remote, and a 'garmin_gps' driver - whatever that may be)

for the pl2303,
run
Code:
insmod usbserial.ko
insmod pl2303.ko

you should not see any error messages; to check it is installed correctly, run
Code:
dmsg
and check the last few lines of the logfile. You should see something like:
Code:
usbserial: No versions for exported symbols. Tainting kernel.
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
usbcore: registered new driver pl2303
drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver

Plug the pl2303, run dmesg again, you should see something like:
Code:
usb 1-2: USB disconnect, address 2
dvb-usb: Hauppauge Nova-T Stick successfully deinitialized and disconnected.
usb 2-2: new full speed USB device using tangox-ohci-hcd and address 2
drivers/usb/serial/usb-serial.c: descriptor matches
drivers/usb/serial/usb-serial.c: found interrupt in on endpoint 0
drivers/usb/serial/usb-serial.c: found bulk out on endpoint 1
drivers/usb/serial/usb-serial.c: found bulk in on endpoint 2
pl2303 2-2:1.0: pl2303 converter detected
drivers/usb/serial/usb-serial.c: get_free_serial 1
drivers/usb/serial/usb-serial.c: get_free_serial - minor base = 0
drivers/usb/serial/usb-serial.c: usb_serial_probe - setting up 1 port structures for this device
drivers/usb/serial/usb-serial.c: usb_serial_probe - registering ttyUSB0
usb 2-2: pl2303 converter now attached to ttyUSB0

I've never tried to use it, it looks like you should now be able to use /dev/ttyUSB0 as a conventional serial port.

bdb
(10-07-2009 08:08 PM)bdb Wrote:  I've never tried to use it, it looks like you should now be able to use /dev/ttyUSB0 as a conventional serial port.
just tried it; seems to work ok

to setup the serial port parameters, use stty, e.g.
Code:
stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

echo "hello" > /dev/ttyUSB0     - sends data
cat /dev/ttyUSB0                - receives data

bdb
Find all posts by this user
[+] 1 user says Thank You to bdb for this post
10-08-2009, 06:57 PM (This post was last modified: 10-08-2009 06:58 PM by anilsen.)
Post: #3
RE: Driver for USB->RS232
SmileSmile:)Thank you bdb

I have test your describtion, but I can not get it to work.

When I run command:
stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

The program newer return to the console.

I also tried to write my own application and my program hangs when command is excuted:

tcsetattr(fd, TCSANOW, &tio);

Here is the dump from dmesg:

usbserial: No versions for exported symbols. Tainting kernel.
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
usbcore: registered new driver pl2303
drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
usb 2-1: new full speed USB device using tangox-ohci-hcd and address 2
drivers/usb/serial/usb-serial.c: descriptor matches
drivers/usb/serial/usb-serial.c: found interrupt in on endpoint 0
drivers/usb/serial/usb-serial.c: found bulk out on endpoint 1
drivers/usb/serial/usb-serial.c: found bulk in on endpoint 2
pl2303 2-1:1.0: pl2303 converter detected
drivers/usb/serial/usb-serial.c: get_free_serial 1
drivers/usb/serial/usb-serial.c: get_free_serial - minor base = 0
drivers/usb/serial/usb-serial.c: usb_serial_probe - setting up 1 port structures
for this device
drivers/usb/serial/usb-serial.c: usb_serial_probe - registering ttyUSB0
usb 2-1: pl2303 converter now attached to ttyUSB0
drivers/usb/serial/usb-serial.c: serial_open
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x5407
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e
drivers/usb/serial/usb-serial.c: serial_set_termios - port 0
drivers/usb/serial/usb-serial.c: serial_open
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540d
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x5407
drivers/usb/serial/usb-serial.c: serial_ioctl - port 0, cmd 0x540e


Do you have any tips of have to solve it.

ASN
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  FTDI USB->RS232 driver source code dony71 1 466 03-16-2013 12:21 AM
Last Post: dony71
  PCH doesn't share my USB drive anymore Danishdude 5 2,256 08-30-2010 04:38 PM
Last Post: Willem53
  Accessing USB storage from PC hulx 3 1,810 08-20-2010 03:24 PM
Last Post: Mental
  use USB to Ethernet adapter : Ethernet port broken moriamoria 3 2,802 08-19-2010 08:30 AM
Last Post: Mariandvd
  Transfering files from the internal HDD on a USB Drive rypm77 5 2,685 07-25-2010 01:11 PM
Last Post: JackSpratt
  Index.htm on usb....for startup hispanico 4 2,149 06-30-2010 09:25 AM
Last Post: hispanico
  Downloading directly to a USB HDD connected to NMT Tomo18 3 1,923 06-02-2010 07:55 AM
Last Post: DefBref
  Can't install NMT Apps on USB f4stf0rw4rd 7 7,889 02-17-2010 12:55 PM
Last Post: itokazie
  Auto_Mount v0.1 - Script to auto mount USB drives with NAME vaidyasr 41 17,076 02-12-2010 03:22 AM
Last Post: vaidyasr
  Gigabit USB network adapter? tiwas 3 2,336 01-29-2010 11:55 AM
Last Post: ASD2003ru

Forum Jump: