Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a PortInUseException trying to open USB Serial Port.



Are you using the FTDI chip set and driver and ensured
everything is installed correctly?

Which Java package are you using for serial IO? RXTX?
If so, you need to import it with "import gnu.io.*;".
Also, in order to use RXTX, there's some pre-install
things you need to do to use the port. You also need
to have your .jnilib and .jar files in the write
directory. See www.rxtx.org for more info.

Have you tried writing a simple C program to open the
serial port and read bytes?

Have you tried rebooting to ensure there's no other
process keeping it open?

This is really more of Java programming question than
a USB question, since to the app it just looks like a
serial port. So, you might get more help from the Java
mailing list.

-Steve


--- mohamed rafi <email@hidden> wrote:

> Hi,
> 
> I have connected a Serial Device to my Mac's USB
> Port,
> and its getting recognized (Could see the entries in
> /dev/ folder).
> 
> However, when I try to open the port by doing a 
> 
> serialPort = (SerialPort) portId.open("TestApp",
> 2000);
> (portId is a CommPortIdentifier object)
> 
> I am getting a PortInUseException. Following is the
> stacktrace of the error:
> 
> javax.comm.PortInUseException: Could not open
> usbserial-3B13 
> usbserial-3B13: SerOpenPort failed: : 16
>          at 
>
javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:180)
>          at
>
ScannerFunctionality.main(ScannerFunctionality.java:47)
> Exception in thread "main"
> java.lang.NullPointerException
>          at
>
ScannerFunctionality.main(ScannerFunctionality.java:56)
> 
> Also, I tried to get the port owner, by doing a
> PortInUseException.currentOwner, and this gives as
> 'Unknown'. 
> 
> Any idea of what could be causing this error, and
> how
> to avoid this issue ?
> 
> Thanks,
> Rafi SM
> 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - What will yours do?
> http://my.yahoo.com 
>  _______________________________________________
> Do not post admin requests to the list. They will be
> ignored.
> Usb mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/usb/email@hidden
> 
> This email sent to email@hidden
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >Getting a PortInUseException trying to open USB Serial Port. (From: mohamed rafi <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.