install

来自「gpsd, a popular GPS daemon.」· 代码 · 共 148 行

TXT
148
字号
Here are the steps for installing gpsd and verifying its performance:0. The only prerequisites you will absolutely need to build the suiteare C and C++ compilers: C for the gpsd daemon itself and its client Clibrary, C++ for the C++ client-library wrapper.  Having the followingoptional components on your system will enable various additionalcapabilities and extensions:pthreads library       -> support for PPS timekeeping on serial GPSesDBUS                   -> gpsd will issue DBUS notifications X windows + lesstif    -> two test clients depend on thisncurses                -> two more test clients depend on thisPython                 -> most of the test and profiling tools are in PythonThe build degrades gracefully in the absence of any of these. You shouldbe able to tell from configure messages which extensions you will get.1. Start by making sure you can get data from your GPS, otherwise the latersteps will be very frustrating.  In this command      stty -F /dev/ttyXXX ispeed 4800 && cat </dev/ttyXXXreplace ttyXXX with the filename of the port.  This will probably beeither /dev/ttyUSB0 or /dev/ttyS0.  When you run this command, youshould see text lines beginning with $ come to stdout (possibly aftera short initial burst of binary garbage).  If you don't see this, youmay have OS-level problems with your serial support, but more likelyhave the wrong device.  Look again.2. Ensure that device permissions will enable gpsd to read from andwrite to GPS devices even after it drops root privileges.  If you arerunning Fedora Core you can skip this step, as the stock configurationhas the right properties.gpsd requires two things: (1) that GPS devices have group read andwrite enabled, and (2) all of them are have the same group ID as a prototypical device, typically /dev/ttyS0 under Linux or /dev/tty00under *BSD. It does not actually matter what the owning group is, as gpsd will look this up on startup.Before dropping privileges, gpsd will ensure that it has access todevices given to it on the command line by forcing their group readand write permissions on.On a Linux with udev, check the files in /etc/udev/permissions.d toensure that /dev/tty* devices are all created with the same group and with 0660 permissions.When gpsd drops privileges, its default is to set uid to 'nobody' andgroup to the owning group of the prototype device (the configureoption --enable-gpsd-user=foo will cause gpsd to change to 'foo'instead).If your system has the Linux hotplug facility installed you can skipthe permission-setting part; the hotplug scripts will force thepermissions for you.  You still have to make sure all the tty devicesare in the same group.3. Build gpsd from source (skip this step if you have installed a gpsdbinary package).You will need to have either Motif or LessTif installed in order forxgps and xgpsspeed to build; if you don't, you'll get some errorresembling "Xm/Xm.h: No such file or directory".  If you're on a Linuxsystem, you may already have LessTif.  Source code is availablefrom <http://www.lesstif.org/>.Under Ubuntu, you will require libmotif-dev, libxp-dev and libxaw7-devin addition to the standard build-support packages.  You can getall the build prerequisites intalled with "apt-get build-dep gpsd".To build from source, run ./autogen.sh (or sh autogen.sh if thescript does not have execute permission).  Mac OS X users mayneed to do "./autogen.sh --x-includes=/usr/X11R6/include"Note: if you are going to use the RTCM-104 support, you should compilewith gcc4; if you don't have it installed as your default compiler, do this by specifying CC=gcc4 before the autogen.shcommand.  The rtcm.c file confuses the gcc-3.4.[23] optimizerat -O2 level, making it generate incorrect code.Then run make: libgps.so, gpsd, xgps, and xgpsspeed will bebuilt. Copy the app-defaults files xgps.ad and xgpsspeed.ad to yourhome directory or to the system-wide X app-defaults directory.4. Start gpsd.  You'll need to give it as an argument a path to a serial or USB port with a GPS attached to it.5. Once gpsd is running, telnet to port 2947.  Type 'f' to see whatdevice it will query.  If you need to change the device, use 'f='to do so (see the manual page for details). Now plug in your GPS.6. Type "wr" to start raw and watcher modes.  You should see NMEA data(text lines beginning with $) spewing out.  You will also see lineswith a GPSD prefix; these are sentence translations in GPSD protocol.Note that until your GPS has acquired a fix, typing "p" to get positionwill only return this:GPSD,P=?This response does not mean that gpsd is broken or that the GPS is notsending data, merely that gpsd has not yet seen any *valid* position data.You will have to wait for the GPS to acquire satellite lock.  If you have raw or watcher mode on, it should be obvious when you get a lock.7. Start the xgps client.  Calling it with no arguments should do the right thing.  You should see a GUI panel with position/velocity-time information,and a satellite display.  The displays won't look very interesting until the GPS acquires satellite lock.8. Now that you've verified that the code is working, "make install" will install it it in the system directories.  "make uninstall" willundo this.(You won't need to "make install" if you installed from a binary package.)9. Check out the list of supported hardware at    http://gpsd.berlios.de/hardware.htmlIf your GPS isn't on the list, please send us information to add a newline to the table.  Directions are included on that page.We can also use updates of the latest version number known to work withhardware already supported.10. Note for small embedded systems and those without threading.  It ispossible to build gpsd without thread support if you configure with--disable-pps.  You'll lose support for updating the clock from PPS pulses.It's also possible to build without Python via --disable-python, in which case you'd build won't make Python libraries and "make install" won'ttry to install Python tools.11. Note for systems using DBUS: gpsd includes support for shipping fixesas DBUS notifications, but it is not compiled in by default.  Configure with the option "--enable-dbus" to get it working.12. The distribution includes a PHP script that you can use togenerate a PHP status page for your GPS.  You will need php and php-gdinstalled.  To install it, copy the file 'gpsd.php' to your HTTPdocument directory.  The first time it's invoked, it will generate afile called 'gpsd_config.inc' containing configuration information;edit to taste.  Note that for the Google Maps feature work you needto set a valid Google API key in your config file.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?