2

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.

  • File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
  • The necessary library (e.g.. for Linux 32bit, the librxtxSerial.so) should go under JDKDIR/jre/bin/
  • librxtxSerial.so in lib/bin also

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.

Jakkra
  • 641
  • 8
  • 25

1 Answers1

3

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

Community
  • 1
  • 1
Seth
  • 1,545
  • 1
  • 16
  • 30
  • Done all of that before, I know I have the right setup since it do find tty ports, however still can't find the Broadcom hidraw port. I have recompiled the RXTXCommDriver class with so it searches for hidraw as seen in my question. Perhaps it should be written on some other way rather than just "hidraw"? – Jakkra Nov 11 '15 at 15:27
  • 6
    @Jakkra Did you try this? `Please note that on Ubuntu 11.04, the Arduino Uno and possibly others are recognised as /dev/ttyACMxx . The RXTX library only searches through /dev/ttySxx, so you need to make symlinks if your distro does the same, so for example ln -s /dev/ttyACM0 /dev/ttyS33 .` I'm not sure if this is still a thing on Ubuntu 14.04 though, but I somehow can't manage to find some actual guidance regarding this topic, it seems like there are not that many people encountering any problems with the commportIdentifier. – Seth Nov 12 '15 at 13:33
  • @DrAhmedJava Glad to hear that! – Seth May 17 '17 at 12:29
  • @Seth thank you very much ! It works well for my machine . awesome useful ! – Lancer.Yan Sep 02 '19 at 15:51