Reading information from the serial port?

Discussion in 'Mac Programming' started by psingh01, May 9, 2008.

  1. psingh01 macrumors 65816

    Apr 19, 2004
    I have a USB EVDO modem with GPS that I'm trying to read data off of. I understand you have to treat it as if it were connected to the serial port (in my case using /dev/cu.wwangps ). Does anyone know how to do this on OS X (read from the serial port)? I would prefer to use Java...but any language would suffice. I've seen examples for windows that use COM1 and COM2 but this doesn't exist in the Mac world.

    Perhaps a pointer to a library or open source project. Thanks :)
  2. numero macrumors regular

    Jul 23, 2002
    I have not done anything with a modem, but I have done raw reads of a USB drive through the /dev file. There are (probably) two pointers to the device in /dev. Do a "ls -l" and look in the far left hand column. The "c" is for character and the "b" is for binary. Open the one that fits your needs. Then you will just need to know the protocol. Write to send data and read to receive data.

    Hope this gets you started.
  3. psingh01 thread starter macrumors 65816

    Apr 19, 2004
    Thanks. I was originally just trying to read like a normal file but it wasn't working....because I had another gps utility running. It was tying up the device. Now just simply doing readLine() works fine.

Share This Page