By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,660 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,660 IT Pros & Developers. It's quick & easy.

I have to unplug and plug my USB device every time to communicate :(

P: 2
I am using a linux machine with an USB port and I have to communicate with a temperature controller which has an UART port and for this I am using a USB to UART Serial Adapter.
port name on my machine is /dev/ttyUSB0
Expand|Select|Wrap|Line Numbers
  1. $port = "/dev/ttyUSB0";
  2. open(SERIALPORT,"+>$port") || die("ERROR SENDING DATA\n");
  3. SERIALPORT->autoflush();
  4.  
  5. ## in between I am sending data 
  6.  
  7. print $FILEHANDLE $data;
  8.  
and receiving back from that temperature controller ##

after all that process I am closing that file handle.
Expand|Select|Wrap|Line Numbers
  1. close(SERIALPORT);
  2.  
code is working fine one time . I am getting correct result .

but when I am trying to run the script second time then it hands at the step when I am sending data to temperature controller
Expand|Select|Wrap|Line Numbers
  1.  
  2. print $FILEHANDLE $data;
  3.  
and for this I have to unplug and plug that USB serial adapter again.after that it is working fine.

I am unable to find out what is the problem.
Can u people figure out what may be the possible reasons for it.

Thanks for your reply in advance.
Aug 19 '09 #1
Share this Question
Share on Google+
2 Replies


KevinADC
Expert 2.5K+
P: 4,059
@ashishchauhan
What is the filehandle you are using? Is it $FILEHANDLE or SERIALPORT
Aug 19 '09 #2

P: 2
oh sorry . it is SERIALPORT .
Aug 20 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.