diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-03-09 20:10:25 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-03-09 20:10:25 +0000 |
commit | 26e7f9195005deda91eea83f368c0d53ec95856c (patch) | |
tree | dfac803d97563ae5d8e116efa19dae10cd72ad18 /hcid/device.c | |
parent | ddeb6ab85924294cbeb6c64321cadef508c347aa (diff) |
More use of the generic logging functions
Diffstat (limited to 'hcid/device.c')
-rw-r--r-- | hcid/device.c | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/hcid/device.c b/hcid/device.c index f81ac693..b67f87a7 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -29,7 +29,6 @@ #include <errno.h> #include <stdlib.h> #include <stdarg.h> -#include <syslog.h> #include <string.h> #include <sys/time.h> #include <sys/stat.h> @@ -39,6 +38,8 @@ #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> +#include "hcid.h" + #include "textfile.h" #include "oui.h" @@ -87,28 +88,6 @@ static struct hci_dev devices[MAX_DEVICES]; #define ASSERT_DEV_ID { if (dev_id >= MAX_DEVICES) return -ERANGE; } -static void info(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vsyslog(LOG_INFO, format, ap); - - va_end(ap); -} - -static void err(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vsyslog(LOG_ERR, format, ap); - - va_end(ap); -} - void init_devices(void) { int i; @@ -164,13 +143,13 @@ int start_device(uint16_t dev_id) dd = hci_open_dev(dev_id); if (dd < 0) { - err("Can't open device hci%d", + error("Can't open device hci%d", dev_id, strerror(errno), errno); return -errno; } if (hci_read_local_version(dd, &ver, 1000) < 0) { - err("Can't read version info for hci%d: %s (%d)", + error("Can't read version info for hci%d: %s (%d)", dev_id, strerror(errno), errno); return -errno; } @@ -213,13 +192,13 @@ int get_device_address(uint16_t dev_id, char *address, size_t size) dd = hci_open_dev(dev_id); if (dd < 0) { - err("Can't open device hci%d", + error("Can't open device hci%d", dev_id, strerror(errno), errno); return -errno; } if (hci_read_bd_addr(dd, &dev->bdaddr, 2000) < 0) { - err("Can't read address for hci%d: %s (%d)", + error("Can't read address for hci%d: %s (%d)", dev_id, strerror(errno), errno); return -errno; } @@ -269,7 +248,7 @@ static int digi_revision(uint16_t dev_id, char *revision, size_t size) dd = hci_open_dev(dev_id); if (dd < 0) { - err("Can't open device hci%d", + error("Can't open device hci%d", dev_id, strerror(errno), errno); return -errno; } @@ -283,7 +262,7 @@ static int digi_revision(uint16_t dev_id, char *revision, size_t size) rq.rlen = sizeof(buf); if (hci_send_req(dd, &rq, 2000) < 0) { - err("Can't read revision for hci%d: %s (%d)", + error("Can't read revision for hci%d: %s (%d)", dev_id, strerror(errno), errno); return -errno; } @@ -361,13 +340,13 @@ int get_device_name(uint16_t dev_id, char *name, size_t size) dd = hci_open_dev(dev_id); if (dd < 0) { - err("Can't open device hci%d", + error("Can't open device hci%d", dev_id, strerror(errno), errno); return -errno; } if (hci_read_local_name(dd, sizeof(tmp), tmp, 2000) < 0) { - err("Can't read name for hci%d: %s (%d)", + error("Can't read name for hci%d: %s (%d)", dev_id, strerror(errno), errno); return -errno; } @@ -387,13 +366,13 @@ int set_device_name(uint16_t dev_id, const char *name) dd = hci_open_dev(dev_id); if (dd < 0) { - err("Can't open device hci%d", + error("Can't open device hci%d", dev_id, strerror(errno), errno); return -errno; } if (hci_write_local_name(dd, name, 5000) < 0) { - err("Can't read name for hci%d: %s (%d)", + error("Can't read name for hci%d: %s (%d)", dev_id, strerror(errno), errno); return -errno; } |