Search code examples
javaeclipsexbee

XbeeException : Could not find port: /dev/tty.usbserial-A6005uPi


I try to run an example using the API of XBee.

When I execute the program in Eclipse, I obtain this error :

Stable Library
=========================================
Native lib Version = RXTX-2.2pre2
Java lib Version   = RXTX-2.1-7
WARNING:  RXTX Version mismatch
    Jar version = RXTX-2.1-7
    native lib Version = RXTX-2.2pre2
[2015-12-01 08:56:35,652] [main] [ERROR] [com.rapplogic.xbee.examples.ApiAtExample] at command failed 
com.rapplogic.xbee.api.XBeeException: Could not find port: /dev/tty.usbserial-A6005uPi
    at com.rapplogic.xbee.SerialPortConnection.openSerialPort(SerialPortConnection.java:94)
    at com.rapplogic.xbee.SerialPortConnection.openSerialPort(SerialPortConnection.java:61)
    at com.rapplogic.xbee.api.XBee.open(XBee.java:132)
    at com.rapplogic.xbee.examples.ApiAtExample.<init>(ApiAtExample.java:53)
    at com.rapplogic.xbee.examples.ApiAtExample.main(ApiAtExample.java:76)

Please, can someone explain what this error means? Can someone help me to find solution?

Thanks in advance :)


Solution

  • . The steps of the solution are :
    1, verify the group of ttyUSB0 : ls -la /dev/ttyUSB0 crwxrwx--x 1 root dialout 188, 0 Dec 2 10:01 /dev/ttyUSB0

    Then verify if the user "sam" existe in the same group (dialout) in this case : id -Gn sam sam adm cdrom sudo dip plugdev lpadmin sambashare ,

    In the case that the user is not in the same group it is primordial to add it : sudo usermod -a -G dialout sam

    Finaly, change the permission of ttyUSB0 like this : sudo chmod a+rw /dev/ttyUSB0

    Now if the example is put to run it will be executed correctly