Reading USB GPS information with Python

I wrote a small python script that uses information from the usb gps key. So far I have been working on Linux, where I could just identify the device in / dev / and read NMEA data with pySerial. This is not an ideal solution, although it is not platform independent, so I started looking at pyUSB to try to contact the device.

Device:

  • Product Name: ND-100S
  • baud rate: 4800
  • USB Class: 0xEF
  • subclass: 2

My problem is that I know very little about usb, so I do not know how to initialize and read sentences from it.

My test code looks like this:

import usb
import sys

device = usb.core.find(bDeviceClass=0xef)

print " + Class: %s" % device.bDeviceClass
print " + Subclass: %i" % device.bDeviceSubClass
print " + Protocol: %i" % device.bDeviceProtocol
print " + Length  : %s" % device.bLength
print " + Configurations: %i" % device.bNumConfigurations

... basically just getting device information.

Does anyone have any experience?

+3
source share
1 answer

USB-, GPS . , NMEA, , , , python-gpsd.

0

All Articles