Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a TrueRNG USB-based hardware RNG, and I am trying to read its output on Mac OS X 10.9.2. I need just one-way communication.

The device says that it appears as a "CDC Virtual Serial Port", and indeed I see it as /dev/tty.usbmodem1411.

I've never been able to cat /dev/tty.usbmodem1411; when I do, I get no output at all. I can, however, use minicom or picocom to read from it. With picocom, it works even with --noinit --noreset options, suggesting that I should be able to cat that device.

So, my issues/questions:

  1. Why can I not cat that device?
  2. Though it works with minicom and picocom, it works just on the first session: if I close either of these programs, then reopen them, then they read about 300 bytes and block forever. If I close and reopen again, they can't read anything. When I unplug and replug the USB device, though, it's again readable forever on the first attempt. Why would this be, and does it have to do with this quote from TrueRNG documentation? "By clearing the DTR flag on the virtual serial port, the stream of data will stop. The stream of data will resume when DTR is set."
  3. I want to view the random data in hex. So I try this command: picocom /dev/tty.usbmodem1411 | xxd -p. The output, however, doesn't seem to respect the newline character; just the carriage return. It moves to the next line without rewinding to the beginning of the line. I'd prefer it to be continuous.

Here's some diagnostics:

% stty -a -f /dev/tty.usbmodem1411
speed 9600 baud; 0 rows; 0 columns;
lflags: -icanon -isig -iexten -echo -echoe -echok -echoke -echonl
        -echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin
        -nokerninfo -extproc
iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel -iutf8
        -ignbrk -brkint -inpck -ignpar -parmrk
oflags: -opost -onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;
share|improve this question
    
Can you try with cat /dev/tty.usbmodem1411 | hexdump -C (with cat you may be able to read from it, but quite a few characters are not printable). In addition, you could use dd if=/dev/tty.usbmodem1411 –  Nikolaidis Fotis Apr 27 at 0:35
    
Nikolaidis, thanks for your comment. Like I mentioned, with cat I cannot read from it. Absolutely no data comes out, whether printable or unprintable. Same for dd. –  Philip Apr 28 at 6:22

1 Answer 1

Apparently I needed to use /dev/cu.usbmodem1234 instead of dev/tty.usbmodem1234. Thanks for the solution to the company that manufactures this device.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.