On 04/16/2012 02:31 PM, Dave Taht wrote:
On Mon, Apr 16, 2012 at 2:37 AM, Christian Gagneraud<ch...@techworks.ie>  wrote:
On 05/04/12 16:19, Dave Taht wrote:
I note that I have been tracking the latest gpsds closely (with the new
api)

A problem is that it requires that scons support be added to the
mainline openwrt build.

Got patches for all that, could use some more testing...

Hi Dave,

I'm interesting as well to see gpsd updated to the latest stable version,
would you mind to share your patches? I'll be happy to give them a try!
The newly released gpsd 3.5 is currently living in the ceropackages
repository, and has only been tested on the wndr3700v2 (and not quite
3.5 was tested - 3.5 was released saturday)

It also requires that chkpath and scons support be added to the main openwrt .

(aformentioned scons support is also required for things like xorp)

you can either add the ceropackages repo to your feeds.conf

src-git cero git://github.com/dtaht/ceropackages.git
./scripts/feeds uninstall gpsd
./scripts/feeds install cero gpsd

or extract the latest gpsd package from:
https://github.com/dtaht/ceropackages/tree/master/net

As for the scons and chrpath support, patches are at:

http://huchra.bufferbloat.net/~cero1/for_openwrt/

I'm sure eric would love to see gpsd 2.x retired from openwrt
(and I'd love the lua interface you just did)

I've just send a patch on the luci mailing list, this is not very clean. but it's a good start I think. I did not have time to test your 3.X version. It would be nice to have this version upstream here.
This way, i'll update my gpsd patch for luci.
On the side, I have as well a luci application for AIS related stuff. But this one is a bit more tricky to get the data on the client side. I'll speak more on this on the gpsd mailing list, as I would like to submit a contrib "aisd" python script.



(hat off to swalker for packaging this stuff up and eric for taking
  the openwrt related patches into his mainline)



Chris



On Thu, Apr 5, 2012 at 3:02 AM, Viktar Palstsiuk
<viktar.palsts...@promwad.com>    wrote:
Signed-off-by: Viktar Palstsiuk<viktar.palsts...@promwad.com>
---
  lang/luagps/Makefile                               |   50
++++++++++++++++
  .../001-add_compatibility_with_old_gpsd_api.patch  |   62
++++++++++++++++++++
  2 files changed, 112 insertions(+), 0 deletions(-)
  create mode 100644 lang/luagps/Makefile
  create mode 100644
lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch

diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
new file mode 100644
index 0000000..268e826
--- /dev/null
+++ b/lang/luagps/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License
v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luagps
+PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luagps
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua bindings for libgps
+  URL:=https://github.com/jdegges/lua-gps
+  DEPENDS:=+lua +gpsd
+endef
+
+define Package/luagps/description
+  Lua bindings for libgps.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall
-I$(STAGING_DIR)/usr/include/
+TARGET_LDFLAGS += -lgps
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
$(PKG_BUILD_DIR)/lgps.c -o $(PKG_BUILD_DIR)/gps.so
+endef
+
+define Package/luagps/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luagps))
diff --git
a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
new file mode 100644
index 0000000..63a7f3d
--- /dev/null
+++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
@@ -0,0 +1,62 @@
+--- a/lgps.c   2012-04-05 11:19:27.000000000 +0300
++++ b/lgps.c   2012-04-05 12:28:17.000000000 +0300
+@@ -30,7 +30,6 @@
+ static int
+ lgps_open (lua_State *L)
+ {
+-  int top = lua_gettop (L);
+   struct gps_data_t *ud = NULL;
+   const char *server = luaL_checkstring (L, 1);
+   const char *port = luaL_checkstring (L, 2);
+@@ -39,8 +38,13 @@
+   if (NULL == ud)
+     print_error ("out of memory");
+
++#if (GPSD_API_MAJOR_VERSION>    4)
+   if (0 != gps_open (server, port, ud))
+     print_error ("no gpsd running or network error: %d, %s", errno,
gps_errstr (errno));
++#else
++  if (0 != gps_open_r (server, port, ud))
++    print_error ("no gpsd running or network error: %d, %s", errno,
gps_errstr (errno));
++#endif
+
+   luaL_getmetatable (L, MT_GPS);
+   lua_setmetatable (L, -2);
+@@ -86,9 +90,13 @@
+ lgps_waiting (lua_State *L)
+ {
+   struct gps_data_t *ud = luaL_checkudata (L, 1, MT_GPS);
+-  lua_Integer timeout = luaL_checkinteger (L, 2);
+
++#if (GPSD_API_MAJOR_VERSION>    4)
++  lua_Integer timeout = luaL_checkinteger (L, 2);
+   lua_pushboolean (L, gps_waiting (ud, timeout));
++#else
++  lua_pushboolean (L, gps_waiting (ud));
++#endif
+
+   return 1;
+ }
+@@ -108,7 +116,12 @@
+   int count;
+   int i;
+
++#if (GPSD_API_MAJOR_VERSION>    4)
+   count = gps_read (ud);
++#else
++  count = gps_poll (ud) + 1;
++#endif
++
+   if (count<= 0)
+     print_error ("either no data or error reading data");
+
+@@ -247,7 +260,9 @@
+   SET_CONST_INT (WATCH_RARE);
+   SET_CONST_INT (WATCH_RAW);
+   SET_CONST_INT (WATCH_SCALED);
++#if (GPSD_API_MAJOR_VERSION>    4)
+   SET_CONST_INT (WATCH_TIMING);
++#endif
+   SET_CONST_INT (WATCH_DEVICE);
+   SET_CONST_INT (WATCH_NEWSTYLE);
+   SET_CONST_INT (WATCH_OLDSTYLE);
--
1.7.9.1

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel




--
Christian Gagneraud,
Embedded systems engineer.
Techworks Marine
1 Harbour road
Dun Laoghaire
Co. Dublin
Ireland
Tel: + 353 (0) 1 236 5990
Web: http://www.techworks.ie/



_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to