V Pá, 23. 01. 2004 v 19:06, Greg KH píše:
> On Thu, Jan 22, 2004 at 01:10:55AM -0500, MUDr. Tomáš Hosszú wrote:
> > Hi everybody,
> > 
> > I am writing an application for ascension technologies minibird 3D
> > tracker. (www.ascension-tech.com). 
> > 
> > from the documentation:
> >     configured as DCE (i have for sure the correct type of cable)
> >     RTS - if high device is switched to standby mode, if low it works
> >     DTR - used for flow control, but internally pulled high -(so no flow
> > control is needed, because its ignored)
> >     CTS and DSR are high when device is on.
> > 
> > I made small test application, which sends one byte on device in it 's
> > test mode.....the device should echo every character sent to it.
> > 
> > this application works great on standard serial port, on standard PC
> > compatible computer (/dev/ttyS0)
> > 
> > simplified test application:
> > open port, O_RDWR
> > 1. set RTS OFF (ioctl TIOCMSET)
> > 2. set CS8, CREAD, CLOCAL, B115200, VMIN 0, VTIME 20 (tcsettatr
> > TCSANOW), other flags = 0
> > 3. send any one character (write)
> > 4. read from port (read)
> > close port
> > 
> > but heres the problem, when connecting through usbserial (vendor ST lab
> > /dev/ttyUSB0), it just doesnt work without a sleep in between steps 1
> > and 2. on my notebook (hp nx7000) sleep(1) is enough. When I try between
> > steps 1 and 2 ioctl TCIOMGET it says RTS is OFF, but I think in real it
> > isnt and I have to sleep to get it working. I tried replace sleep with
> > various flush, drain etc...
> > 
> > am I doing something wrong or is there need of any special commit or
> > something like it for usbserial ?
> 
> What kernel version are you using?
> 
> I don't see anything in the pl2303 driver that would require you to wait
> between those commands, sorry.  Perhaps the controller in the device is
> a bit slow?
> 
> Why not read back the line settings to make sure your change of them
> worked?
> 
> Sorry I can't help much more.
> 
> greg k-h

Hello again.


I did some tuning, and I found out, what exactly needs to wait.

setting RTS OFF, works on standard serial port immediately. but on
USBserial, it needs some time.
I do it this way:

        ioctl(port, TIOCMGET, &control);    -> RTS is ON
        control &= ~(TIOCM_RTS);            
        ioctl(port, TIOCMSET, &control);    ->should be set RTS OFF
        ioctl(port, TIOCMGET, &control);    -> this says RTS is OFF, but in
real it is not.

TIOCMSET needs some time to set RTS OFF e.g. sleep(1);
strange is that checking for TIOCMGET without sleep says RTS is OFF so I
cannot wait with while statement (while (RTS OFF) {TIOCMGET}).

I think this must be a problem of USBserial chip in the cable, not a
device connected to it.

Is there any other way of checking what state is RTS in ?? i mean
something low level ? or checking if usbserial chip is busy ?

it should be possible, because using original software on MS Windows
doesnt have this problem. (or it uses simply sleep :-( )

t.h.






-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to