Fwd: gpsd support

Peter Stuge peter at stuge.se
Tue Feb 22 13:58:57 UTC 2011


Dario Lombardo wrote:
> +++ b/src/host/layer23/src/common/gps.c
..
> @@ -343,11 +344,38 @@ void osmo_gps_close(void)
>  	gps_bfd.fd = -1; /* -1 or 0 indicates: 'close' */
>  }
>  
> -#endif
> -
>  void osmo_gps_init(void)
>  {
>  	memset(&gps_bfd, 0, sizeof(gps_bfd));
>  }
>  
> +int osmo_gps_open(void)
> +{
> +	switch (gps.gps_type) {
> +#ifdef _HAVE_GPSD
> +		case GPS_TYPE_GPSD:
> +			return osmo_gpsd_open();
> +#endif
> +		case GPS_TYPE_SERIAL:
> +			return osmo_serialgps_open();
> +
> +		default:
> +			return 0;
> +	}
> +}

Maybe the program should accept the gpsd options also when not
compiled with support, and throw an error here? Benefit would be
better consistency.


> +++ b/src/host/layer23/src/misc/app_cell_log.c
..
>  static struct l23_app_info info = {
>  	.copyright	= "Copyright (C) 2010 Andreas Eversberg\n",
> -#ifdef _USE_GPSD
> -	.getopt_string	= "l:r:ng:p:",
> +#ifdef _HAVE_GPSD
> +	.getopt_string	= "l:r:nf:b:g:p:",
>  #else
> -	.getopt_string	= "l:r:ng:b:",
> +	.getopt_string	= "l:r:nf:b:",
>  #endif

This part *so* can not scale. Maybe use something like this..

  .getopt_string = "l:r:nf:b" \
#ifdef _HAVE_GPSD
    "g:p:" \
#endif
    "",


> +++ b/src/host/layer23/src/mobile/vty_interface.c
> @@ -855,7 +855,7 @@ DEFUN(cfg_no_gps_enable, cfg_no_gps_enable_cmd, "no gps enable",
>  	return CMD_SUCCESS;
>  }
>  
> -#ifdef _USE_GPSD
> +#ifdef _HAVE_GPSD
>  DEFUN(cfg_gps_host, cfg_gps_host_cmd, "gps host HOST:PORT",

..but again, maybe consider always having the options and commands be
supported, and failing in some other way than invalid option/command
without _HAVE_GPSD.


//Peter




More information about the baseband-devel mailing list