OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../kdebase-workspace/0001-kdebase-workspace-gpsd-api.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From: Rafael Fernández López <ereslibre@kde.org>
  17. Date: Thu, 28 Apr 2011 11:35:53 +0000
  18. Subject: gpsd api has changed and for GPSD_API_MAJOR_VERSION >=5 there are
  19. X-Git-Url: http://quickgit.kde.org/?p=kde-workspace.git&amp;a=commitdiff&amp;h=a3009dd96e8519bcc205d75c29e18bbbb81fce03
  20. ---
  21. gpsd api has changed and for GPSD_API_MAJOR_VERSION >=5 there are
  22. some calls that are slightly different. Make the dataengine compile
  23. against this version and previous one by adding conditional code.
  24. REVIEW: 101247
  25. ---
  26. --- a/plasma/generic/dataengines/geolocation/location_gps.cpp
  27. +++ b/plasma/generic/dataengines/geolocation/location_gps.cpp
  28. @@ -51,7 +51,11 @@ void Gpsd::run()
  29. while (!m_abort) {
  30. Plasma::DataEngine::Data d;
  31. +#if GPSD_API_MAJOR_VERSION >= 5
  32. + if (gps_read(m_gpsdata) != -1) {
  33. +#else
  34. if (gps_poll(m_gpsdata) != -1) {
  35. +#endif
  36. //kDebug() << "poll ok";
  37. if (m_gpsdata->online) {
  38. //kDebug() << "online";
  39. @@ -73,11 +77,19 @@ void Gpsd::run()
  40. Gps::Gps(QObject* parent, const QVariantList& args)
  41. : GeolocationProvider(parent, args),
  42. m_gpsd(0)
  43. +#if GPSD_API_MAJOR_VERSION >= 5
  44. + , m_gpsdata(0)
  45. +#endif
  46. {
  47. - gps_data_t* gpsdata = gps_open("localhost", DEFAULT_GPSD_PORT);
  48. - if (gpsdata) {
  49. +#if GPSD_API_MAJOR_VERSION >= 5
  50. + m_gpsdata = new gps_data_t;
  51. + gps_open("localhost", DEFAULT_GPSD_PORT, m_gpsdata);
  52. +#else
  53. + gps_data_t* m_gpsdata = gps_open("localhost", DEFAULT_GPSD_PORT);
  54. +#endif
  55. + if (m_gpsdata) {
  56. kDebug() << "gpsd found.";
  57. - m_gpsd = new Gpsd(gpsdata);
  58. + m_gpsd = new Gpsd(m_gpsdata);
  59. connect(m_gpsd, SIGNAL(dataReady(const Plasma::DataEngine::Data&)),
  60. this, SIGNAL(setData(const Plasma::DataEngine::Data&)));
  61. } else {
  62. @@ -90,6 +102,9 @@ Gps::Gps(QObject* parent, const QVariant
  63. Gps::~Gps()
  64. {
  65. delete m_gpsd;
  66. +#if GPSD_API_MAJOR_VERSION >= 5
  67. + delete m_gpsdata;
  68. +#endif
  69. }
  70. void Gps::update()
  71. --- a/plasma/generic/dataengines/geolocation/location_gps.h
  72. +++ b/plasma/generic/dataengines/geolocation/location_gps.h
  73. @@ -58,6 +58,9 @@ public:
  74. private:
  75. Gpsd* m_gpsd;
  76. +#if GPSD_API_MAJOR_VERSION >= 5
  77. + gps_data_t* m_gpsdata;
  78. +#endif
  79. };
  80. #endif