Mailinglist Archive: opensuse-commit (1157 mails)

< Previous Next >
commit bluez-utils
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Wed, 03 Oct 2007 00:47:04 +0200
  • Message-id: <20071002224705.145606781B8@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package bluez-utils
checked in at Wed Oct 3 00:47:04 CEST 2007.

--------
--- bluez-utils/bluez-utils.changes     2007-09-03 09:55:05.000000000 +0200
+++ /mounts/work_src_done/STABLE/bluez-utils/bluez-utils.changes        2007-09-17 16:11:45.000000000 +0200
@@ -1,0 +2,12 @@
+Mon Sep 17 16:11:21 CEST 2007 - seife@xxxxxxx
+
+- update to v3.19:
+  * Limit range of bitpool announced while in ACP side.
+  * Use poll instead of usleep to wait for worker thread.
+  * Use default event mask from the specification.
+  * Add HID proxy support for Logitech diNovo Edge dongle.
+  * Add refresh option to re-request device names.
+  * Show correct connection link type.
+- fixes bug 325678
+
+-------------------------------------------------------------------

Old:
----
  bluez-utils-3.18.tar.bz2

New:
----
  bluez-utils-3.19.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bluez-utils.spec ++++++
--- /var/tmp/diff_new_pack.k16778/_old  2007-10-03 00:46:50.000000000 +0200
+++ /var/tmp/diff_new_pack.k16778/_new  2007-10-03 00:46:50.000000000 +0200
@@ -1,5 +1,5 @@
 #
-# spec file for package bluez-utils (Version 3.18)
+# spec file for package bluez-utils (Version 3.19)
 #
 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # This file and all modifications and additions to the pristine
@@ -12,14 +12,14 @@
 
 Name:           bluez-utils
 BuildRequires:  alsa-devel bluez-libs cups dbus-1-devel fuse-devel libusb-devel openobex-devel pkgconfig resmgr xorg-x11-devel
-URL:            http://bluez.sourceforge.net
-Version:        3.18
+Url:            http://bluez.sourceforge.net
+Version:        3.19
 Release:        1
 Summary:        Bluetooth Daemons and Utilities
 License:        GPL v2 or later
 PreReq:         %fillup_prereq %insserv_prereq 
 Group:          Hardware/Mobile
-Autoreqprov:    on
+AutoReqProv:    on
 Source:         bluez-utils-%{version}.tar.bz2
 Source1:        bluez-utils_doc.tar.bz2
 Source2:        opd-v0.2-2003-03-18.tgz
@@ -79,7 +79,7 @@
 
 %package -n bluez-test
 Group:          Development/Tools/Debuggers
-License:        GPL v2 or later, X11/MIT
+License:        GPL v2 or later; X11/MIT
 Summary:        Tools for testing of various Bluetooth-functions
 Requires:       bluez-libs >= %( echo `rpm -q --queryformat '%{VERSION}' bluez-libs`) python-gobject2 dbus-1-python
 
@@ -214,6 +214,7 @@
 %{_bindir}/sdptool
 %{_bindir}/ciptool
 %{_bindir}/dfutool
+%{_bindir}/dfubabel
 %{_bindir}/passkey-agent
 %{_bindir}/auth-agent
 %{_sbindir}/hciattach
@@ -249,6 +250,7 @@
 %doc %{_mandir}/man1/rfcomm.1.gz
 %doc %{_mandir}/man1/l2ping.1.gz
 %doc %{_mandir}/man1/dfutool.1.gz
+%doc %{_mandir}/man1/dfubabel.1.gz
 #%doc %{_mandir}/man1/hidd.1.gz
 %dir %{_sysconfdir}/bluetooth
 %config(noreplace) %{_sysconfdir}/bluetooth/hcid.conf
@@ -280,8 +282,16 @@
 %{_bindir}/apitest
 # %{_bindir}/scotest
 %doc %{_defaultdocdir}/bluez-test
-
 %changelog
+* Mon Sep 17 2007 - seife@xxxxxxx
+- update to v3.19:
+  * Limit range of bitpool announced while in ACP side.
+  * Use poll instead of usleep to wait for worker thread.
+  * Use default event mask from the specification.
+  * Add HID proxy support for Logitech diNovo Edge dongle.
+  * Add refresh option to re-request device names.
+  * Show correct connection link type.
+- fixes bug 325678
 * Mon Sep 03 2007 - seife@xxxxxxx
 - update to v3.18:
   * Implement proper locking for headsets.



++++++ bluez-utils-3.18.tar.bz2 -> bluez-utils-3.19.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/acinclude.m4 new/bluez-utils-3.19/acinclude.m4
--- old/bluez-utils-3.18/acinclude.m4   2007-08-28 17:59:36.000000000 +0200
+++ new/bluez-utils-3.19/acinclude.m4   2007-09-16 09:57:28.000000000 +0200
@@ -187,6 +187,7 @@
        avctrl_enable=no
        hid2hci_enable=${usb_found}
        dfutool_enable=no
+       dfubabel_enable=no
 
        AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
                fortify_enable=${enableval}
@@ -207,7 +208,7 @@
                hcid_enable=${enableval}
                sdpd_enable=${enableval}
                hidd_enable=${enableval}
-               pand_enalbe=${enableval}
+               pand_enable=${enableval}
                test_enable=${enableval}
                cups_enable=${enableval}
                manpages_enable=${enableval}
@@ -218,6 +219,7 @@
                avctrl_enable=${enableval}
                hid2hci_enable=${enableval}
                dfutool_enable=${enableval}
+               dfubabel_enable=${enableval}
        ])
 
        AC_ARG_ENABLE(inotify, AC_HELP_STRING([--enable-inotify], [enable inotify support]), [
@@ -332,6 +334,10 @@
                dfutool_enable=${enableval}
        ])
 
+       AC_ARG_ENABLE(dfubabel, AC_HELP_STRING([--enable-dfubabel], [install Babel DFU mode switching utility]), [
+               dfubabel_enable=${enableval}
+       ])
+
        if (test "${fortify_enable}" = "yes"); then
                CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
        fi
@@ -394,4 +400,5 @@
        AM_CONDITIONAL(AVCTRL, test "${avctrl_enable}" = "yes" && test "${usb_found}" = "yes")
        AM_CONDITIONAL(HID2HCI, test "${hid2hci_enable}" = "yes" && test "${usb_found}" = "yes")
        AM_CONDITIONAL(DFUTOOL, test "${dfutool_enable}" = "yes" && test "${usb_found}" = "yes")
+       AM_CONDITIONAL(DFUBABEL, test "${dfubabel_enable}" = "yes" && test "${usb_found}" = "yes")
 ])
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/audio/a2dp.c new/bluez-utils-3.19/audio/a2dp.c
--- old/bluez-utils-3.18/audio/a2dp.c   2007-09-02 18:26:32.000000000 +0200
+++ new/bluez-utils-3.19/audio/a2dp.c   2007-09-16 09:57:29.000000000 +0200
@@ -41,6 +41,9 @@
 #include "sink.h"
 #include "a2dp.h"
 
+#define MAX_BITPOOL 64
+#define MIN_BITPOOL 2
+
 /* The duration that streams without users are allowed to stay in
  * STREAMING state. */
 #define SUSPEND_TIMEOUT 5000
@@ -274,7 +277,7 @@
        else if (supported->allocation_method & A2DP_ALLOCATION_SNR)
                cap->allocation_method = A2DP_ALLOCATION_SNR;
 
-       min_bitpool = MAX(2, supported->min_bitpool);
+       min_bitpool = MAX(MIN_BITPOOL, supported->min_bitpool);
        max_bitpool = MIN(default_bitpool(cap->frequency, cap->channel_mode),
                                                        supported->max_bitpool);
 
@@ -371,6 +374,9 @@
 {
        struct a2dp_sep *a2dp_sep = user_data;
        struct device *dev;
+       struct avdtp_service_capability *cap;
+       struct avdtp_media_codec_capability *codec_cap;
+       struct sbc_codec_cap *sbc_cap;
 
        if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK)
                debug("SBC Sink: Set_Configuration_Ind");
@@ -384,6 +390,24 @@
                return FALSE;
        }
 
+       /* Check bipool range */
+       for (codec_cap = NULL; caps; caps = g_slist_next(caps)) {
+               cap = caps->data;
+               if (cap->category == AVDTP_MEDIA_CODEC) {
+                       codec_cap = (void *) cap->data;
+                       if (codec_cap->media_codec_type == A2DP_CODEC_SBC) {
+                               sbc_cap = (void *) codec_cap;
+                               if (sbc_cap->min_bitpool < MIN_BITPOOL ||
+                                       sbc_cap->max_bitpool > MAX_BITPOOL) {
+                                       *err = AVDTP_UNSUPPORTED_CONFIGURATION;
+                                       *category = AVDTP_MEDIA_CODEC;
+                                       return FALSE;
+                               }
+                       }
+                       break;
+               }
+       }
+
        avdtp_stream_add_cb(session, stream, stream_state_changed, a2dp_sep);
        a2dp_sep->stream = stream;
 
@@ -437,8 +461,8 @@
        sbc_cap.allocation_method = ( A2DP_ALLOCATION_LOUDNESS |
                                        A2DP_ALLOCATION_SNR );
 
-       sbc_cap.min_bitpool = 2;
-       sbc_cap.max_bitpool = 250;
+       sbc_cap.min_bitpool = MIN_BITPOOL;
+       sbc_cap.max_bitpool = MAX_BITPOOL;
 
        media_codec = avdtp_service_cap_new(AVDTP_MEDIA_CODEC, &sbc_cap,
                                                sizeof(sbc_cap));
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/audio/pcm_bluetooth.c new/bluez-utils-3.19/audio/pcm_bluetooth.c
--- old/bluez-utils-3.18/audio/pcm_bluetooth.c  2007-09-02 18:26:32.000000000 +0200
+++ new/bluez-utils-3.19/audio/pcm_bluetooth.c  2007-09-16 10:08:29.000000000 +0200
@@ -43,7 +43,7 @@
 
 #define UINT_SECS_MAX (UINT_MAX / 1000000 - 1)
 
-#define MIN_PERIOD_TIME 1000
+#define MIN_PERIOD_TIME 1
 
 #define BUFFER_SIZE 2048
 
@@ -135,8 +135,8 @@
        snd_pcm_ioplug_t io;
        volatile snd_pcm_sframes_t hw_ptr;
        struct ipc_data_cfg cfg;        /* Bluetooth device config */
-       int stream_fd;                  /* Audio stream filedescriptor */
-       int sock;                       /* Daemon unix socket */
+       struct pollfd stream;           /* Audio stream filedescriptor */
+       struct pollfd server;           /* Audio daemon filedescriptor */
        uint8_t buffer[BUFFER_SIZE];    /* Encoded transfer buffer */
        int count;                      /* Transfer buffer counter */
        struct bluetooth_a2dp a2dp;     /* A2DP data */
@@ -166,6 +166,10 @@
        unsigned int prev_periods;
        double period_time;
        struct timeval start;
+       struct pollfd fds[2];
+
+       fds[0] = data->server;
+       fds[1] = data->stream;
 
        prev_periods = 0;
        period_time = 1000000.0 * data->io.period_size / data->io.rate;
@@ -175,6 +179,7 @@
        while (1) {
                unsigned int dtime, periods;
                struct timeval cur, delta;
+               int ret;
 
                if (data->stopped)
                        goto iter_sleep;
@@ -208,12 +213,81 @@
                }
 
 iter_sleep:
-               usleep(MIN_PERIOD_TIME);
+               ret = poll(fds, 2, MIN_PERIOD_TIME);
+               if (ret < 0) {
+                       SNDERR("poll error: %s (%d)", strerror(errno), errno);
+                       if (errno != EINTR)
+                               break;
+               } else if (ret > 0) {
+                       ret = (fds[0].revents) ? 0 : 1;
+                       SNDERR("poll fd %d revents %d", ret, fds[ret].revents);
+                       if (fds[ret].revents & (POLLERR | POLLHUP | POLLNVAL))
+                               break;
+               }
 
                /* Offer opportunity to be canceled by main thread */
                pthread_testcancel();
        }
+
+       data->hw_thread = 0;
+       pthread_exit(NULL);
+}
+
+#if 0
+static int bluetooth_state_init(struct ipc_packet *pkt, int newstate)
+{
+       struct ipc_data_state *state = (void *) pkt->data;
+
+       pkt->length = sizeof(*state);
+       pkt->type = PKT_TYPE_STATE_REQ;
+       pkt->error = PKT_ERROR_NONE;
+       state->state = newstate;
+
+       return 0;
+}
+
+static int bluetooth_state(struct bluetooth_data *data, int newstate)
+{
+       char buf[IPC_MTU];
+       struct ipc_packet *pkt = (void *) buf;
+       struct ipc_data_state *state = (void *) pkt->data;
+       int ret;
+
+       memset(buf, 0, sizeof(buf));
+
+       ret = bluetooth_state_init(pkt, newstate);
+       if (ret < 0)
+               return -ret;
+
+       ret = send(data->server.fd, pkt, sizeof(*pkt) + pkt->length, 0);
+       if (ret < 0)
+               return -errno;
+       else if (ret == 0)
+               return -EIO;
+
+       DBG("OK - %d bytes sent. Waiting for response...", ret);
+
+       memset(buf, 0, sizeof(buf));
+
+       ret = recv(data->server.fd, buf, sizeof(*pkt) + sizeof(*state), 0);
+       if (ret < 0)
+               return -errno;
+       else if (ret == 0)
+               return -EIO;
+
+       if (pkt->type != PKT_TYPE_STATE_RSP) {
+               SNDERR("Unexpected packet type %d received", pkt->type);
+               return -EINVAL;
+       }
+
+       if (pkt->error != PKT_ERROR_NONE) {
+               SNDERR("Error %d while configuring device", pkt->error);
+               return -pkt->error;
+       }
+
+       return 0;
 }
+#endif
 
 static int bluetooth_playback_start(snd_pcm_ioplug_t *io)
 {
@@ -222,6 +296,9 @@
 
        DBG("%p", io);
 
+#if 0
+       bluetooth_state(data, STATE_STREAMING);
+#endif
        data->stopped = 0;
 
        if (data->hw_thread)
@@ -238,6 +315,9 @@
 
        DBG("%p", io);
 
+#if 0
+       bluetooth_state(data, STATE_CONNECTED);
+#endif
        data->stopped = 1;
 
        return 0;
@@ -254,11 +334,11 @@
 {
        struct bluetooth_a2dp *a2dp = &data->a2dp;
 
-       if (data->sock >= 0)
-               close(data->sock);
+       if (data->server.fd >= 0)
+               close(data->server.fd);
 
-       if (data->stream_fd >= 0)
-               close(data->stream_fd);
+       if (data->stream.fd >= 0)
+               close(data->stream.fd);
 
        if (data->hw_thread) {
                pthread_cancel(data->hw_thread);
@@ -316,19 +396,19 @@
        uint32_t period_count = io->buffer_size / io->period_size;
        int opt_name, err;
 
-       DBG("fd=%d period_count=%d", data->stream_fd, period_count);
+       DBG("fd=%d period_count=%d", data->stream.fd, period_count);
 
        opt_name = (io->stream == SND_PCM_STREAM_PLAYBACK) ?
                                                SCO_TXBUFS : SCO_RXBUFS;
 
-       if (setsockopt(data->stream_fd, SOL_SCO, opt_name, &period_count,
+       if (setsockopt(data->stream.fd, SOL_SCO, opt_name, &period_count,
                                                sizeof(period_count)) == 0)
                return 0;
 
        opt_name = (io->stream == SND_PCM_STREAM_PLAYBACK) ?
                                                SO_SNDBUF : SO_RCVBUF;
 
-       if (setsockopt(data->stream_fd, SOL_SCO, opt_name, &period_count,
+       if (setsockopt(data->stream.fd, SOL_SCO, opt_name, &period_count,
                                                sizeof(period_count)) == 0)
                return 0;
 
@@ -348,12 +428,12 @@
        int opt_name, err;
        struct timeval t = { 0, period_count };
 
-       DBG("fd=%d period_count=%d", data->stream_fd, period_count);
+       DBG("fd=%d period_count=%d", data->stream.fd, period_count);
 
        opt_name = (io->stream == SND_PCM_STREAM_PLAYBACK) ?
                                                SO_SNDTIMEO : SO_RCVTIMEO;
 
-       if (setsockopt(data->stream_fd, SOL_SOCKET, opt_name, &t,
+       if (setsockopt(data->stream.fd, SOL_SOCKET, opt_name, &t,
                                                        sizeof(t)) == 0)
                return 0;
 
@@ -374,7 +454,7 @@
        if (space < 1)
                return 0;
 
-       pfd[0].fd = data->stream_fd;
+       pfd[0].fd = data->stream.fd;
        pfd[0].events = POLLIN;
        pfd[0].revents = 0;
 
@@ -452,7 +532,7 @@
 
        frame_size = areas->step / 8;
 
-       nrecv = recv(data->stream_fd, data->buffer, cfg.pkt_len,
+       nrecv = recv(data->stream.fd, data->buffer, cfg.pkt_len,
                        MSG_WAITALL | (io->nonblock ? MSG_DONTWAIT : 0));
 
        if (nrecv < 0) {
@@ -532,7 +612,7 @@
                goto done;
        }
 
-       rsend = send(data->stream_fd, data->buffer, cfg.pkt_len,
+       rsend = send(data->stream.fd, data->buffer, cfg.pkt_len,
                        io->nonblock ? MSG_DONTWAIT : 0);
        if (rsend > 0) {
                /* Reset count pointer */
@@ -576,7 +656,7 @@
        header->timestamp = htonl(a2dp->nsamples);
        header->ssrc = htonl(1);
 
-       ret = send(data->stream_fd, a2dp->buffer, a2dp->count, MSG_DONTWAIT);
+       ret = send(data->stream.fd, a2dp->buffer, a2dp->count, MSG_DONTWAIT);
        if (ret == -1)
                ret = -errno;
 
@@ -847,44 +927,35 @@
 
 static int bluetooth_recvmsg_fd(struct bluetooth_data *data)
 {
-       char cmsg_b[CMSG_SPACE(sizeof(int))];
-       struct ipc_packet pkt;
+       char cmsg_b[CMSG_SPACE(sizeof(int))], m;
        int err, ret;
-       struct iovec iov = {
-               .iov_base = &pkt,
-               .iov_len  = sizeof(pkt)
-       };
-       struct msghdr msgh = {
-               .msg_name       = 0,
-               .msg_namelen    = 0,
-               .msg_iov        = &iov,
-               .msg_iovlen     = 1,
-               .msg_control    = &cmsg_b,
-               .msg_controllen = CMSG_LEN(sizeof(int)),
-               .msg_flags      = 0
-       };
+       struct iovec iov = { &m, sizeof(m) };
+       struct msghdr msgh;
+       struct cmsghdr *cmsg;
+
+       memset(&msgh, 0, sizeof(msgh));
+       msgh.msg_iov = &iov;
+       msgh.msg_iovlen = 1;
+       msgh.msg_control = &cmsg_b;
+       msgh.msg_controllen = CMSG_LEN(sizeof(int));
 
-       ret = recvmsg(data->sock, &msgh, 0);
+       ret = recvmsg(data->server.fd, &msgh, 0);
        if (ret < 0) {
                err = errno;
                SNDERR("Unable to receive fd: %s (%d)", strerror(err), err);
                return -err;
        }
 
-       if (pkt.type == PKT_TYPE_CFG_RSP) {
-               struct cmsghdr *cmsg;
-               /* Receive auxiliary data in msgh */
-               for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL;
-                                       cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
-                       if (cmsg->cmsg_level == SOL_SOCKET
+       /* Receive auxiliary data in msgh */
+       for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL;
+                       cmsg = CMSG_NXTHDR(&msgh, cmsg)) {
+               if (cmsg->cmsg_level == SOL_SOCKET
                                && cmsg->cmsg_type == SCM_RIGHTS) {
-                               data->stream_fd = (*(int *) CMSG_DATA(cmsg));
-                               DBG("stream_fd=%d", data->stream_fd);
-                               return 0;
-                       }
+                       data->stream.fd = (*(int *) CMSG_DATA(cmsg));
+                       DBG("stream_fd=%d", data->stream.fd);
+                       return 0;
                }
-       } else
-               SNDERR("Unexpected packet type %d received", pkt.type);
+       }
 
        return -EINVAL;
 }
@@ -1081,7 +1152,7 @@
        if (ret < 0)
                return -ret;
 
-       ret = send(data->sock, pkt, sizeof(*pkt) + pkt->length, 0);
+       ret = send(data->server.fd, pkt, sizeof(*pkt) + pkt->length, 0);
        if (ret < 0)
                return -errno;
        else if (ret == 0)
@@ -1091,7 +1162,7 @@
 
        memset(buf, 0, sizeof(buf));
 
-       ret = recv(data->sock, buf, sizeof(*pkt) + sizeof(*cfg), 0);
+       ret = recv(data->server.fd, buf, sizeof(*pkt) + sizeof(*cfg), 0);
        if (ret < 0)
                return -errno;
        else if (ret == 0)
@@ -1112,7 +1183,7 @@
        if (cfg->codec != CFG_CODEC_SBC)
                goto done;
 
-       ret = recv(data->sock, sbc, sizeof(*sbc), 0);
+       ret = recv(data->server.fd, sbc, sizeof(*sbc), 0);
        if (ret < 0)
                return -errno;
        else if (ret == 0)
@@ -1133,7 +1204,7 @@
        DBG("Device configuration:");
 
        DBG("\n\tfd=%d\n\tfd_opt=%u\n\tpkt_len=%u\n\tsample_size=%u\n\trate=%u",
-                       data->stream_fd, data->cfg.fd_opt, data->cfg.pkt_len,
+                       data->stream.fd, data->cfg.fd_opt, data->cfg.pkt_len,
                                        data->cfg.sample_size, data->cfg.rate);
 
        if (data->cfg.codec == CFG_CODEC_SBC) {
@@ -1142,18 +1213,18 @@
                        return ret;
        }
 
-       if (data->stream_fd == -1) {
-               SNDERR("Error while configuring device: could not acquire audio socket");
-               return -EINVAL;
-       }
-
        ret = bluetooth_recvmsg_fd(data);
        if (ret < 0)
                return ret;
 
+       if (data->stream.fd == -1) {
+               SNDERR("Error while configuring device: could not acquire audio socket");
+               return -EINVAL;
+       }
+
        /* It is possible there is some outstanding
        data in the pipe - we have to empty it */
-       while (recv(data->stream_fd, data->buffer, data->cfg.pkt_len,
+       while (recv(data->stream.fd, data->buffer, data->cfg.pkt_len,
                                MSG_DONTWAIT) > 0);
 
        memset(data->buffer, 0, sizeof(data->buffer));
@@ -1174,7 +1245,8 @@
 
        memset(data, 0, sizeof(struct bluetooth_data));
 
-       data->sock = -1;
+       data->server.fd = -1;
+       data->stream.fd = -1;
 
        sk = socket(PF_LOCAL, SOCK_STREAM, 0);
        if (sk < 0) {
@@ -1191,7 +1263,8 @@
                return -err;
        }
 
-       data->sock = sk;
+       data->server.fd = sk;
+       data->server.events = POLLIN;
 
        data->pipefd[0] = -1;
        data->pipefd[1] = -1;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/audio/unix.c new/bluez-utils-3.19/audio/unix.c
--- old/bluez-utils-3.18/audio/unix.c   2007-09-02 18:26:32.000000000 +0200
+++ new/bluez-utils-3.19/audio/unix.c   2007-09-16 09:57:36.000000000 +0200
@@ -122,24 +122,18 @@
 and the sendmsg() system call with the cmsg_type field of a "struct cmsghdr" set
 to SCM_RIGHTS and the data being an integer value equal to the handle of the 
 file descriptor to be passed.*/
-static int unix_sendmsg_fd(int sock, int fd, struct ipc_packet *pkt)
+static int unix_sendmsg_fd(int sock, int fd)
 {
-       char cmsg_b[CMSG_SPACE(sizeof(int))];
+       char cmsg_b[CMSG_SPACE(sizeof(int))], m = 'm';
        struct cmsghdr *cmsg;
-       struct iovec iov =  {
-               .iov_base = pkt,
-               .iov_len  = sizeof(struct ipc_packet)
-       };
+       struct iovec iov = { &m, sizeof(m) };
+       struct msghdr msgh;
 
-       struct msghdr msgh = {
-               .msg_name       = 0,
-               .msg_namelen    = 0,
-               .msg_iov        = &iov,
-               .msg_iovlen     = 1,
-               .msg_control    = &cmsg_b,
-               .msg_controllen = CMSG_LEN(sizeof(int)),
-               .msg_flags      = 0
-       };
+       memset(&msgh, 0, sizeof(msgh));
+       msgh.msg_iov = &iov;
+       msgh.msg_iovlen = 1;
+       msgh.msg_control = &cmsg_b;
+       msgh.msg_controllen = CMSG_LEN(sizeof(int));
 
        cmsg = CMSG_FIRSTHDR(&msgh);
        cmsg->cmsg_level = SOL_SOCKET;
@@ -237,7 +231,7 @@
        debug("%d bytes sent", len);
 
        if (fd != -1) {
-               len = unix_sendmsg_fd(sock, fd, pkt);
+               len = unix_sendmsg_fd(sock, fd);
                if (len < 0)
                        error("Error %s(%d)", strerror(errno), errno);
                debug("%d bytes sent", len);
@@ -347,9 +341,23 @@
        cfg->fd_opt = CFG_FD_OPT_WRITE;
 
        sbc_cap = (void *) codec_cap;
-       cfg->mode = sbc_cap->channel_mode;
        cfg->sample_size = 2;
 
+       switch (sbc_cap->channel_mode) {
+       case A2DP_CHANNEL_MODE_MONO:
+               cfg->mode = CFG_MODE_MONO;
+               break;
+       case A2DP_CHANNEL_MODE_DUAL_CHANNEL:
+               cfg->mode = CFG_MODE_DUAL_CHANNEL;
+               break;
+       case A2DP_CHANNEL_MODE_STEREO:
+               cfg->mode = CFG_MODE_STEREO;
+               break;
+       case A2DP_CHANNEL_MODE_JOINT_STEREO:
+               cfg->mode = CFG_MODE_JOINT_STEREO;
+               break;
+       }
+
        switch (sbc_cap->frequency) {
        case A2DP_SAMPLING_FREQ_16000:
                cfg->rate = 16000;
@@ -623,6 +631,27 @@
 {
 }
 
+static int reply_state(int sock, struct ipc_packet *pkt)
+{
+       struct ipc_data_state *state = (struct ipc_data_state *) pkt->data;
+       int len;
+
+       info("status=%u", state->state);
+
+       pkt->type = PKT_TYPE_STATE_RSP;
+       pkt->length = sizeof(struct ipc_data_state);
+       pkt->error = PKT_ERROR_NONE;
+
+       len = sizeof(struct ipc_packet) + sizeof(struct ipc_data_state);
+       len = send(sock, pkt, len, 0);
+       if (len < 0)
+               error("Error %s(%d)", strerror(errno), errno);
+
+       debug("%d bytes sent", len);
+
+       return 0;
+}
+
 static void state_event(struct unix_client *client,
                                        struct ipc_packet *pkt, int len)
 {
@@ -634,9 +663,9 @@
                device_set_state(dev, state->state);
        else
                state->state = device_get_state(dev);
-
-       unix_send_state(client->sock, pkt);
 #endif
+
+       reply_state(client->sock, pkt);
 }
 
 static gboolean client_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
@@ -798,25 +827,3 @@
        unix_sock = -1;
 }
 
-#if 0
-static int unix_send_state(int sock, struct ipc_packet *pkt)
-{
-       struct ipc_data_state *state = (struct ipc_data_state *) pkt->data;
-       int len;
-
-       info("status=%u", state->state);
-
-       pkt->type = PKT_TYPE_STATE_RSP;
-       pkt->length = sizeof(struct ipc_data_state);
-       pkt->error = PKT_ERROR_NONE;
-
-       len = sizeof(struct ipc_packet) + sizeof(struct ipc_data_state);
-       len = send(sock, pkt, len, 0);
-       if (len < 0)
-               error("Error %s(%d)", strerror(errno), errno);
-
-       debug("%d bytes sent", len);
-
-       return 0;
-}
-#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/ChangeLog new/bluez-utils-3.19/ChangeLog
--- old/bluez-utils-3.18/ChangeLog      2007-09-02 18:40:57.000000000 +0200
+++ new/bluez-utils-3.19/ChangeLog      2007-09-16 09:57:28.000000000 +0200
@@ -1,3 +1,14 @@
+ver 3.19:
+       Limit range of bitpool announced while in ACP side.
+       Use poll instead of usleep to wait for worker thread.
+       Use default event mask from the specification.
+       Add HID proxy support for Logitech diNovo Edge dongle.
+       Add refresh option to re-request device names.
+       Show correct connection link type.
+
+       Note:
+       This version needs at least bluez-libs-3.19
+
 ver 3.18:
        Implement proper locking for headsets.
        Fix various A2DP SEP locking issues.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/common/hal-libhal.c new/bluez-utils-3.19/common/hal-libhal.c
--- old/bluez-utils-3.18/common/hal-libhal.c    2007-03-27 12:20:41.000000000 +0200
+++ new/bluez-utils-3.19/common/hal-libhal.c    2007-09-16 09:57:36.000000000 +0200
@@ -25,6 +25,7 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -122,12 +123,15 @@
                                "    </method>\n",
                        &err) == FALSE) {
                error("Failed to claim to interface: ", err.message);
+               dbus_error_free(&err);
        }
 
        if (libhal_device_commit_to_gdl(hal_ctx, dev, udi, NULL) == FALSE) {
                error("Failed to create HAL device");
        }
 
+       free(dev);
+
        return 0;
 }
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/configure new/bluez-utils-3.19/configure
--- old/bluez-utils-3.18/configure      2007-09-02 18:41:30.000000000 +0200
+++ new/bluez-utils-3.19/configure      2007-09-16 10:10:14.000000000 +0200
@@ -945,6 +945,8 @@
 HID2HCI_FALSE
 DFUTOOL_TRUE
 DFUTOOL_FALSE
+DFUBABEL_TRUE
+DFUBABEL_FALSE
 LIBOBJS
 LTLIBOBJS'
 ac_subst_files=''
@@ -1598,6 +1600,7 @@
   --enable-avctrl         install Audio/Video control utility
   --enable-hid2hci        install HID mode switching utility
   --enable-dfutool        install DFU firmware upgrade utility
+  --enable-dfubabel       install Babel DFU mode switching utility
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -2411,7 +2414,7 @@
 
 # Define the identity of the package.
  PACKAGE=bluez-utils
- VERSION=3.18
+ VERSION=3.19
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4897,7 +4900,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4900 "configure"' > conftest.$ac_ext
+  echo '#line 4903 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6656,11 +6659,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6659: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6662: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6663: \$? = $ac_status" >&5
+   echo "$as_me:6666: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -6924,11 +6927,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6927: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6930: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6931: \$? = $ac_status" >&5
+   echo "$as_me:6934: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7028,11 +7031,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7031: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7034: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7035: \$? = $ac_status" >&5
+   echo "$as_me:7038: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8493,7 +8496,7 @@
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 8496 "configure"' > conftest.$ac_ext
+    echo '#line 8499 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9357,7 +9360,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9360 "configure"
+#line 9363 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9457,7 +9460,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9460 "configure"
+#line 9463 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11690,6 +11693,7 @@
        avctrl_enable=no
        hid2hci_enable=${usb_found}
        dfutool_enable=no
+       dfubabel_enable=no
 
        # Check whether --enable-fortify was given.
 if test "${enable_fortify+set}" = set; then
@@ -11724,7 +11728,7 @@
                hcid_enable=${enableval}
                sdpd_enable=${enableval}
                hidd_enable=${enableval}
-               pand_enalbe=${enableval}
+               pand_enable=${enableval}
                test_enable=${enableval}
                cups_enable=${enableval}
                manpages_enable=${enableval}
@@ -11735,6 +11739,7 @@
                avctrl_enable=${enableval}
                hid2hci_enable=${enableval}
                dfutool_enable=${enableval}
+               dfubabel_enable=${enableval}
 
 fi
 
@@ -11963,6 +11968,14 @@
 fi
 
 
+       # Check whether --enable-dfubabel was given.
+if test "${enable_dfubabel+set}" = set; then
+  enableval=$enable_dfubabel;
+               dfubabel_enable=${enableval}
+
+fi
+
+
        if (test "${fortify_enable}" = "yes"); then
                CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
        fi
@@ -12254,6 +12267,14 @@
   DFUTOOL_FALSE=
 fi
 
+        if test "${dfubabel_enable}" = "yes" && test "${usb_found}" = "yes"; then
+  DFUBABEL_TRUE=
+  DFUBABEL_FALSE='#'
+else
+  DFUBABEL_TRUE='#'
+  DFUBABEL_FALSE=
+fi
+
 
 
 ac_config_files="$ac_config_files Makefile sbc/Makefile eglib/Makefile common/Makefile daemon/Makefile transfer/Makefile network/Makefile serial/Makefile input/Makefile audio/Makefile print/Makefile sync/Makefile tools/Makefile rfcomm/Makefile hcid/Makefile sdpd/Makefile dund/Makefile pand/Makefile hidd/Makefile cups/Makefile test/Makefile scripts/Makefile"
@@ -12592,6 +12613,13 @@
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${DFUBABEL_TRUE}" && test -z "${DFUBABEL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"DFUBABEL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DFUBABEL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
@@ -13368,11 +13396,13 @@
 HID2HCI_FALSE!$HID2HCI_FALSE$ac_delim
 DFUTOOL_TRUE!$DFUTOOL_TRUE$ac_delim
 DFUTOOL_FALSE!$DFUTOOL_FALSE$ac_delim
+DFUBABEL_TRUE!$DFUBABEL_TRUE$ac_delim
+DFUBABEL_FALSE!$DFUBABEL_FALSE$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 87; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/configure.in new/bluez-utils-3.19/configure.in
--- old/bluez-utils-3.18/configure.in   2007-09-02 18:40:57.000000000 +0200
+++ new/bluez-utils-3.19/configure.in   2007-09-16 09:57:28.000000000 +0200
@@ -1,7 +1,7 @@
 AC_PREREQ(2.50)
 AC_INIT()
 
-AM_INIT_AUTOMAKE(bluez-utils, 3.18)
+AM_INIT_AUTOMAKE(bluez-utils, 3.19)
 AM_CONFIG_HEADER(config.h)
 
 AM_MAINTAINER_MODE
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/hcid/device.c new/bluez-utils-3.19/hcid/device.c
--- old/bluez-utils-3.18/hcid/device.c  2007-08-28 17:59:37.000000000 +0200
+++ new/bluez-utils-3.19/hcid/device.c  2007-09-16 09:57:36.000000000 +0200
@@ -232,7 +232,7 @@
        struct hci_dev *dev;
        struct hci_version ver;
        uint8_t features[8], inqmode;
-       uint8_t events[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00 };
+       uint8_t events[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00 };
        char name[249];
        int dd, err;
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/network/bridge.c new/bluez-utils-3.19/network/bridge.c
--- old/bluez-utils-3.18/network/bridge.c       2007-09-02 18:26:35.000000000 +0200
+++ new/bluez-utils-3.19/network/bridge.c       2007-09-16 09:57:37.000000000 +0200
@@ -41,10 +41,12 @@
 
 int bridge_init(void)
 {
+#if 0
        struct stat st;
 
        if (stat("/sys/module/bridge", &st) < 0)
                return -EOPNOTSUPP;
+#endif
 
        bridge_socket = socket(AF_INET, SOCK_STREAM, 0);
        if (bridge_socket < 0)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/network/Makefile.am new/bluez-utils-3.19/network/Makefile.am
--- old/bluez-utils-3.18/network/Makefile.am    2007-05-09 08:40:47.000000000 +0200
+++ new/bluez-utils-3.19/network/Makefile.am    2007-09-16 09:57:37.000000000 +0200
@@ -23,6 +23,6 @@
 
 INCLUDES = -I$(top_srcdir)/common
 
-EXTRA_DIST = network.service network-api.txt test-network
+EXTRA_DIST = network.service network.conf network-api.txt test-network
 
 MAINTAINERCLEANFILES = Makefile.in
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/network/Makefile.in new/bluez-utils-3.19/network/Makefile.in
--- old/bluez-utils-3.18/network/Makefile.in    2007-09-02 18:41:25.000000000 +0200
+++ new/bluez-utils-3.19/network/Makefile.in    2007-09-16 10:10:09.000000000 +0200
@@ -227,7 +227,7 @@
 
 AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @HAL_CFLAGS@ @GLIB_CFLAGS@
 INCLUDES = -I$(top_srcdir)/common
-EXTRA_DIST = network.service network-api.txt test-network
+EXTRA_DIST = network.service network.conf network-api.txt test-network
 MAINTAINERCLEANFILES = Makefile.in
 all: all-am
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/network/manager.c new/bluez-utils-3.19/network/manager.c
--- old/bluez-utils-3.18/network/manager.c      2007-08-30 14:25:58.000000000 +0200
+++ new/bluez-utils-3.19/network/manager.c      2007-09-16 09:57:37.000000000 +0200
@@ -264,8 +264,8 @@
 
        d = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
        if (d) {
-               snprintf(name + len, MAX_NAME_SIZE - len, "(%.*s)",
-                               d->unitSize, d->val.str);
+               snprintf(name + len, MAX_NAME_SIZE - len,
+                       len ? " (%.*s)" : "%.*s", d->unitSize, d->val.str);
        }
 
        /* Extract service description from record */
@@ -766,11 +766,6 @@
                                &dst, id, name, ptr) == 0) {
                char *rpath = g_strdup(path);
                connection_paths = g_slist_append(connection_paths, rpath);
-               dbus_connection_emit_signal(connection, NETWORK_PATH,
-                                               NETWORK_MANAGER_INTERFACE,
-                                               "ConnectionCreated",
-                                               DBUS_TYPE_STRING, &rpath,
-                                               DBUS_TYPE_INVALID);
        }
 
        g_free(name);
@@ -780,7 +775,7 @@
 {
        char filename[PATH_MAX + 1];
        char *pattern;
-       struct stat s;
+       struct stat st;
        GSList *list;
        bdaddr_t src;
        bdaddr_t default_src;
@@ -790,26 +785,32 @@
 
        str2ba(adapter, &src);
 
+       if (stat(filename, &st) < 0)
+               return;
+
+       if (!(st.st_mode & __S_IFREG))
+               return;
+
+       textfile_foreach(filename, parse_stored_connection, &src);
+
+       /* Check default connection for current default adapter */
        bacpy(&default_src, BDADDR_ANY);
-       dev_id = hci_get_route(NULL);
+       dev_id = hci_get_route(&default_src);
        if (dev_id < 0)
-               hci_devba(dev_id, &default_src);
+               return;
 
-       if (stat (filename, &s) == 0 && (s.st_mode & __S_IFREG)) {
-               textfile_foreach(filename, parse_stored_connection, &src);
-               pattern = textfile_get(filename, "default");
+       hci_devba(dev_id, &default_src);
+       if (bacmp(&default_src, &src) != 0)
+               return;
 
-               list = find_connection_pattern(connection, pattern);
-               if (list != NULL)
-                       default_index = g_slist_position(connection_paths, list);
-               else if (bacmp(&src, &default_src) == 0) {
-                       list = g_slist_last(connection_paths);
-                       if (list == NULL)
-                               return;
-                       default_index = g_slist_position(connection_paths, list);
-                       connection_store(connection, list->data, TRUE);
-               }
-       }
+       pattern = textfile_get(filename, "default");
+       if (!pattern)
+               return;
+
+       list = find_connection_pattern(connection, pattern);
+       if (!list)
+               return;
+       default_index = g_slist_position(connection_paths, list);
 }
 
 static void register_server(uint16_t id)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/network/network.conf new/bluez-utils-3.19/network/network.conf
--- old/bluez-utils-3.18/network/network.conf   1970-01-01 01:00:00.000000000 +0100
+++ new/bluez-utils-3.19/network/network.conf   2007-09-14 12:21:07.000000000 +0200
@@ -0,0 +1,2 @@
+# Configuration file for the network service
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/dfubabel.1 new/bluez-utils-3.19/tools/dfubabel.1
--- old/bluez-utils-3.18/tools/dfubabel.1       1970-01-01 01:00:00.000000000 +0100
+++ new/bluez-utils-3.19/tools/dfubabel.1       2007-09-07 21:38:57.000000000 +0200
@@ -0,0 +1,38 @@
+.\"
+.\"       This program is free software; you can redistribute it and/or modify
+.\"       it under the terms of the GNU General Public License as published by
+.\"       the Free Software Foundation; either version 2 of the License, or
+.\"       (at your option) any later version.
+.\"
+.\"       This program is distributed in the hope that it will be useful,
+.\"       but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\"       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\"       GNU General Public License for more details.
+.\"
+.\"       You should have received a copy of the GNU General Public License
+.\"       along with this program; if not, write to the Free Software
+.\"       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+.\"
+.\"
+.TH DFUBABEL 8 "JUNE 6, 2005" "" ""
+
+.SH NAME
+dfubabel \- Babel DFU mode switching utility
+.SH SYNOPSIS
+.BR "dfubabel
+[
+.I options
+]
+.SH DESCRIPTION
+.B dfubabel
+is used to switch Babel devices into DFU mode.
+.SH OPTIONS
+.TP
+.BI -h
+Gives a list of possible options.
+.TP
+.BI -q
+Don't display any messages.
+.SH AUTHOR
+Written by Marcel Holtmann <marcel@xxxxxxxxxxxx>.
+.br
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/dfubabel.c new/bluez-utils-3.19/tools/dfubabel.c
--- old/bluez-utils-3.18/tools/dfubabel.c       1970-01-01 01:00:00.000000000 +0100
+++ new/bluez-utils-3.19/tools/dfubabel.c       2007-09-07 21:38:57.000000000 +0200
@@ -0,0 +1,211 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@xxxxxxxxxxxx>
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <string.h>
+#include <getopt.h>
+
+#include <usb.h>
+
+#ifdef NEED_USB_GET_BUSSES
+static inline struct usb_bus *usb_get_busses(void)
+{
+       return usb_busses;
+}
+#endif
+
+struct device_info;
+
+struct device_id {
+       uint16_t vendor;
+       uint16_t product;
+       int (*func)(struct device_info *dev, int argc, char *argv[]);
+};
+
+struct device_info {
+       struct usb_device *dev;
+       struct device_id *id;
+};
+
+static int switch_babel(struct device_info *devinfo, int argc, char *argv[])
+{
+       char buf[3];
+       struct usb_dev_handle *udev;
+       int err;
+
+       memset(buf, 0, sizeof(buf));
+
+       buf[0] = 0x00;
+       buf[1] = 0x06;
+       buf[2] = 0x00;
+
+       udev = usb_open(devinfo->dev);
+       if (!udev)
+               return -errno;
+
+       if (usb_claim_interface(udev, 0) < 0) {
+               err = -errno;
+               usb_close(udev);
+               return err;
+       }
+
+       err = usb_bulk_write(udev, 0x02, buf, sizeof(buf), 10000);
+
+       if (err == 0) {
+               err = -1;
+               errno = EALREADY;
+       } else {
+               if (errno == ETIMEDOUT)
+                       err = 0;
+       }
+
+       usb_release_interface(udev, 0);
+       usb_close(udev);
+
+       return err;
+}
+
+static struct device_id device_list[] = {
+       { 0x0a12, 0x0042, switch_babel },
+       { -1 }
+};
+
+static struct device_id *match_device(uint16_t vendor, uint16_t product)
+{
+       int i;
+
+       for (i = 0; device_list[i].func; i++) {
+               if (vendor == device_list[i].vendor &&
+                               product == device_list[i].product)
+                       return &device_list[i];
+       }
+
+       return NULL;
+}
+
+static int find_devices(struct device_info *devinfo, size_t size)
+{
+       struct usb_bus *bus;
+       struct usb_device *dev;
+       struct device_id *id;
+       int count = 0;
+
+       usb_find_busses();
+       usb_find_devices();
+
+       for (bus = usb_get_busses(); bus; bus = bus->next)
+               for (dev = bus->devices; dev; dev = dev->next) {
+                       id = match_device(dev->descriptor.idVendor,
+                                               dev->descriptor.idProduct);
+                       if (!id)
+                               continue;
+
+                       if (count < size) {
+                               devinfo[count].dev = dev;
+                               devinfo[count].id = id;
+                               count++;
+                       }
+               }
+
+       return count;
+}
+
+static void usage(void)
+{
+       printf("dfubabel - Babel DFU mode switching utility\n\n");
+
+       printf("Usage:\n"
+               "\tdfubabel [options]\n"
+               "\n");
+
+       printf("Options:\n"
+               "\t-h, --help           Display help\n"
+               "\t-q, --quiet          Don't display any messages\n"
+               "\n");
+}
+
+static struct option main_options[] = {
+       { "help",     0, 0, 'h' },
+       { "quiet",    0, 0, 'q' },
+       { 0, 0, 0, 0 }
+};
+
+int main(int argc, char *argv[])
+{
+       struct device_info dev[16];
+       int i, opt, num, quiet = 0;
+
+       while ((opt = getopt_long(argc, argv, "+qh", main_options, NULL)) != -1) {
+               switch (opt) {
+               case 'q':
+                       quiet = 1;
+                       break;
+               case 'h':
+                       usage();
+                       exit(0);
+               default:
+                       exit(0);
+               }
+       }
+
+       argc -= optind;
+       argv += optind;
+       optind = 0;
+
+       usb_init();
+
+       num = find_devices(dev, sizeof(dev) / sizeof(dev[0]));
+       if (num <= 0) {
+               if (!quiet)
+                       fprintf(stderr, "No Babel devices found\n");
+               exit(1);
+       }
+
+       for (i = 0; i < num; i++) {
+               struct device_id *id = dev[i].id;
+               int err;
+
+               if (!quiet)
+                       printf("Switching device %04x:%04x ",
+                                               id->vendor, id->product);
+               fflush(stdout);
+
+               err = id->func(&dev[i], argc, argv);
+               if (err < 0) {
+                       if (!quiet)
+                               printf("failed (%s)\n", strerror(-err));
+               } else {
+                       if (!quiet)
+                               printf("was successful\n");
+               }
+       }
+
+       return 0;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/hcitool.c new/bluez-utils-3.19/tools/hcitool.c
--- old/bluez-utils-3.18/tools/hcitool.c        2007-06-16 13:53:50.000000000 +0200
+++ new/bluez-utils-3.19/tools/hcitool.c        2007-09-16 09:57:40.000000000 +0200
@@ -63,6 +63,20 @@
        return 0;
 }
 
+static char *type2str(uint8_t type)
+{
+       switch (type) {
+       case SCO_LINK:
+               return "SCO";
+       case ACL_LINK:
+               return "ACL";
+       case ESCO_LINK:
+               return "eSCO";
+       default:
+               return "Unknown";
+       }
+}
+
 static int conn_list(int s, int dev_id, long arg)
 {
        struct hci_conn_list_req *cl;
@@ -90,8 +104,7 @@
                char addr[18];
                ba2str(&ci->bdaddr, addr);
                printf("\t%s %s %s handle %d state %d lm %s\n",
-                       ci->out ? "<" : ">",
-                       ci->type == ACL_LINK ? "ACL" : "SCO",
+                       ci->out ? "<" : ">", type2str(ci->type),
                        addr, ci->handle, ci->state,
                        hci_lmtostr(ci->link_mode));
        }
@@ -471,6 +484,7 @@
        { "numrsp",   1, 0, 'n' },
        { "iac",      1, 0, 'i' },
        { "flush",    0, 0, 'f' },
+       { "refresh",  0, 0, 'r' },
        { "class",    0, 0, 'C' },
        { "info",     0, 0, 'I' },
        { "oui",      0, 0, 'O' },
@@ -481,7 +495,7 @@
 
 static char *scan_help =
        "Usage:\n"
-       "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui]\n";
+       "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui] [--refresh]\n";
 
 static void cmd_scan(int dev_id, int argc, char **argv)
 {
@@ -494,7 +508,7 @@
        struct hci_version version;
        struct hci_dev_info di;
        struct hci_conn_info_req *cr;
-       int extcls = 0, extinf = 0, extoui = 0;
+       int refresh = 0, extcls = 0, extinf = 0, extoui = 0;
        int i, n, l, opt, dd, cc, nc;
 
        length  = 8;    /* ~10 seconds */
@@ -530,6 +544,10 @@
                        flags |= IREQ_CACHE_FLUSH;
                        break;
 
+               case 'r':
+                       refresh = 1;
+                       break;
+
                case 'C':
                        extcls = 1;
                        break;
@@ -585,12 +603,15 @@
                printf("\n");
 
        for (i = 0; i < num_rsp; i++) {
-               memset(name, 0, sizeof(name));
-               tmp = get_device_name(&di.bdaddr, &(info+i)->bdaddr);
-               if (tmp) {
-                       strncpy(name, tmp, 249);
-                       free(tmp);
-                       nc = 1;
+               if (!refresh) {
+                       memset(name, 0, sizeof(name));
+                       tmp = get_device_name(&di.bdaddr, &(info+i)->bdaddr);
+                       if (tmp) {
+                               strncpy(name, tmp, 249);
+                               free(tmp);
+                               nc = 1;
+                       } else
+                               nc = 0;
                } else
                        nc = 0;
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/hid2hci.c new/bluez-utils-3.19/tools/hid2hci.c
--- old/bluez-utils-3.18/tools/hid2hci.c        2007-02-18 04:34:51.000000000 +0100
+++ new/bluez-utils-3.19/tools/hid2hci.c        2007-09-16 09:57:40.000000000 +0200
@@ -227,6 +227,8 @@
        { HCI, 0x046d, 0xc70b, switch_logitech },       /* Logitech diNovo Laser keyboard */
        { HCI, 0x046d, 0xc70c, switch_logitech },       /* Logitech diNovo Laser mouse */
        { HCI, 0x046d, 0xc70e, switch_logitech },       /* Logitech diNovo keyboard */
+       { HCI, 0x046d, 0xc713, switch_logitech },       /* Logitech diNovo Edge */
+       { HCI, 0x046d, 0xc714, switch_logitech },       /* Logitech diNovo Edge */
        { -1 }
 };
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/Makefile.am new/bluez-utils-3.19/tools/Makefile.am
--- old/bluez-utils-3.18/tools/Makefile.am      2007-05-15 10:06:19.000000000 +0200
+++ new/bluez-utils-3.19/tools/Makefile.am      2007-09-16 09:57:40.000000000 +0200
@@ -31,9 +31,17 @@
 dfutool_manfiles =
 endif
 
+if DFUBABEL
+dfubabel_programs = dfubabel
+dfubabel_manfiles = dfubabel.1
+else
+dfubabel_programs =
+dfubabel_manfiles =
+endif
+
 sbin_PROGRAMS = hciattach hciconfig $(bccmd_programs) $(avctrl_programs) $(hid2hci_programs)
 
-bin_PROGRAMS = hcitool l2ping sdptool ciptool $(dfutool_programs)
+bin_PROGRAMS = hcitool l2ping sdptool ciptool $(dfutool_programs) $(dfubabel_programs)
 
 noinst_PROGRAMS = hcisecfilter ppporc
 
@@ -76,16 +84,22 @@
 dfutool_LDADD = @USB_LIBS@
 endif
 
+if DFUBABEL
+dfubabel_SOURCES = dfubabel.c
+dfubabel_LDADD = @USB_LIBS@
+endif
+
 AM_CFLAGS = @BLUEZ_CFLAGS@ @USB_CFLAGS@
 
 INCLUDES = -I$(top_srcdir)/common
 
 if MANPAGES
 man_MANS = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1 \
-               $(bccmd_manfiles) $(avctrl_manfiles) $(hid2hci_manfiles) $(dfutool_manfiles)
+               $(bccmd_manfiles) $(avctrl_manfiles) $(hid2hci_manfiles) \
+               $(dfutool_manfiles) $(dfubabel_manfiles)
 endif
 
 EXTRA_DIST = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1 \
-                bccmd.8 avctrl.8 hid2hci.8 dfutool.1 example.psr
+                bccmd.8 avctrl.8 hid2hci.8 dfutool.1 dfubabel.1 example.psr
 
 MAINTAINERCLEANFILES = Makefile.in
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-utils-3.18/tools/Makefile.in new/bluez-utils-3.19/tools/Makefile.in
--- old/bluez-utils-3.18/tools/Makefile.in      2007-09-02 18:41:28.000000000 +0200
+++ new/bluez-utils-3.19/tools/Makefile.in      2007-09-16 10:10:11.000000000 +0200
@@ -32,10 +32,10 @@
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-sbin_PROGRAMS = hciattach$(EXEEXT) hciconfig$(EXEEXT) $(am__EXEEXT_2) \
-       $(am__EXEEXT_3) $(am__EXEEXT_4)
+sbin_PROGRAMS = hciattach$(EXEEXT) hciconfig$(EXEEXT) $(am__EXEEXT_3) \
+       $(am__EXEEXT_4) $(am__EXEEXT_5)
 bin_PROGRAMS = hcitool$(EXEEXT) l2ping$(EXEEXT) sdptool$(EXEEXT) \
-       ciptool$(EXEEXT) $(am__EXEEXT_1)
+       ciptool$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
 noinst_PROGRAMS = hcisecfilter$(EXEEXT) ppporc$(EXEEXT)
 @BCCMD_TRUE@@USB_TRUE@am__append_1 = csr_usb.c
 @BCCMD_TRUE@@USB_TRUE@am__append_2 = @USB_LIBS@
@@ -50,12 +50,13 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 @DFUTOOL_TRUE@am__EXEEXT_1 = dfutool$(EXEEXT)
+@DFUBABEL_TRUE@am__EXEEXT_2 = dfubabel$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
        "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-@BCCMD_TRUE@am__EXEEXT_2 = bccmd$(EXEEXT)
-@AVCTRL_TRUE@am__EXEEXT_3 = avctrl$(EXEEXT)
-@HID2HCI_TRUE@am__EXEEXT_4 = hid2hci$(EXEEXT)
+@BCCMD_TRUE@am__EXEEXT_3 = bccmd$(EXEEXT)
+@AVCTRL_TRUE@am__EXEEXT_4 = avctrl$(EXEEXT)
+@HID2HCI_TRUE@am__EXEEXT_5 = hid2hci$(EXEEXT)
 sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(sbin_PROGRAMS)
 avctrl_SOURCES = avctrl.c
@@ -74,6 +75,10 @@
 ciptool_SOURCES = ciptool.c
 ciptool_OBJECTS = ciptool.$(OBJEXT)
 ciptool_DEPENDENCIES =
+am__dfubabel_SOURCES_DIST = dfubabel.c
+@DFUBABEL_TRUE@am_dfubabel_OBJECTS = dfubabel.$(OBJEXT)
+dfubabel_OBJECTS = $(am_dfubabel_OBJECTS)
+dfubabel_DEPENDENCIES =
 am__dfutool_SOURCES_DIST = dfutool.c dfu.h dfu.c
 @DFUTOOL_TRUE@am_dfutool_OBJECTS = dfutool.$(OBJEXT) dfu.$(OBJEXT)
 dfutool_OBJECTS = $(am_dfutool_OBJECTS)
@@ -114,13 +119,14 @@
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
-SOURCES = avctrl.c $(bccmd_SOURCES) ciptool.c $(dfutool_SOURCES) \
+SOURCES = avctrl.c $(bccmd_SOURCES) ciptool.c $(dfubabel_SOURCES) \
+       $(dfutool_SOURCES) $(hciattach_SOURCES) $(hciconfig_SOURCES) \
+       hcisecfilter.c $(hcitool_SOURCES) hid2hci.c l2ping.c ppporc.c \
+       sdptool.c
+DIST_SOURCES = avctrl.c $(am__bccmd_SOURCES_DIST) ciptool.c \
+       $(am__dfubabel_SOURCES_DIST) $(am__dfutool_SOURCES_DIST) \
        $(hciattach_SOURCES) $(hciconfig_SOURCES) hcisecfilter.c \
        $(hcitool_SOURCES) hid2hci.c l2ping.c ppporc.c sdptool.c
-DIST_SOURCES = avctrl.c $(am__bccmd_SOURCES_DIST) ciptool.c \
-       $(am__dfutool_SOURCES_DIST) $(hciattach_SOURCES) \
-       $(hciconfig_SOURCES) hcisecfilter.c $(hcitool_SOURCES) \
-       hid2hci.c l2ping.c ppporc.c sdptool.c
 man1dir = $(mandir)/man1
 man8dir = $(mandir)/man8
 NROFF = nroff
@@ -272,6 +278,10 @@
 @DFUTOOL_TRUE@dfutool_programs = dfutool
 @DFUTOOL_FALSE@dfutool_manfiles = 
 @DFUTOOL_TRUE@dfutool_manfiles = dfutool.1
+@DFUBABEL_FALSE@dfubabel_programs = 
+@DFUBABEL_TRUE@dfubabel_programs = dfubabel
+@DFUBABEL_FALSE@dfubabel_manfiles = 
+@DFUBABEL_TRUE@dfubabel_manfiles = dfubabel.1
 hciattach_SOURCES = hciattach.c hciattach_st.c
 hciattach_LDADD = @BLUEZ_LIBS@
 hciconfig_SOURCES = hciconfig.c csr.h csr.c
@@ -290,13 +300,16 @@
 @HID2HCI_TRUE@hid2hci_LDADD = @USB_LIBS@
 @DFUTOOL_TRUE@dfutool_SOURCES = dfutool.c dfu.h dfu.c
 @DFUTOOL_TRUE@dfutool_LDADD = @USB_LIBS@
+@DFUBABEL_TRUE@dfubabel_SOURCES = dfubabel.c
+@DFUBABEL_TRUE@dfubabel_LDADD = @USB_LIBS@
 AM_CFLAGS = @BLUEZ_CFLAGS@ @USB_CFLAGS@
 INCLUDES = -I$(top_srcdir)/common
 @MANPAGES_TRUE@man_MANS = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1 \
-@MANPAGES_TRUE@                $(bccmd_manfiles) $(avctrl_manfiles) $(hid2hci_manfiles) $(dfutool_manfiles)
+@MANPAGES_TRUE@                $(bccmd_manfiles) $(avctrl_manfiles) $(hid2hci_manfiles) \
+@MANPAGES_TRUE@                $(dfutool_manfiles) $(dfubabel_manfiles)
 
 EXTRA_DIST = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1 \
-                bccmd.8 avctrl.8 hid2hci.8 dfutool.1 example.psr
+                bccmd.8 avctrl.8 hid2hci.8 dfutool.1 dfubabel.1 example.psr
 
 MAINTAINERCLEANFILES = Makefile.in
 all: all-am
@@ -404,6 +417,9 @@
 ciptool$(EXEEXT): $(ciptool_OBJECTS) $(ciptool_DEPENDENCIES) 
        @rm -f ciptool$(EXEEXT)
        $(LINK) $(ciptool_OBJECTS) $(ciptool_LDADD) $(LIBS)
+dfubabel$(EXEEXT): $(dfubabel_OBJECTS) $(dfubabel_DEPENDENCIES) 
+       @rm -f dfubabel$(EXEEXT)
+       $(LINK) $(dfubabel_OBJECTS) $(dfubabel_LDADD) $(LIBS)
 dfutool$(EXEEXT): $(dfutool_OBJECTS) $(dfutool_DEPENDENCIES) 
        @rm -f dfutool$(EXEEXT)
        $(LINK) $(dfutool_OBJECTS) $(dfutool_LDADD) $(LIBS)
@@ -448,6 +464,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csr_hci.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csr_usb.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfubabel.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfutool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hciattach.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hciattach_st.Po@am__quote@





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages