summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-04-28 14:53:01 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-04-28 14:53:01 +0000
commit7a2ad6681fd5892577fe7d9c80d13eca96e99541 (patch)
tree8c9336afb948bdf0807fe45746ead93db9964a6e /hcid
parent403066f6cd6f4df68f68178acc2db0926370e95c (diff)
Make D-Bus a mandatory requirement
Diffstat (limited to 'hcid')
-rw-r--r--hcid/Makefile.am34
-rw-r--r--hcid/hcid.h13
-rw-r--r--hcid/main.c10
-rw-r--r--hcid/security.c27
4 files changed, 12 insertions, 72 deletions
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);