Jakkra
Jakkra

Reputation: 651

CommPortIdentifier.getPortIdentifiers() RXTX not listing all ports

I'm trying to first of all list ports on Ubuntu 14.04 LTS but not all ports are detected, it only displays tty. I want to access the hidraw one, see below.

I have read/write permission on the lock file for everyone.

The librxtxSerial.so is for x86_64 (my computer: Intel i7 4790k Running Ubuntu 64 bit)

dpkg --print-architecture
amd64

uname -a 
Linux KrantzUbuntu 3.13.0-65-generic #106-Ubuntu SMP Fri Oct 222:08:27 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

When I list connected ports in the terminal I get those:

/dev/hidraw4 - Broadcom_Corp_BCM20702A0_54271EFCD756
/dev/input/event14 - Broadcom_Corp_BCM20702A0_54271EFCD756
/dev/input/mouse1 - Broadcom_Corp_BCM20702A0_54271EFCD756
/dev/input/event2 - Logitech_Gaming_Mouse_G400
/dev/input/mouse0 - Logitech_Gaming_Mouse_G400
/dev/hidraw0 - Logitech_Gaming_Mouse_G400
/dev/usb/hiddev0 - Logitech_Gaming_Mouse_G400
/dev/hidraw1 - Logitech_Gaming_Mouse_G400
/dev/input/event3 - CM_Storm_Quickfire_TKL_6keys
/dev/hidraw2 - CM_Storm_Quickfire_TKL_6keys
/dev/input/event4 - CM_Storm_Quickfire_TKL_6keys
/dev/hidraw3 - CM_Storm_Quickfire_TKL_6keys

The on I want to use later on is the /dev/hidraw4 one, which is a Bluetooth mobile phone.

I have recompiled the RXTXCommDriver class search for more ports on Linux and added:

if(osName.equals("Linux"))
                {
                    String[] Temp = {
                    "sr",
                    "hidraw",
                    "usb",
                    "input",
                    "sr0",
                    "ttyS", // linux Serial Ports
                    "ttySA", // for the IPAQs
                    "ttyUSB", // for USB frobs
                    "rfcomm",       // bluetooth serial device
                    "ttyircomm", // linux IrCommdevices (IrDA serial emu)
                    };
                    CandidatePortPrefixes=Temp;
                }

But still doesn't list hidraw.

Upvotes: 2

Views: 4510

Answers (1)

Seth
Seth

Reputation: 1535

Try out these steps (I do hope that they'll help you fix your problem):

  • Check if the .so-file is on your classpath. You can download prebuilt binaries, 32-bit and 64-bit. Links can be found in this thread: RXTX can't list port on ubuntu
  • Verify that you actually do have the required permissions (example for USB0):

    sudo chmod 666 /dev/ttyUSB0
    

    Note: This will only be active until you reboot your computer, so in case it fixes your problem you'll probably want to create an udev rule (Google: udev usb permissions) to permanently take care of that problem.

I'm pretty sure that you've found this snippet already, but just in case you didn't I'll leave it here: Discovering comm ports

Sources (just in case anyone wants to read the full articles/questions/answers):

RXTX can't list port on ubuntu

CommPortIdentifier.getPortIdentifiers with zero ports on Linux

ttyUSB0 permission changes after restart

Upvotes: 3

Related Questions