USB Programming

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Lui

    #1

    USB Programming

    Hi,

    Where would be a good place to go to find resources on programming USB
    device drivers, or programs that just reads data from USB devices.
    (Example: reading signals from USB GPS receiver).

    I just need a starting place to research it.

    Thanks,
    Martin
  • carl mcguire

    #2
    Re: USB Programming



    Martin Lui wrote:[color=blue]
    > Hi,
    >
    > Where would be a good place to go to find resources on programming USB
    > device drivers, or programs that just reads data from USB devices.
    > (Example: reading signals from USB GPS receiver).
    >
    > I just need a starting place to research it.
    >
    > Thanks,
    > Martin[/color]

    Google?

    Comment

    • Fao, Sean

      #3
      Re: USB Programming

      "Martin Lui" <cs9e-1at@pentagon.CS .Berkeley.EDU> wrote in message
      news:Pine.SOL.4 .56.03102203065 80.20522@pentag on.CS.Berkeley. EDU...[color=blue]
      > Hi,
      >
      > Where would be a good place to go to find resources on programming USB
      > device drivers, or programs that just reads data from USB devices.
      > (Example: reading signals from USB GPS receiver).[/color]

      Seriously, start with Google and then move on to a newsgroup pertaining to
      your intended platform. There is a lot involved with writing USB drivers
      and none of it have anything directly to do with the C language.


      Comment

      • Gordon Burditt

        #4
        Re: USB Programming

        >Where would be a good place to go to find resources on programming USB[color=blue]
        >device drivers, or programs that just reads data from USB devices.
        >(Example: reading signals from USB GPS receiver).
        >
        >I just need a starting place to research it.[/color]

        This is largely off-topic for comp.lang.c, but there is some
        relevance in my answer.

        Your system might provide a file name you can use fopen() on to
        read the data stream for the USB device. (On my laptop it's
        "/dev/ugen0.1"). You don't seem to have to ask for the data, it
        just arrives continually. You can then use fgets() to read in NMEA
        sentences. strtok() is generally unsuitable for parsing it (a GPS
        receiver may leave a blank field with two consecutive commas, which
        strtok() considers to be a single field separator. strsep() as
        found in BSD Unix, while not standard, works better for this purpose).

        My GPS daemon could almost be written in ANSI C, with command-line
        supplied system-specific filename, except for the part about stuffing
        the current position information into a shared memory segment where
        other programs can look at it. I suppose I could have kept re-writing
        the data into a file, but I thought that wasn't real-time enough.

        The line *might* end in a \r\n combination even on systems where
        normal files have lines that end in just \n as they are stored, so
        you might want to intentionally ignore a \r character if one shows
        up. Other than this, NMEA sentences are in plain text (ASCII on
        all GPS receivers I have heard of).

        $GPRMC,011518,A ,3240.1036,N,09 727.3581,W,0.02 3,324.2,181003, 5.6,E*63
        ^^^^^^^^^^^
        32 degrees, 40.1036 minutes north latitude

        $GPRMC,011518,A ,3240.1036,N,09 727.3581,W,0.02 3,324.2,181003, 5.6,E*63
        ^^^^^^^^^^^^
        97 degrees 27.3581 minutes west longitude

        $GPRMC,011518,A ,3240.1036,N,09 727.3581,W,0.02 3,324.2,181003, 5.6,E*63
        ^^^^^^ ^^^^^^
        01:15:18 UTC October 18, 2003

        There's also speed in knots, compass direction, magnetic variation
        from true north, and a checksum in there. And there are other
        sentences with other information.

        Gordon L. Burditt

        Comment

        • Max M
          New Member
          • Jul 2006
          • 3

          #5
          If you want to read from USB GPS receiver .. use Python...
          You're program will be less than 10 lines...

          I just did one...

          Comment

          Working...