You are not logged in.

#1 2011-11-07 22:07:44

mistertransistor
Member
Registered: 2011-11-07
Posts: 15

[SOLVED] usb serial port emulation

Hello
I'm an Arch newbie. I just purchased an HP Neoware CA21 thin client, replaced the small DOM unit by a 1GB module, and installed Arch on it. I would like to use this device as a kind of data logger, 24x7 continuous operation.
  The device I'm reading is an ADC connected via a USB port, which provides a CDC/ACM interface. When I plug it into the CA21 USB port, /dev/ttyACM0 does appear. Under Ubuntu on a normal PC the same happens but I find I can only use it via the usbserial driver, which provides serial port emulation for a USB device, creating /dev/ttyUSB0. That's because I can't get the java serial port interface rxtx to recognise a ttyACMn device, for reasons I don't understand and am still investigating.

So, I have a couple of newbie questions about Arch ...

1/ is there an equivalent to usbserial, ie a serial port emulation for USB ports?
2/ if not, or perhaps more correctly, how can my java app interface to ttyACM0? The Arduino crowd may know about this.
3/ I'm kind of assuming rxtx works under Arch - is that right?

Thanks for any help.
Andrew

Last edited by mistertransistor (2011-11-12 16:43:03)

Offline

#2 2011-11-08 04:51:33

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,785

Re: [SOLVED] usb serial port emulation

I would bet that /dev/ttyACM0 is a serial device.  Is the problem with the Java software insists that it be of the form /dev/USBn ??

If so, you could try creating a soft link to see if it solves the issue

sudo ln -s /dev/ttyACM0 /dev/ttyUSB0

Then try connecting though Java to /dev/tty/USB0.  If it does not work, it could be because of permissions.  You can, as an experiment, change those too.

See if this works -- If it is, it should only be considered to be a transient solution.   If this all works, the better solution will be to modify your udev rules.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2011-11-09 18:34:13

mistertransistor
Member
Registered: 2011-11-07
Posts: 15

Re: [SOLVED] usb serial port emulation

Thanks for the suggestion but that did not work, on Ubuntu where I am testing use of ttyACM0 before adding the extra complication of migrating rxtx plus my app onto Arch. There are a couple of other workarounds on the Web, and they don't work either. I have stopped short of modding the rxtx code and recompiling, but I did try one so-called 'hacked' version of the rxtx jar that was supposed to fix the missing ACM ports, and even that did not work for me.

However, some good progress nevertheless, thanks to this excellent wiki entry:
https://wiki.archlinux.org/index.php/Hu … 0_3G_modem

So by using the modprobe usbserial ... with the parameters of my USB-I2C interface (found using lsusb) I have got Arch to create ttyUSB0 when I plug in the device. I'm reasonably sure that rxtx will work with this. I just need to install a JVM, install rxtx, and install my app. I don't have much free time but I'm hoping that I can mark this solved in a few days ....

Last edited by mistertransistor (2011-11-09 18:35:45)

Offline

#4 2011-11-10 22:49:34

mistertransistor
Member
Registered: 2011-11-07
Posts: 15

Re: [SOLVED] usb serial port emulation

Well, I spoke too soon.

I just spent some happy hours rebuilding the Arch system because my / partition on the flash drive was not big enough. I had got the network and pacman working but the install of openjdk6 ran out of space.

So, after doing it all again, and successfully installing openjdk6 and openssh, I tried plugging in the USB/I2C unit again after setting up the modprobe.conf and it does *not* work - ttyACM0 appears, not ttyUSB0. Same with the modprobe command.

I suppose I could go back to the bare core system and try to reproduce this ... but not tonight.

Offline

#5 2011-11-12 16:42:44

mistertransistor
Member
Registered: 2011-11-07
Posts: 15

Re: [SOLVED] usb serial port emulation

Well, kind of solved. I found that
- adding the "options usbserial ..." line does not prevent ttyACM0 from appearing when the device is plugged in
- once ttyACM0 is there, no amount of "modprobe usbserial ..." will make ttyUSB0 appear
- however, if you "rmmod cdc-acm" and then "modprobe usbserial ..." you will get a ttyUSB0

Having figured that out, I got a test app reading the USB port with no problems. However my real app gave some odd 'Main class not found  ...' error even though the exact same jarfile runs fine under Windows XP (you may be wondering why I develop there rather than under Ubuntu. Well, I have a dual-boot machine XP/Ubuntu and NetBeans runs *much* better under XP - quite puzzling).  Eventually I solved this by creating a new NetBeans project/application and copying in the code from the existing one - a total mystery to me).

So now the device is in my garage collecting data from my seismograph. I'm writing to a USB stick, not sure about how long that will last but as I don't delete files much it's always writing in a new area and any given area gets very few write cycles.

This is marked SOLVED but I still have not found how to read ttyACM0 and I would like to do that.

Andrew

Offline

Board footer

Powered by FluxBB