diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 14:53:01 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2006-04-28 14:53:01 +0000 | 
| commit | 7a2ad6681fd5892577fe7d9c80d13eca96e99541 (patch) | |
| tree | 8c9336afb948bdf0807fe45746ead93db9964a6e | |
| parent | 403066f6cd6f4df68f68178acc2db0926370e95c (diff) | |
Make D-Bus a mandatory requirement
| -rw-r--r-- | acinclude.m4 | 12 | ||||
| -rw-r--r-- | configure.in | 2 | ||||
| -rw-r--r-- | daemon/Makefile.am | 2 | ||||
| -rw-r--r-- | hcid/Makefile.am | 34 | ||||
| -rw-r--r-- | hcid/hcid.h | 13 | ||||
| -rw-r--r-- | hcid/main.c | 10 | ||||
| -rw-r--r-- | hcid/security.c | 27 | 
7 files changed, 16 insertions, 84 deletions
| diff --git a/acinclude.m4 b/acinclude.m4 index e9c513db..e3de19d6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -152,7 +152,7 @@ AC_DEFUN([AC_PATH_DBUS], [  	fi  	CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS" -	AC_CHECK_HEADER(dbus/dbus.h, dbus_found=yes, dbus_found=no) +	AC_CHECK_HEADER(dbus/dbus.h, dummy=yes, AC_MSG_ERROR(D-BUS header files not found))  	DBUS_LIBS=""  	if (test "${prefix}" = "${dbus_prefix}"); then @@ -163,8 +163,8 @@ AC_DEFUN([AC_PATH_DBUS], [  	fi  	LDFLAGS="$LDFLAGS $DBUS_LIBS" -	AC_CHECK_LIB(dbus-1, dbus_error_init, DBUS_LIBS="$DBUS_LIBS -ldbus-1", dbus_found=no) -	AC_CHECK_LIB(dbus-1, dbus_message_iter_get_basic, dummy=yes, dbus_found=no) +	AC_CHECK_LIB(dbus-1, dbus_error_init, DBUS_LIBS="$DBUS_LIBS -ldbus-1", AC_MSG_ERROR(D-BUS library not found)) +	AC_CHECK_LIB(dbus-1, dbus_message_iter_get_basic, dummy=yes, AC_MSG_ERROR(D-BUS library not found))  	CPPFLAGS=$ac_save_CPPFLAGS  	LDFLAGS=$ac_save_LDFLAGS @@ -289,7 +289,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [  	fortify_enable=yes  	debug_enable=no  	pie_enable=no -	dbus_enable=${dbus_found}  	obex_enable=${openobex_found}  	fuse_enable=no  	alsa_enable=no @@ -331,10 +330,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [  		bcm203x_enable=${enableval}  	]) -	AC_ARG_ENABLE(dbus, AC_HELP_STRING([--enable-dbus], [enable D-BUS support]), [ -		dbus_enable=${enableval} -	]) -  	AC_ARG_ENABLE(obex, AC_HELP_STRING([--enable-obex], [enable OBEX support]), [  		obex_enable=${enableval}  	]) @@ -396,7 +391,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [  		LDFLAGS="$LDFLAGS -pie"  	fi -	AM_CONDITIONAL(DBUS, test "${dbus_enable}" = "yes" && test "${dbus_found}" = "yes")  	AM_CONDITIONAL(OBEX, test "${obex_enable}" = "yes" && test "${openobex_found}" = "yes")  	AM_CONDITIONAL(FUSE, test "${fuse_enable}" = "yes" && test "${openobex_found}" = "yes" && test "${fuse_found}" = "yes")  	AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes") diff --git a/configure.in b/configure.in index d21e98e1..f3760640 100644 --- a/configure.in +++ b/configure.in @@ -23,8 +23,8 @@ AC_DISABLE_STATIC  AC_PROG_LIBTOOL  AC_PATH_BLUEZ -AC_PATH_OPENOBEX  AC_PATH_DBUS +AC_PATH_OPENOBEX  AC_PATH_FUSE  AC_PATH_ALSA  AC_PATH_USB diff --git a/daemon/Makefile.am b/daemon/Makefile.am index de94dc0f..41875066 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -1,11 +1,9 @@ -if DBUS  noinst_PROGRAMS = bluetoothd  bluetoothd_SOURCES = main.c  bluetoothd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libtextfile.a -endif  AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ diff --git a/hcid/Makefile.am b/hcid/Makefile.am index 385e2e5b..0d4f3c91 100644 --- a/hcid/Makefile.am +++ b/hcid/Makefile.am @@ -7,48 +7,35 @@ statedir = $(localstatedir)/lib/bluetooth  state_DATA = -if DBUS  dbusdir = $(sysconfdir)/dbus-1/system.d  dbus_DATA = bluez-hcid.conf -endif  sbin_PROGRAMS = hcid -noinst_SCRIPTS = dbus-test +noinst_PROGRAMS = passkey-agent -if DBUS -dbus_hcid_sources = dbus.h dbus.c dbus-common.c \ -			dbus-error.c dbus-manager.c dbus-adapter.c \ -			dbus-device.c dbus-service.c dbus-security.c \ -			dbus-sdp.c dbus-rfcomm.c -dbus_hcid_libs    = @DBUS_LIBS@ -dbus_hcid_cflags  = -DENABLE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE -else -dbus_hcid_sources = -dbus_hcid_libs    = -dbus_hcid_cflags  = -endif +noinst_SCRIPTS = dbus-test  hcid_SOURCES = main.c security.c device.c logging.c storage.c \  		sdp.c sdp.h hcid.h parser.h parser.y \ -		lexer.l kword.c kword.h $(dbus_hcid_sources) \ +		lexer.l kword.c kword.h \ +		dbus.h dbus.c dbus-common.c \ +		dbus-error.c dbus-manager.c dbus-adapter.c \ +		dbus-device.c dbus-service.c dbus-security.c \ +		dbus-sdp.c dbus-rfcomm.c \  		$(top_builddir)/tools/oui.h $(top_builddir)/tools/oui.c -hcid_LDADD = $(dbus_hcid_libs) @BLUEZ_LIBS@ \ +hcid_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ \  		$(top_builddir)/common/libglib-ectomy.a \  		$(top_builddir)/common/libtextfile.a \  		$(top_builddir)/common/liblist.a -if DBUS -noinst_PROGRAMS = passkey-agent -  passkey_agent_SOURCES = passkey-agent.c  passkey_agent_LDADD = @DBUS_LIBS@ -endif -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ $(dbus_hcid_cflags) +AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@  INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/tools @@ -58,7 +45,6 @@ AM_YFLAGS = -d  CLEANFILES = lexer.c parser.c parser.h -EXTRA_DIST = $(man_MANS) $(conf_DATA) bluez-hcid.conf dbus-test \ -		dbus.h dbus.c dbus-error.c dbus-manager.c dbus-device.c +EXTRA_DIST = $(man_MANS) $(conf_DATA) bluez-hcid.conf dbus-test  MAINTAINERCLEANFILES = Makefile.in diff --git a/hcid/hcid.h b/hcid/hcid.h index e8765eae..d1c69c1d 100644 --- a/hcid/hcid.h +++ b/hcid/hcid.h @@ -142,7 +142,6 @@ void toggle_pairing(int enable);  void set_pin_length(bdaddr_t *sba, int length); -#ifdef ENABLE_DBUS  gboolean hcid_dbus_init(void);  void hcid_dbus_exit(void);  gboolean hcid_dbus_register_device(uint16_t id); @@ -161,18 +160,6 @@ void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const u  void hcid_dbus_create_conn_cancel(bdaddr_t *local, void *ptr);  void hcid_dbus_setname_complete(bdaddr_t *local);  void hcid_dbus_setscan_enable_complete(bdaddr_t *local); -#else -static inline void hcid_dbus_inquiry_start(bdaddr_t *local) {} -static inline void hcid_dbus_inquiry_complete(bdaddr_t *local) {} -static inline void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, int8_t rssi) {} -static inline void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status, char *name) {} -static inline void hcid_dbus_conn_complete(bdaddr_t *local, uint8_t status, uint16_t handle, bdaddr_t *peer) {} -static inline void hcid_dbus_disconn_complete(bdaddr_t *local, bdaddr_t *peer, uint16_t handle, uint8_t reason) {} -static inline void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status) {} -static inline void hcid_dbus_create_conn_cancel(bdaddr_t *local, void *ptr) {} -static inline void hcid_dbus_setname_complete(bdaddr_t *local) {} -static inline void hcid_dbus_setscan_enable_complete(bdaddr_t *local) {} -#endif  void init_devices(void);  int add_device(uint16_t dev_id); diff --git a/hcid/main.c b/hcid/main.c index ec8c047c..86a4a773 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -536,9 +536,7 @@ static void init_all_devices(int ctl)  		start_device(dr->dev_id); -#ifdef ENABLE_DBUS  		hcid_dbus_register_device(dr->dev_id); -#endif  	}  	free(dl); @@ -581,16 +579,12 @@ static inline void device_event(GIOChannel *chan, evt_stack_internal *si)  		if (hcid.auto_init)  			init_device(sd->dev_id);  		add_device(sd->dev_id); -#ifdef ENABLE_DBUS  		hcid_dbus_register_device(sd->dev_id); -#endif  		break;  	case HCI_DEV_UNREG:  		info("HCI dev %d unregistered", sd->dev_id); -#ifdef ENABLE_DBUS  		hcid_dbus_unregister_device(sd->dev_id); -#endif  		remove_device(sd->dev_id);  		break; @@ -750,12 +744,10 @@ int main(int argc, char *argv[])  	init_devices(); -#ifdef ENABLE_DBUS  	if (hcid_dbus_init() == FALSE) {  		error("Unable to get on D-Bus");  		exit(1);  	} -#endif  	init_security_data(); @@ -782,9 +774,7 @@ int main(int argc, char *argv[])  	free_device_opts(); -#ifdef ENABLE_DBUS  	hcid_dbus_exit(); -#endif  	info("Exit"); diff --git a/hcid/security.c b/hcid/security.c index 6de61c67..d185f085 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -312,29 +312,6 @@ void set_pin_length(bdaddr_t *sba, int length)  	io_data[dev_id].pin_length = length;  } -static void request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci) -{ -#ifdef ENABLE_DBUS -	hcid_dbus_request_pin(dev, sba, ci); -#else -	pin_code_reply_cp pr; -	char *pin = "BlueZ"; -	int len; - -	len  = strlen(pin); - -	set_pin_length(sba, len); - -	memset(&pr, 0, sizeof(pr)); -	bacpy(&pr.bdaddr, &ci->bdaddr); -	memcpy(pr.pin_code, pin, len); -	pr.pin_len = len; - -	hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY, -					PIN_CODE_REPLY_CP_SIZE, &pr); -#endif -} -  static void pin_code_request(int dev, bdaddr_t *sba, bdaddr_t *dba)  {  	pin_code_reply_cp pr; @@ -393,12 +370,12 @@ static void pin_code_request(int dev, bdaddr_t *sba, bdaddr_t *dba)  					PIN_CODE_REPLY_CP_SIZE, &pr);  			} else {  				/* Let PIN helper handle that */  -				request_pin(dev, sba, ci); +				hcid_dbus_request_pin(dev, sba, ci);  			}  		}  	} else {  		/* Let PIN helper handle that */  -		request_pin(dev, sba, ci); +		hcid_dbus_request_pin(dev, sba, ci);  	}  	free(cr); | 
