Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Why “sudo cat /dev/ttyACM0” run only 1 time? (GPS)

  1. Mar 10, 2017 #1
    hi group,

    I am working on the GPS data collection, I Need help. If anyone who has been working on the u-blox GNSS Evaluation Kit Time EVK-M8T before and have seen it, please help.
    I do not know why sudo cat /dev/ttyACM0 only 1 time.

    I have the U-blox EVK-M8T which can read the NMEA messages through the Ubuntu terminal window. When I have good set up, and type the command `sudo cat /dev/ttyACM0, it show me the NMEA meassages, such as:

    $GLGSV,3,3,09,87,06,340,*52
    $GNGLL,,,,,140236.00,V,N*56
    $GNZDA,140236.00,10,03,2017,00,00*7C
    $GNRMC,140236.85,V,,,,,,,100317,,,N*68
    $GNVTG,,,,,,,,,N*2E
    $GNGGA,140236.85,,,,,0,00,99.99,,,,,,*77
    $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
    $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
    $GPGSV,3,1,12,10,76,330,52,11,03,322,44,12,23,100,47,14,32,270,44*7E
    $GPGSV,3,2,12,15,10,077,,18,70,123,46,20,02,130,47,21,22,189,47*73
    $GPGSV,3,3,12,24,40,050,49,25,16,142,39,31,13,211,48,32,52,288,50*72
    $GLGSV,3,1,09,69,26,096,28,70,62,024,37,71,30,315,29,73,37,171,36*6A
    $GLGSV,3,2,09,79,20,030,,80,64,095,31,85,09,235,27,86,20,287,33*62
    $GNGLL,,,,,140236.85,V,N*5B
    $GNZDA,140236.85,10,03,2017,00,00*71

    but suddenly, it stopped running without touching anything, I did not know why, and I tried to run again but it did not run. Until, mechanically unplug USB cable and connect a gain, it worked.

    it happend again again and again...

    Does anyone know what is going on?

    Thank you.
     
  2. jcsd
  3. Mar 10, 2017 #2

    NascentOxygen

    User Avatar

    Staff: Mentor

    I know nothing about your GPS data stuff. But if you are cat'ing a file the process will run until it encounters EOF. If your tty device does not send an EOF character then the cat process will just wait patiently for more data from that tty. So I think you are seeing the process run and not terminate, but you don't realize it. It is not terminating until you unplug things and ungraciously cause it to be killed.

    Does that sound to be what's happening?
     
  4. Mar 10, 2017 #3
    maybe it is true, because when it stops running on the Ubuntu terminal window, but the LED light of the device is still blinking every 1 second.

    If you know something about it, can you tell me how to save those data into text file or dat file.....

    Thank you.
     
  5. Mar 10, 2017 #4

    anorlunda

    User Avatar
    Science Advisor
    Gold Member

    Kudos. That is exactly the kind of hypothesis that is the essence of effective software troubleshooting Think of a scenario that matches the evidence.
     
  6. Mar 10, 2017 #5

    NascentOxygen

    User Avatar

    Staff: Mentor

    How quickly does it take for that complete data read, just a second or two?

    You could start an asynchronous process that waits for sufficient time for cat to complete, then kills your cat.

    In place of cat, consider dd as a utility to copy the device data to a file. dd has unusual syntax, so man dd
     
  7. Mar 10, 2017 #6
    I think 1 second gives me info. of the list which I posted above, and every second gives update of value of the list.

    And I do not understand how to kill cat, and man dd.

    Could you please give me in a little detail, so i can understand.

    Thank you very much.
     
  8. Mar 10, 2017 #7

    NascentOxygen

    User Avatar

    Staff: Mentor

    'man' is the linux online manual, it returns documentation on linux commnds
    man kill
    man dd

    Then google and look for examples in shell scripts where these are used.
     
  9. Mar 10, 2017 #8

    NascentOxygen

    User Avatar

    Staff: Mentor

    I know nothing about GPS data. Does one of these 'words' indicate the end of your block of useful data? If so, it might be sufficient for your shell script to loop through reading and writing each line to a file until it finds that end word, then exiting the shell script. This approach would be simpler, and you'd not need to use kill.

    The shell command for reading one line is: read -r

    Is this problem part of some exercise or homework in your studies?
     
  10. Mar 10, 2017 #9
    Wait, I'm confused, what do you expect cat to do? Cat doesn't stick around, it dumps the file and then closes.

    Do you mean to use "tail -f"?
     
  11. Mar 10, 2017 #10

    NascentOxygen

    User Avatar

    Staff: Mentor

    I was a little surprised that cat did seem to be waiting. Poster can easily check if it is using: ps
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Why “sudo cat /dev/ttyACM0” run only 1 time? (GPS)
Loading...