[Gambas-user] Serial Port Write Error Problem and USB

nando nando_f at ...951...
Tue Jul 5 07:16:52 CEST 2005


Daniel,

I use FC2.
I hope you understood that /dev/ttyS0 (not USB) was affected
when adding/subtracting any USB device.

Minicom does not experience the same problem.
Perhaps Minicom does what you suggest.

I will modify my code, although I am currently
thinking it's a Gambas problem.

Thanks for you help.
-Fernando



---------- Original Message -----------
From: Daniel Campos <danielcampos at ...282...>
To: gambas-user at lists.sourceforge.net
Sent: Sun, 03 Jul 2005 19:17:20 +0200
Subject: Re: [Gambas-user] Serial Port Write Error Problem and USB

> Hi:
> 
> It seems it is a low-level problem, I mean something happens in the 
> Linux Kernel
> when removing or adding an USB device... or may be the hot-plug 
> system from your distribution, I think the thing you can do from a 
> Gambas program (or a C program working with serial port devices 
> through the standard interface) is trying to detect and recover from 
> the problem:
> 
> 1) You can do
> 
> TRY WRITE
> 
> instead of
> 
> WRITE
> 
> 2) If the system does not recover the link between the serial port 
> device and the PC, you can
> do (pseudocode):
> 
> TRY WRITE
> 
> IF ERROR THEN
> 
>     TRY CLOSE #SerialPort
>     (OPEN AGAIN THE SERIAL PORT)
> 
> END IF
> 
> Regards,
> 
> D. Campos
> 
> nando escribió:
> 
> >Bemoit, Daniel
> >
> >I have a serial port program that currently is configured for 
> >/dev/ttyS0 and it runs fine.
> >
> >On the same machine, I have a USB serial port adapter.
> >When plugged in it is /dev/ttyUSB0
> >
> >While the serial port program is running, when I remove or attach
> >the USB serial port, a WRITE ERROR occurs with /dev/ttyS0 which is odd!!
> >
> >I can tell you where there error occurs in the Serial Port Program
> >which is taken from the Serial Port program Example in Gambas.
> >
> >PUBLIC SUB Write_Serial (a as string)
> >
> >IF Sport.Status = Net.Inactive THEN
> >
> >   Message ("Open port first!")
> >
> >ELSE
> >  
> >   WRITE #Sport, a, Len(a)        <------WRITE ERROR OCCURS HERE
> >
> >ENDIF
> >
> >END SUB
> >
> >It only happens with adding or removing USB things - not just serial ports
> >but USB mouse and USB Keyboard and USB touch screen too.
> >
> >I certainly hope the USB subsystem is playing with open com ports.
> >
> >-Fernando
> >
> >
> >-------------------------------------------------------
> >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> >from IBM. Find simple to follow Roadmaps, straightforward articles,
> >informative Webcasts and more! Get everything you need to get up to
> >speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> >_______________________________________________
> >Gambas-user mailing list
> >Gambas-user at lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
> >  
> >
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration 
> Strategies from IBM. Find simple to follow Roadmaps, straightforward 
> articles, informative Webcasts and more! Get everything you need to 
> get up to speed, fast. 
> http://ads.osdn.com/?ad_idt77&alloc_id492&opÌk
_______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list