* Re: [PATCH 1/1] test: Make map script a command line client
From: Luiz Augusto von Dentz @ 2013-01-13 15:29 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Christian Fetzer, linux-bluetooth@vger.kernel.org,
Christian Fetzer
In-Reply-To: <1357937329.1806.84.camel@aeonflux>
Hi Marcel, Christian,
On Fri, Jan 11, 2013 at 10:48 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Christian,
>
>> Rework the map-client test script into an interactive command line client.
>> Now multiple MCE functions can be called in one active session.
>> The script also allows to specify all filters or optional parameters including
>> auto completion.
>>
>> Change-Id: I9c9ede2bc958009c757384177cf06c081d984c98
>
> no Change-Id crap please.
I wonder if we should complicate more the testing scripts adding such
futures or start working in a proper C tool such as bluetoothctl e.g.
obexctl?
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH BlueZ 01/11] transport: Initialize the "Volume" property with 50%
From: Luiz Augusto von Dentz @ 2013-01-13 15:22 UTC (permalink / raw)
To: João Paulo Rechi Vita
Cc: linux-bluetooth@vger.kernel.org, Vinicius Gomes, Claudio Takahasi,
Luiz Augusto Von Dentz
In-Reply-To: <1357935934-20033-2-git-send-email-jprvita@openbossa.org>
Hi Joao,
On Fri, Jan 11, 2013 at 10:25 PM, João Paulo Rechi Vita
<jprvita@openbossa.org> wrote:
> ---
> profiles/audio/transport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
> index a4370a5..6ffa98a 100644
> --- a/profiles/audio/transport.c
> +++ b/profiles/audio/transport.c
> @@ -787,7 +787,7 @@ struct media_transport *media_transport_create(struct media_endpoint *endpoint,
> struct a2dp_transport *a2dp;
>
> a2dp = g_new0(struct a2dp_transport, 1);
> - a2dp->volume = -1;
> + a2dp->volume = 63;
>
> transport->resume = resume_a2dp;
> transport->suspend = suspend_a2dp;
> --
> 1.7.11.7
Does the spec say anything regarding this? Actually it seems this
value must be set by PA if it does support volume notification, which
means a new version of PA, then it should set the value when the card
is initialized, otherwise if the endpoint doesn't set a value it
should remain -1/not available. If volume is not set by the endpoint
we should either return and error upon register notification or return
maximum volume always and refuse to SetAbsoluteVolume, my guess is
that the latter is better for IOP reasons since the remote device may
register to volume while the endpoint is setting up the transport so
the volume may be set latter.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH] build: Substitute systemd unit directories if overriden by user
From: Lubomir Rintel @ 2013-01-13 10:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Marcel Holtmann, Lubomir Rintel
Otherwise --with-systemdsystemunitdir and --with-systemduserunitdir would be
effectively ignored.
---
configure.ac | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 09e9d4a..514aa5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,8 +202,8 @@ if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
AC_MSG_ERROR([systemd system unit directory is required])
fi
AC_MSG_RESULT([${path_systemunitdir}])
- AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
fi
+AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
AC_ARG_WITH([systemduserunitdir],
AC_HELP_STRING([--with-systemduserunitdir=DIR],
@@ -216,8 +216,8 @@ if (test "${enable_systemd}" != "no" && test -z "${path_userunitdir}"); then
AC_MSG_ERROR([systemd user unit directory is required])
fi
AC_MSG_RESULT([${path_userunitdir}])
- AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
fi
+AC_SUBST(SYSTEMD_USERUNITDIR, [${path_userunitdir}])
AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
[do not install configuration and data files]),
--
1.7.1
^ permalink raw reply related
* 3.8.0-rc3: possible circular locking dependency: &tty->legacy_mutex / &tty->hangup_work with serial/RFCOMM connection via USB bluetooth dongle
From: Sander Eikelenboom @ 2013-01-12 18:46 UTC (permalink / raw)
To: linux-kernel, linux-serial, linux-bluetooth
Cc: Alan Cox, Greg Kroah-Hartman, marcel
Hi,
Running a 3.8.0-rc3 kernel (latest commit b719f43059903820c31edb30f4663a2818836e7f) kernel (debian squeeze os), i'm running into this lockdep warning when:
- Running a perl script that uses rfcomm to communicatie via bluetooth with a bluetooth/TTL converter.
- It can run ok for a few hours before this lockdep occurs and the perl script freezes.
- The info related to bluetooth from syslog:
Jan 12 10:24:08 serveerstertje kernel: [ 7.919775] Bluetooth: Virtual HCI driver ver 1.3
Jan 12 10:24:08 serveerstertje kernel: [ 7.920314] Bluetooth: HCI UART driver ver 2.2
Jan 12 10:24:08 serveerstertje kernel: [ 7.920316] Bluetooth: HCI H4 protocol initialized
Jan 12 10:24:08 serveerstertje kernel: [ 7.920317] Bluetooth: HCI BCSP protocol initialized
Jan 12 10:24:08 serveerstertje kernel: [ 7.920318] Bluetooth: HCILL protocol initialized
Jan 12 10:24:08 serveerstertje kernel: [ 7.920318] Bluetooth: HCIATH3K protocol initialized
Jan 12 10:24:08 serveerstertje kernel: [ 7.920319] Bluetooth: HCI Three-wire UART (H5) protocol initialized
Jan 12 10:24:08 serveerstertje kernel: [ 8.191897] Bluetooth: RFCOMM TTY layer initialized
Jan 12 10:24:08 serveerstertje kernel: [ 8.191930] Bluetooth: RFCOMM socket layer initialized
Jan 12 10:24:08 serveerstertje kernel: [ 8.191931] Bluetooth: RFCOMM ver 1.11
Jan 12 10:24:08 serveerstertje kernel: [ 8.191932] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Jan 12 10:24:08 serveerstertje kernel: [ 8.191933] Bluetooth: BNEP filters: protocol multicast
Jan 12 10:24:08 serveerstertje kernel: [ 8.191944] Bluetooth: BNEP socket layer initialized
Jan 12 10:24:08 serveerstertje kernel: [ 8.191945] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Jan 12 10:24:08 serveerstertje kernel: [ 8.191954] Bluetooth: HIDP socket layer initialized
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Bluetooth deamon 4.66
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Starting SDP server
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Starting experimental netlink support
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Failed to find Bluetooth netlink family
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Failed to init netlink plugin
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: bridge pan0 created
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: HCI dev 0 registered
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Failed to open RFKILL control device
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: HCI dev 0 up
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Starting security manager 0
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Adapter /org/bluez/3912/hci0 has been enabled
Jan 12 10:24:09 serveerstertje bluetoothd[3912]: Failed to access HAL
- And the lockdep warning itself:
[28678.458250]
[28678.476588] ======================================================
[28678.494887] [ INFO: possible circular locking dependency detected ]
[28678.513013] 3.8.0-rc3-20130112-netpatched-rocketscience-radeon #1 Not tainted
[28678.530909] -------------------------------------------------------
[28678.548636] kworker/2:1/19513 is trying to acquire lock:
[28678.566070] (&tty->legacy_mutex){+.+.+.}, at: [<ffffffff819ba5ee>] tty_lock_nested+0x3e/0x80
[28678.583577]
[28678.583577] but task is already holding lock:
[28678.617615] ((&tty->hangup_work)){+.+...}, at: [<ffffffff81080bf8>] process_one_work+0x158/0x4b0
[28678.634569]
[28678.634569] which lock already depends on the new lock.
[28678.634569]
[28678.683868]
[28678.683868] the existing dependency chain (in reverse order) is:
[28678.715354]
[28678.715354] -> #2 ((&tty->hangup_work)){+.+...}:
[28678.745890] [<ffffffff810b4d2e>] __lock_acquire+0x44e/0xdd0
[28678.760975] [<ffffffff810b576a>] lock_acquire+0xba/0x100
[28678.775834] [<ffffffff8108322a>] flush_work+0x3a/0x250
[28678.790408] [<ffffffff81451568>] tty_ldisc_flush_works+0x18/0x40
[28678.804877] [<ffffffff814517ae>] tty_ldisc_release+0x2e/0x90
[28678.818952] [<ffffffff8144b827>] tty_release+0x3c7/0x590
[28678.832813] [<ffffffff8114e009>] __fput+0xa9/0x2c0
[28678.846411] [<ffffffff8114e289>] ____fput+0x9/0x10
[28678.859644] [<ffffffff810854d5>] task_work_run+0x95/0xb0
[28678.872661] [<ffffffff8100dc4d>] do_notify_resume+0x6d/0x80
[28678.885516] [<ffffffff819bb5a2>] int_signal+0x12/0x17
[28678.898047]
[28678.898047] -> #1 (&tty->legacy_mutex/1){+.+...}:
[28678.922334] [<ffffffff810b4d2e>] __lock_acquire+0x44e/0xdd0
[28678.934268] [<ffffffff810b576a>] lock_acquire+0xba/0x100
[28678.945916] [<ffffffff819b754c>] mutex_lock_nested+0x4c/0x450
[28678.957318] [<ffffffff819ba5ee>] tty_lock_nested+0x3e/0x80
[28678.968500] [<ffffffff819ba6aa>] tty_lock_pair+0x6a/0x70
[28678.979405] [<ffffffff8144b5cb>] tty_release+0x16b/0x590
[28678.990012] [<ffffffff8114e009>] __fput+0xa9/0x2c0
[28679.000367] [<ffffffff8114e289>] ____fput+0x9/0x10
[28679.009455] FW: BLOCKED low udp input: IN=eth0 OUT= MAC=40:61:86:f4:67:d9:00:08:ae:10:46:60:08:00 SRC=112.203.174.221 DST=88.159.69.252 LEN=131 TOS=0x00 PREC=0x00 TTL=38 ID=17898 PROTO=UDP SPT=27001 DPT=1024 LEN=111
[28679.030869] [<ffffffff810854d5>] task_work_run+0x95/0xb0
[28679.040727] [<ffffffff8100dc4d>] do_notify_resume+0x6d/0x80
[28679.050419] [<ffffffff819bb5a2>] int_signal+0x12/0x17
[28679.059880]
[28679.059880] -> #0 (&tty->legacy_mutex){+.+.+.}:
[28679.077823] [<ffffffff810b41d8>] validate_chain+0x1258/0x1300
[28679.086583] [<ffffffff810b4d2e>] __lock_acquire+0x44e/0xdd0
[28679.095126] [<ffffffff810b576a>] lock_acquire+0xba/0x100
[28679.103399] [<ffffffff819b754c>] mutex_lock_nested+0x4c/0x450
[28679.111468] [<ffffffff819ba5ee>] tty_lock_nested+0x3e/0x80
[28679.119247] [<ffffffff819ba63b>] tty_lock+0xb/0x10
[28679.126712] [<ffffffff814492b5>] __tty_hangup+0x65/0x3c0
[28679.133940] [<ffffffff81449620>] do_tty_hangup+0x10/0x20
[28679.140970] [<ffffffff81080c60>] process_one_work+0x1c0/0x4b0
[28679.147755] [<ffffffff8108134e>] worker_thread+0x11e/0x3d0
[28679.154383] [<ffffffff81088a36>] kthread+0xd6/0xe0
[28679.160649] [<ffffffff819bb1bc>] ret_from_fork+0x7c/0xb0
[28679.166666]
[28679.166666] other info that might help us debug this:
[28679.166666]
[28679.183748] Chain exists of:
[28679.183748] &tty->legacy_mutex --> &tty->legacy_mutex/1 --> (&tty->hangup_work)
[28679.183748]
[28679.200495] Possible unsafe locking scenario:
[28679.200495]
[28679.211416] CPU0 CPU1
[28679.216751] ---- ----
[28679.222049] lock((&tty->hangup_work));
[28679.227206] lock(&tty->legacy_mutex/1);
[28679.232380] lock((&tty->hangup_work));
[28679.237532] lock(&tty->legacy_mutex);
[28679.242673]
[28679.242673] *** DEADLOCK ***
[28679.242673]
[28679.257840] 2 locks held by kworker/2:1/19513:
[28679.262888] #0: (events){.+.+.+}, at: [<ffffffff81080bf8>] process_one_work+0x158/0x4b0
[28679.268053] #1: ((&tty->hangup_work)){+.+...}, at: [<ffffffff81080bf8>] process_one_work+0x158/0x4b0
[28679.273381]
[28679.273381] stack backtrace:
[28679.283820] Pid: 19513, comm: kworker/2:1 Not tainted 3.8.0-rc3-20130112-netpatched-rocketscience-radeon #1
[28679.289347] Call Trace:
[28679.294804] [<ffffffff810b2c74>] print_circular_bug+0x204/0x300
[28679.300384] [<ffffffff810b41d8>] validate_chain+0x1258/0x1300
[28679.305997] [<ffffffff810b4d2e>] __lock_acquire+0x44e/0xdd0
[28679.311599] [<ffffffff810b4d4b>] ? __lock_acquire+0x46b/0xdd0
[28679.317222] [<ffffffff810b576a>] lock_acquire+0xba/0x100
[28679.322889] [<ffffffff819ba5ee>] ? tty_lock_nested+0x3e/0x80
[28679.328481] [<ffffffff819ba5ee>] ? tty_lock_nested+0x3e/0x80
[28679.334023] [<ffffffff819b754c>] mutex_lock_nested+0x4c/0x450
[28679.339415] [<ffffffff819ba5ee>] ? tty_lock_nested+0x3e/0x80
[28679.344784] [<ffffffff810b5788>] ? lock_acquire+0xd8/0x100
[28679.350154] [<ffffffff81449279>] ? __tty_hangup+0x29/0x3c0
[28679.355506] [<ffffffff819ba5ee>] tty_lock_nested+0x3e/0x80
[28679.360939] [<ffffffff819ba63b>] tty_lock+0xb/0x10
[28679.366282] [<ffffffff814492b5>] __tty_hangup+0x65/0x3c0
[28679.371651] [<ffffffff81080bf8>] ? process_one_work+0x158/0x4b0
[28679.377032] [<ffffffff810b1918>] ? trace_hardirqs_on_caller+0xf8/0x200
[28679.382273] [<ffffffff81449620>] do_tty_hangup+0x10/0x20
[28679.387216] [<ffffffff81080c60>] process_one_work+0x1c0/0x4b0
[28679.392118] [<ffffffff81080bf8>] ? process_one_work+0x158/0x4b0
[28679.397039] [<ffffffff81449610>] ? __tty_hangup+0x3c0/0x3c0
[28679.401952] [<ffffffff8108134e>] worker_thread+0x11e/0x3d0
[28679.406859] [<ffffffff810b1918>] ? trace_hardirqs_on_caller+0xf8/0x200
[28679.411787] [<ffffffff81081230>] ? manage_workers+0x2e0/0x2e0
[28679.416683] [<ffffffff81088a36>] kthread+0xd6/0xe0
[28679.421538] [<ffffffff81088960>] ? __init_kthread_worker+0x70/0x70
[28679.426429] [<ffffffff819bb1bc>] ret_from_fork+0x7c/0xb0
[28679.431278] [<ffffffff81088960>] ? __init_kthread_worker+0x70/0x70
- This is followed by blocked task messages for the perl script:
Jan 12 18:25:29 serveerstertje kernel: [28926.144229] INFO: task zabbix_slimmeme:26976 blocked for more than 120 seconds.
Jan 12 18:25:29 serveerstertje kernel: [28926.162883] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Jan 12 18:25:29 serveerstertje kernel: [28926.181312] zabbix_slimmeme D ffff88003851d230 0 26976 22112 0x00000000
Jan 12 18:25:29 serveerstertje kernel: [28926.199596] ffff88002d473818 0000000000000216 ffff880000000002 ffffffff8202be38
Jan 12 18:25:29 serveerstertje kernel: [28926.217728] ffff88003851d230 0000000000013040 ffff88002d473fd8 ffff88002d472010
Jan 12 18:25:29 serveerstertje kernel: [28926.235627] 0000000000013040 0000000000013040 ffff88002d473fd8 0000000000013040
Jan 12 18:25:29 serveerstertje kernel: [28926.253346] Call Trace:
Jan 12 18:25:29 serveerstertje kernel: [28926.270648] [<ffffffff810be1ed>] ? __module_text_address+0xd/0x60
Jan 12 18:25:29 serveerstertje kernel: [28926.322462] [<ffffffff810be1ed>] ? __module_text_address+0xd/0x60
Jan 12 18:25:29 serveerstertje kernel: [28926.339617] [<ffffffff810be44b>] ? is_module_text_address+0x2b/0x60
Jan 12 18:25:29 serveerstertje kernel: [28926.356452] [<ffffffff81085958>] ? __kernel_text_address+0x58/0x80
Jan 12 18:25:29 serveerstertje kernel: [28926.373057] [<ffffffff81140049>] ? sysfs_slab_add+0x149/0x200
Jan 12 18:25:29 serveerstertje kernel: [28926.389435] [<ffffffff81140067>] ? sysfs_slab_add+0x167/0x200
Jan 12 18:25:29 serveerstertje kernel: [28926.405516] [<ffffffff819b8d04>] schedule+0x24/0x70
Jan 12 18:25:29 serveerstertje kernel: [28926.421242] [<ffffffff819b5f6d>] schedule_timeout+0x1bd/0x220
Jan 12 18:25:29 serveerstertje kernel: [28926.436793] [<ffffffff810b5788>] ? lock_acquire+0xd8/0x100
Jan 12 18:25:29 serveerstertje kernel: [28926.452138] [<ffffffff819b8201>] ? wait_for_common+0x31/0x170
Jan 12 18:25:29 serveerstertje kernel: [28926.467171] [<ffffffff810b5c17>] ? lock_release+0x117/0x250
Jan 12 18:25:29 serveerstertje kernel: [28926.481938] [<ffffffff819b82d1>] wait_for_common+0x101/0x170
Jan 12 18:25:29 serveerstertje kernel: [28926.496482] [<ffffffff81098730>] ? try_to_wake_up+0x310/0x310
Jan 12 18:25:29 serveerstertje kernel: [28926.510873] [<ffffffff819b83e8>] wait_for_completion+0x18/0x20
Jan 12 18:25:29 serveerstertje kernel: [28926.525014] [<ffffffff81083385>] flush_work+0x195/0x250
Jan 12 18:25:29 serveerstertje kernel: [28926.538855] [<ffffffff810833a0>] ? flush_work+0x1b0/0x250
Jan 12 18:25:29 serveerstertje kernel: [28926.552411] [<ffffffff81080400>] ? cwq_dec_nr_in_flight+0xd0/0xd0
Jan 12 18:25:29 serveerstertje kernel: [28926.565910] [<ffffffff81451568>] tty_ldisc_flush_works+0x18/0x40
Jan 12 18:25:29 serveerstertje kernel: [28926.579013] [<ffffffff814517ae>] tty_ldisc_release+0x2e/0x90
Jan 12 18:25:29 serveerstertje kernel: [28926.591876] [<ffffffff8144b827>] tty_release+0x3c7/0x590
Jan 12 18:25:29 serveerstertje kernel: [28926.604527] [<ffffffff810b1a2d>] ? trace_hardirqs_on+0xd/0x10
Jan 12 18:25:29 serveerstertje kernel: [28926.616853] [<ffffffff819b63a9>] ? __mutex_unlock_slowpath+0x149/0x1d0
Jan 12 18:25:29 serveerstertje kernel: [28926.628997] [<ffffffff81098730>] ? try_to_wake_up+0x310/0x310
Jan 12 18:25:29 serveerstertje kernel: [28926.640952] [<ffffffff8144bdb4>] tty_open+0x3c4/0x5f0
Jan 12 18:25:30 serveerstertje kernel: [28926.652584] [<ffffffff81150a18>] chrdev_open+0x98/0x170
Jan 12 18:25:30 serveerstertje kernel: [28926.663972] [<ffffffff810912cd>] ? lg_local_unlock+0x3d/0x70
Jan 12 18:25:30 serveerstertje kernel: [28926.675152] [<ffffffff81150980>] ? cdev_put+0x30/0x30
Jan 12 18:25:30 serveerstertje kernel: [28926.686173] [<ffffffff8114b1fe>] do_dentry_open+0x25e/0x310
Jan 12 18:25:30 serveerstertje kernel: [28926.696868] [<ffffffff8114b3c0>] finish_open+0x30/0x50
Jan 12 18:25:30 serveerstertje kernel: [28926.707267] [<ffffffff8115a79e>] do_last+0x30e/0xe90
Jan 12 18:25:30 serveerstertje kernel: [28926.717404] [<ffffffff81157aba>] ? link_path_walk+0x9a/0x9f0
Jan 12 18:25:30 serveerstertje kernel: [28926.727353] [<ffffffff8115b3ce>] path_openat+0xae/0x4e0
Jan 12 18:25:30 serveerstertje kernel: [28926.737008] [<ffffffff810b5c17>] ? lock_release+0x117/0x250
Jan 12 18:25:30 serveerstertje kernel: [28926.746482] [<ffffffff81160264>] ? do_select+0x5f4/0x6d0
Jan 12 18:25:30 serveerstertje kernel: [28926.755613] [<ffffffff8115b934>] do_filp_open+0x44/0xa0
Jan 12 18:25:30 serveerstertje kernel: [28926.764542] [<ffffffff811691e3>] ? __alloc_fd+0xb3/0x150
Jan 12 18:25:30 serveerstertje kernel: [28926.773224] [<ffffffff8114ad13>] do_sys_open+0x103/0x1f0
Jan 12 18:25:30 serveerstertje kernel: [28926.781585] [<ffffffff8114ae3c>] sys_open+0x1c/0x20
Jan 12 18:25:30 serveerstertje kernel: [28926.789685] [<ffffffff819bb269>] system_call_fastpath+0x16/0x1b
Jan 12 18:25:30 serveerstertje kernel: [28926.797570] INFO: lockdep is turned off.
^ permalink raw reply
* Re: [PATCH 1/1] test: Make map script a command line client
From: Marcel Holtmann @ 2013-01-11 20:48 UTC (permalink / raw)
To: Christian Fetzer; +Cc: linux-bluetooth, Christian Fetzer
In-Reply-To: <1357922675-11718-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
Hi Christian,
> Rework the map-client test script into an interactive command line client.
> Now multiple MCE functions can be called in one active session.
> The script also allows to specify all filters or optional parameters including
> auto completion.
>
> Change-Id: I9c9ede2bc958009c757384177cf06c081d984c98
no Change-Id crap please.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 2/7] gdbus: Add g_dbus_proxy_get_client function
From: Marcel Holtmann @ 2013-01-11 20:47 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1357905018-23237-2-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
> This is convenient as some callbacks don't provide the client which
> the proxy belongs.
and I did not add that one on purpose. You should know where your proxy
belongs to and worst case hand it over via user_data.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 1/7] gdbus: Add g_dbus_client_get_proxy
From: Marcel Holtmann @ 2013-01-11 20:46 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1357905018-23237-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
> g_dbus_client_get_proxy gives the possibilitity to just check if a
> proxy exist for the given path and interface pair instead of using
> g_dbus_proxy_new which end up creating a proxy if it doesn't exists
> which is not always necessary.
why would we do that. You get the proxy via the client callbacks for
proxy created or proxy removed.
The proxy_new method is for dealing with services that do not have
ObjectManager support.
Regards
Marcel
^ permalink raw reply
* [PATCH BlueZ 11/11] audio: Bump AVRCP CT version to 1.5
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/avrcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 8bd5fb6..19b6721 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -231,7 +231,7 @@ static sdp_record_t *avrcp_ct_record(void)
sdp_record_t *record;
sdp_data_t *psm, *version, *features;
uint16_t lp = AVCTP_CONTROL_PSM;
- uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103;
+ uint16_t avrcp_ver = 0x0105, avctp_ver = 0x0103;
uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
AVRCP_FEATURE_CATEGORY_2 |
AVRCP_FEATURE_CATEGORY_3 |
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 10/11] avrcp: Handle SetAbsoluteVolume command
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/avrcp.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index d715177..8bd5fb6 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1392,6 +1392,32 @@ err:
return AVC_CTYPE_REJECTED;
}
+static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session,
+ struct avrcp_header *pdu,
+ uint8_t transaction)
+{
+ struct avrcp_player *player = session->player;
+ uint16_t len = ntohs(pdu->params_len);
+
+ if (len != 1)
+ goto err;
+
+ if (pdu->params[0] > 127)
+ goto err;
+
+ if (!player)
+ goto err;
+
+ media_transport_update_device_volume(session->dev, pdu->params[0]);
+
+ return AVC_CTYPE_ACCEPTED;
+
+err:
+ pdu->params_len = htons(1);
+ pdu->params[0] = AVRCP_STATUS_INVALID_PARAM;
+ return AVC_CTYPE_REJECTED;
+}
+
static const struct control_pdu_handler tg_control_handlers[] = {
{ AVRCP_GET_CAPABILITIES, AVC_CTYPE_STATUS,
avrcp_handle_get_capabilities },
@@ -1429,6 +1455,8 @@ static const struct control_pdu_handler ct_control_handlers[] = {
avrcp_handle_get_capabilities },
{ AVRCP_REGISTER_NOTIFICATION, AVC_CTYPE_NOTIFY,
avrcp_handle_register_notification },
+ { AVRCP_SET_ABSOLUTE_VOLUME, AVC_CTYPE_CONTROL,
+ avrcp_handle_set_absolute_volume },
{ },
};
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 09/11] transport: Update volume passing only audio_device
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 19 +++++++++++++++++++
profiles/audio/transport.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 9419af0..c344a92 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -896,3 +896,22 @@ uint8_t media_transport_get_device_volume(struct audio_device *dev)
return 128;
}
+
+void media_transport_update_device_volume(struct audio_device *dev,
+ uint8_t volume)
+{
+ GSList *l;
+
+ if (dev == NULL)
+ return;
+
+ for (l = transports; l; l = l->next) {
+ struct media_transport *transport = l->data;
+ if (transport->device != dev)
+ continue;
+
+ /* Volume is A2DP only */
+ if (media_endpoint_get_sep(transport->endpoint))
+ media_transport_update_volume(transport, volume);
+ }
+}
diff --git a/profiles/audio/transport.h b/profiles/audio/transport.h
index cbbd0b6..b8cbf1f 100644
--- a/profiles/audio/transport.h
+++ b/profiles/audio/transport.h
@@ -42,3 +42,5 @@ void transport_get_properties(struct media_transport *transport,
DBusMessageIter *iter);
uint8_t media_transport_get_device_volume(struct audio_device *dev);
+void media_transport_update_device_volume(struct audio_device *dev,
+ uint8_t volume);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 08/11] avrcp: Notify remote of volume changes
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/avrcp.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index b1016df..d715177 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -2540,7 +2540,7 @@ int avrcp_set_volume(struct audio_device *dev, uint8_t volume)
{
struct avrcp_server *server;
struct avrcp *session;
- uint8_t buf[AVRCP_HEADER_LENGTH + 1];
+ uint8_t buf[AVRCP_HEADER_LENGTH + 2];
struct avrcp_header *pdu = (void *) buf;
server = find_server(servers, device_get_adapter(dev->btd_dev));
@@ -2555,13 +2555,27 @@ int avrcp_set_volume(struct audio_device *dev, uint8_t volume)
set_company_id(pdu->company_id, IEEEID_BTSIG);
- pdu->pdu_id = AVRCP_SET_ABSOLUTE_VOLUME;
- pdu->params[0] = volume;
- pdu->params_len = htons(1);
-
DBG("volume=%u", volume);
- return avctp_send_vendordep_req(session->conn, AVC_CTYPE_CONTROL,
- AVC_SUBUNIT_PANEL, buf, sizeof(buf),
+ if (session->target) {
+ pdu->pdu_id = AVRCP_SET_ABSOLUTE_VOLUME;
+ pdu->params[0] = volume;
+ pdu->params_len = htons(1);
+
+ return avctp_send_vendordep_req(session->conn,
+ AVC_CTYPE_CONTROL, AVC_SUBUNIT_PANEL,
+ buf, sizeof(buf),
avrcp_handle_set_volume, session);
+ } else {
+ uint8_t id = AVRCP_EVENT_VOLUME_CHANGED;
+ pdu->pdu_id = AVRCP_REGISTER_NOTIFICATION;
+ pdu->params[0] = AVRCP_EVENT_VOLUME_CHANGED;
+ pdu->params[1] = volume;
+ pdu->params_len = htons(2);
+
+ return avctp_send_vendordep(session->conn,
+ session->transaction_events[id],
+ AVC_CTYPE_CHANGED, AVC_SUBUNIT_PANEL,
+ buf, sizeof(buf));
+ }
}
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 07/11] avrcp: Handle RegisterNotification for volume
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
This commit answers a NOTIFY command to register for nofications of
EVENT_VOLUME_CHANGED with an INTERIM response containing the current
absolute volume value.
---
profiles/audio/avrcp.c | 15 +++++++++++++++
profiles/audio/transport.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index bb8ab24..b1016df 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -62,6 +62,7 @@
#include "avdtp.h"
#include "sink.h"
#include "player.h"
+#include "transport.h"
/* Company IDs for vendor dependent commands */
#define IEEEID_BTSIG 0x001958
@@ -1247,6 +1248,7 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
uint8_t transaction)
{
struct avrcp_player *player = session->player;
+ struct audio_device *dev = session->dev;
uint16_t len = ntohs(pdu->params_len);
uint64_t uid;
GList *settings;
@@ -1293,6 +1295,17 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
}
break;
+ case AVRCP_EVENT_VOLUME_CHANGED:
+ if (session->version < 0x0104)
+ goto err;
+
+ pdu->params[1] = media_transport_get_device_volume(dev);
+ if (pdu->params[1] > 127)
+ goto err;
+
+ len = 2;
+
+ break;
default:
/* All other events are not supported yet */
goto err;
@@ -1414,6 +1427,8 @@ static const struct control_pdu_handler tg_control_handlers[] = {
static const struct control_pdu_handler ct_control_handlers[] = {
{ AVRCP_GET_CAPABILITIES, AVC_CTYPE_STATUS,
avrcp_handle_get_capabilities },
+ { AVRCP_REGISTER_NOTIFICATION, AVC_CTYPE_NOTIFY,
+ avrcp_handle_register_notification },
{ },
};
diff --git a/profiles/audio/transport.h b/profiles/audio/transport.h
index 78c6fa7..cbbd0b6 100644
--- a/profiles/audio/transport.h
+++ b/profiles/audio/transport.h
@@ -23,6 +23,7 @@
*/
struct media_transport;
+struct media_endpoint;
struct media_transport *media_transport_create(struct media_endpoint *endpoint,
struct audio_device *device,
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 06/11] transport: Get volume passing only audio_device
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 20 ++++++++++++++++++++
profiles/audio/transport.h | 2 ++
2 files changed, 22 insertions(+)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index c3e26f4..9419af0 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -876,3 +876,23 @@ void media_transport_update_volume(struct media_transport *transport,
transport->path,
MEDIA_TRANSPORT_INTERFACE, "Volume");
}
+
+uint8_t media_transport_get_device_volume(struct audio_device *dev)
+{
+ GSList *l;
+
+ if (dev == NULL)
+ return 128;
+
+ for (l = transports; l; l = l->next) {
+ struct media_transport *transport = l->data;
+ if (transport->device != dev)
+ continue;
+
+ /* Volume is A2DP only */
+ if (media_endpoint_get_sep(transport->endpoint))
+ return media_transport_get_volume(transport);
+ }
+
+ return 128;
+}
diff --git a/profiles/audio/transport.h b/profiles/audio/transport.h
index 0fe8973..78c6fa7 100644
--- a/profiles/audio/transport.h
+++ b/profiles/audio/transport.h
@@ -39,3 +39,5 @@ void media_transport_update_volume(struct media_transport *transport,
uint8_t volume);
void transport_get_properties(struct media_transport *transport,
DBusMessageIter *iter);
+
+uint8_t media_transport_get_device_volume(struct audio_device *dev);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 05/11] transport: Keep a list o all existent transports
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 4a81d85..c3e26f4 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -107,6 +107,8 @@ struct media_transport {
void *data;
};
+static GSList *transports = NULL;
+
static const char *state2str(transport_state_t state)
{
switch (state) {
@@ -703,6 +705,8 @@ static void media_transport_free(void *data)
{
struct media_transport *transport = data;
+ transports = g_slist_remove(transports, transport);
+
if (transport->owner)
media_transport_remove_owner(transport);
@@ -816,6 +820,8 @@ struct media_transport *media_transport_create(struct media_endpoint *endpoint,
goto fail;
}
+ transports = g_slist_append(transports, transport);
+
return transport;
fail:
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 04/11] transport: Get volume from transport
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 6 ++++++
profiles/audio/transport.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index f3caa1b..4a81d85 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -849,6 +849,12 @@ struct audio_device *media_transport_get_dev(struct media_transport *transport)
return transport->device;
}
+uint16_t media_transport_get_volume(struct media_transport *transport)
+{
+ struct a2dp_transport *a2dp = transport->data;
+ return a2dp->volume;
+}
+
void media_transport_update_volume(struct media_transport *transport,
uint8_t volume)
{
diff --git a/profiles/audio/transport.h b/profiles/audio/transport.h
index a6b71e5..0fe8973 100644
--- a/profiles/audio/transport.h
+++ b/profiles/audio/transport.h
@@ -32,6 +32,7 @@ struct media_transport *media_transport_create(struct media_endpoint *endpoint,
void media_transport_destroy(struct media_transport *transport);
const char *media_transport_get_path(struct media_transport *transport);
struct audio_device *media_transport_get_dev(struct media_transport *transport);
+uint16_t media_transport_get_volume(struct media_transport *transport);
void media_transport_update_delay(struct media_transport *transport,
uint16_t delay);
void media_transport_update_volume(struct media_transport *transport,
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 03/11] avrcp: Add EVENT_VOLUME_CHANGED to CT capabilities
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/avrcp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index ef324b0..bb8ab24 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -2164,6 +2164,9 @@ static void session_ct_init(struct avrcp *session)
session->control_handlers = ct_control_handlers;
+ if (session->version >= 0x0104)
+ session->supported_events = (1 << AVRCP_EVENT_VOLUME_CHANGED);
+
DBG("%p version 0x%04x", session, session->version);
session->control_id = avctp_register_pdu_handler(session->conn,
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 02/11] transport: Store the value set through the 'Volume' property
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 6ffa98a..f3caa1b 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -658,6 +658,8 @@ static void set_volume(const GDBusPropertyTable *property,
if (a2dp->volume != volume)
avrcp_set_volume(transport->device, volume);
+ a2dp->volume = volume;
+
g_dbus_pending_property_success(id);
}
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 01/11] transport: Initialize the "Volume" property with 50%
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
In-Reply-To: <1357935934-20033-1-git-send-email-jprvita@openbossa.org>
---
profiles/audio/transport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index a4370a5..6ffa98a 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -787,7 +787,7 @@ struct media_transport *media_transport_create(struct media_endpoint *endpoint,
struct a2dp_transport *a2dp;
a2dp = g_new0(struct a2dp_transport, 1);
- a2dp->volume = -1;
+ a2dp->volume = 63;
transport->resume = resume_a2dp;
transport->suspend = suspend_a2dp;
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 00/11] AVRCP Absolute Volume Control support
From: João Paulo Rechi Vita @ 2013-01-11 20:25 UTC (permalink / raw)
To: linux-bluetooth
Cc: vinicius.gomes, claudio.takahasi, luiz.von.dentz,
João Paulo Rechi Vita
This series implements support for the Absolute Volume Control feature for the
CT role of AVRCP version 1.5.
João Paulo Rechi Vita (11):
transport: Initialize the "Volume" property with 50%
transport: Store the value set through the 'Volume' property
avrcp: Add EVENT_VOLUME_CHANGED to CT capabilities
transport: Get volume from transport
transport: Keep a list o all existent transports
transport: Get volume passing only audio_device
avrcp: Handle RegisterNotification for volume
avrcp: Notify remote of volume changes
transport: Update volume passing only audio_device
avrcp: Handle SetAbsoluteVolume command
audio: Bump AVRCP CT version to 1.5
profiles/audio/avrcp.c | 76 +++++++++++++++++++++++++++++++++++++++++-----
profiles/audio/transport.c | 55 ++++++++++++++++++++++++++++++++-
profiles/audio/transport.h | 6 ++++
3 files changed, 128 insertions(+), 9 deletions(-)
--
1.7.11.7
^ permalink raw reply
* Re: pull request: bluetooth 2013-01-10
From: John W. Linville @ 2013-01-11 19:11 UTC (permalink / raw)
To: Gustavo Padovan, linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <20130110073423.GE18821@joana>
On Thu, Jan 10, 2013 at 05:34:23AM -0200, Gustavo Padovan wrote:
> Hi John,
>
> A few fixes for 3.8. Five of them are just new devices ids addition.
> Apart from the that there is fix to a kernel memory leak to userspace from
> Anderson Lizardo, two interoperability fixes from Jaganath Kanakkassery and
> Szymon Janc. And a crash fix by me.
>
> Please pull, or let me know of any problem with these patches. Thanks.
>
> Gustavo
Pulled, thanks!
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* [PATCH 1/1] test: Make map script a command line client
From: Christian Fetzer @ 2013-01-11 16:44 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Fetzer
From: Christian Fetzer <christian.fetzer@bmw-carit.de>
Rework the map-client test script into an interactive command line client.
Now multiple MCE functions can be called in one active session.
The script also allows to specify all filters or optional parameters including
auto completion.
Change-Id: I9c9ede2bc958009c757384177cf06c081d984c98
---
test/map-client | 320 ++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 218 insertions(+), 102 deletions(-)
diff --git a/test/map-client b/test/map-client
index 9fb7a5e..c5c899a 100755
--- a/test/map-client
+++ b/test/map-client
@@ -4,10 +4,13 @@ from __future__ import absolute_import, print_function, unicode_literals
import gobject
+import cmd
+import shlex
import sys
import os
import dbus
import dbus.mainloop.glib
+import threading
from optparse import OptionParser
from pprint import pformat
@@ -31,49 +34,39 @@ def unwrap(x):
return tuple(map(unwrap, x))
if isinstance(x, dict):
- return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()])
+ return dict([(unwrap(k), unwrap(v)) for k, v in x.items()])
- for t in [unicode, str, long, int, float, bool]:
+ if sys.version_info >= (3, 0):
+ coversion_types = [str, int, float, bool]
+ else:
+ coversion_types = [unicode, str, long, int, float, bool]
+
+ for t in coversion_types:
if isinstance(x, t):
return t(x)
return x
def parse_options():
+ parser.add_option("-s", "--source", dest="source",
+ help="Source / local address to use", metavar="SOURCE")
parser.add_option("-d", "--device", dest="device",
help="Device to connect", metavar="DEVICE")
- parser.add_option("-c", "--chdir", dest="new_dir",
- help="Change current directory to DIR", metavar="DIR")
- parser.add_option("-l", "--lsdir", action="store_true", dest="ls_dir",
- help="List folders in current directory")
- parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
- parser.add_option("-L", "--lsmsg", action="store", dest="ls_msg",
- help="List messages in supplied CWD subdir")
- parser.add_option("-g", "--get", action="store", dest="get_msg",
- help="Get message contents")
- parser.add_option("--get-properties", action="store", dest="get_msg_properties",
- help="Get message properties")
- parser.add_option("--mark-read", action="store", dest="mark_msg_read",
- help="Marks the messages as read")
- parser.add_option("--mark-unread", action="store", dest="mark_msg_unread",
- help="Marks the messages as unread")
- parser.add_option("--mark-deleted", action="store", dest="mark_msg_deleted",
- help="Deletes the message from the folder")
- parser.add_option("--mark-undeleted", action="store", dest="mark_msg_undeleted",
- help="Undeletes the message")
- parser.add_option("-u", "--update-inbox", action="store_true", dest="update_inbox",
- help="Checks for new mails")
+ parser.add_option("-p", "--port", dest="port", default=0,
+ help="RFCOMM port to connect", metavar="PORT")
+ parser.add_option("-v", "--verbose", action="store_true",
+ dest="verbose")
return parser.parse_args()
-def set_folder(session, new_dir):
- session.SetFolder(new_dir)
-
-class MapClient:
+class MapClient(cmd.Cmd):
def __init__(self, session_path, verbose=False):
+ cmd.Cmd.__init__(self)
+ cmd.Cmd.prompt = "MCE> "
self.progress = 0
self.transfer_path = None
self.props = dict()
+ self.dir = dict()
self.verbose = verbose
self.path = session_path
bus = dbus.SessionBus()
@@ -85,8 +78,15 @@ class MapClient:
signal_name="PropertiesChanged",
path_keyword="path")
- def create_transfer_reply(self, reply):
- (path, properties) = reply
+ def create_transfer_reply_get(self, path, properties):
+ self.dir[path] = "in";
+ self.create_transfer_reply(path, properties)
+
+ def create_transfer_reply_put(self, path, properties):
+ self.dir[path] = "out";
+ self.create_transfer_reply(path, properties)
+
+ def create_transfer_reply(self, path, properties):
self.transfer_path = path
self.props[path] = properties
if self.verbose:
@@ -98,22 +98,25 @@ class MapClient:
print("Operation succeeded")
def error(self, err):
- print err
- mainloop.quit()
+ print(err)
def transfer_complete(self, path):
if self.verbose:
print("Transfer finished")
properties = self.props.get(path)
+ print(path)
+ print(self.dir)
if properties == None:
return
- f = open(properties["Filename"], "r")
- os.remove(properties["Filename"])
- print(f.readlines())
+ if self.dir.get(path) == "in":
+ f = open(properties["Filename"], "r")
+ os.remove(properties["Filename"])
+ print(f.readlines())
- def transfer_error(self, path):
- print("Transfer %s error" % path)
- mainloop.quit()
+ def transfer_error(self, code, message, path):
+ if path != self.transfer_path:
+ return
+ print("Transfer finished with error %s: %s" % (code, message))
def properties_changed(self, interface, properties, invalidated, path):
req = self.props.get(path)
@@ -128,46 +131,171 @@ class MapClient:
self.transfer_error(path)
return
- def set_folder(self, new_dir):
- self.map.SetFolder(new_dir)
-
- def list_folders(self):
- for i in self.map.ListFolders(dict()):
- print("%s/" % (i["Name"]))
-
- def list_messages(self, folder):
- ret = self.map.ListMessages(folder, dict())
- print(pformat(unwrap(ret)))
-
- def get_message(self, handle):
- self.map.ListMessages("", dict())
+ def emptyline(self):
+ pass
+
+ def do_EOF(self, args):
+ """ Quit """
+ return True
+
+ def do_exit(self, args):
+ """ Quit """
+ return True
+
+ # SetFolder
+ def do_SetFolder(self, new_dir):
+ """ Set working directory for current session """
+ try:
+ self.map.SetFolder(new_dir)
+ except dbus.exceptions.DBusException as e:
+ print("Failed:", e)
+
+ def do_cd(self, new_dir):
+ self.do_SetFolder(new_dir)
+
+ # ListFolders
+ list_folder_parms = {
+ 'MaxCount': lambda x: dbus.UInt16(x),
+ 'Offset': lambda x: dbus.UInt16(x)
+ }
+
+ def do_ListFolders(self, args):
+ """ List directories in current working directory """
+ parms={}
+ if args:
+ try:
+ for i in args.split(' '):
+ k,v = i.split('=')
+ parms[k] = self.list_folder_parms[k](v)
+ except:
+ print("Syntax error")
+ return
+
+ try:
+ for i in self.map.ListFolders(parms):
+ print("%s/" % (i["Name"]))
+ except dbus.exceptions.DBusException as e:
+ print("Failed:", e)
+
+ def complete_ListFolders(self, text, args, begidx, endidx):
+ if not text:
+ completions = list(self.list_folder_parms.keys())
+ else:
+ completions = [ f + "=" for f in
+ self.list_folder_parms.keys()
+ if f.startswith(text) ]
+ return completions
+
+ # ListFilterFields
+ def do_ListFilterFields(self, args):
+ """ List all available fields that can be used as filters """
+ for i in self.map.ListFilterFields():
+ print(i)
+
+ # ListMessages
+ list_msg_parms = { 'Folder': lambda x: x,
+ 'MaxCount': lambda x: dbus.UInt16(x),
+ 'Offset': lambda x: dbus.UInt16(x),
+ 'SubjectLength': lambda x: dbus.Byte(int(x)),
+ 'Fields': lambda x: x.split(','),
+ 'Types': lambda x: x.split(','),
+ 'PeriodBegin': lambda x: dbus.String(x),
+ 'PeriodEnd': lambda x: dbus.String(x),
+ 'Read': lambda x:
+ dbus.Boolean(x.lower() in
+ ("yes", "true", "1")),
+ 'Recipient': lambda x: dbus.String(x),
+ 'Sender': lambda x: dbus.String(x),
+ 'Priority': lambda x:
+ dbus.Boolean(x.lower() in
+ ("yes", "true", "1"))
+ }
+
+ def do_ListMessages(self, args):
+ """ List messages in current working directory """
+ parms={}
+ if args:
+ try:
+ for i in shlex.split(args):
+ k,v = i.split('=')
+ parms[k] = self.list_msg_parms[k](v)
+ except Exception as e:
+ print("Syntax error", e)
+ return
+
+ try:
+ ret = self.map.ListMessages(parms.pop('Folder', ''),
+ parms)
+ print(pformat(unwrap(ret)))
+ except dbus.exceptions.DBusException as e:
+ print("Failed:", e)
+
+ def complete_ListMessages(self, text, args, begidx, endidx):
+ if not text:
+ completions = list(self.list_msg_parms.keys())
+ else:
+ completions = [ f + "=" for f in
+ self.list_msg_parms.keys()
+ if f.startswith(text) ]
+ return completions
+
+ def do_ls(self, args):
+ print("Folders:")
+ self.do_ListFolders(args)
+ print("Messages:")
+ self.do_ListMessages(args)
+
+ # GetMessage
+ def do_GetMessage(self, handle):
+ """ Download message """
path = self.path + "/message" + handle
obj = bus.get_object(BUS_NAME, path)
msg = dbus.Interface(obj, MESSAGE_INTERFACE)
- msg.Get("", True, reply_handler=self.create_transfer_reply,
+ msg.Get("", True, reply_handler=self.create_transfer_reply_get,
error_handler=self.error)
- def get_message_properties(self, handle):
- self.map.ListMessages("", dict())
- path = self.path + "/message" + handle
- obj = bus.get_object(BUS_NAME, path)
- msg = dbus.Interface(obj, "org.freedesktop.DBus.Properties")
- ret = msg.GetAll(MESSAGE_INTERFACE)
- print(pformat(unwrap(ret)))
-
- def set_message_property(self, handle, prop, flag):
- self.map.ListMessages("", dict())
- path = self.path + "/message" + handle
- obj = bus.get_object(BUS_NAME, path)
- msg = dbus.Interface(obj, MESSAGE_INTERFACE)
- msg.SetProperty (prop, flag);
-
- def update_inbox(self):
- self.map.UpdateInbox()
-
+ # GetMessageProperties
+ def do_GetMessageProperties(self, handle):
+ """ Returns all properties for the message """
+ try:
+ path = self.path + "/message" + handle
+ obj = bus.get_object(BUS_NAME, path)
+ msg = dbus.Interface(obj,
+ "org.freedesktop.DBus.Properties")
+ ret = msg.GetAll(MESSAGE_INTERFACE)
+ print(pformat(unwrap(ret)))
+ except Exception as e:
+ print("Error", e)
+ return
-if __name__ == '__main__':
+ # SetMessageProperties
+ def do_SetMessageProperty(self, args):
+ """Sets value to the mentioned property (Read, Delete) """
+ try:
+ handle, parm_line = args.split(' ')
+ parm, value = parm_line.split('=')
+ except Exception as e:
+ print("Syntax error", e)
+ return
+ try:
+ path = self.path + "/message" + handle
+ obj = bus.get_object(BUS_NAME, path)
+ msg = dbus.Interface(obj, MESSAGE_INTERFACE)
+ msg.SetProperty(parm, value in ("yes", "true", "1"));
+ except dbus.exceptions.DBusException as e:
+ print("Failed:", e)
+
+ # UpdateInbox
+ def do_UpdateInbox(self, line):
+ """ Request remote to update its inbox """
+ try:
+ self.map.UpdateInbox()
+ except dbus.exceptions.DBusException as e:
+ print("Failed:", e)
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.threads_init()
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
parser = OptionParser()
@@ -179,44 +307,32 @@ if __name__ == '__main__':
exit(0)
bus = dbus.SessionBus()
+ gobject.threads_init()
mainloop = gobject.MainLoop()
- client = dbus.Interface(bus.get_object(BUS_NAME, PATH),
- CLIENT_INTERFACE)
-
- print("Creating Session")
- path = client.CreateSession(options.device, { "Target": "map" })
+ mainloop_thread = threading.Thread(target=mainloop.run)
+ mainloop_thread.start()
- map_client = MapClient(path, options.verbose)
-
- if options.new_dir:
- map_client.set_folder(options.new_dir)
-
- if options.ls_dir:
- map_client.list_folders()
-
- if options.ls_msg is not None:
- map_client.list_messages(options.ls_msg)
-
- if options.get_msg is not None:
- map_client.get_message(options.get_msg)
-
- if options.get_msg_properties is not None:
- map_client.get_message_properties(options.get_msg_properties)
+ try:
+ client = dbus.Interface(bus.get_object(BUS_NAME, PATH),
+ CLIENT_INTERFACE)
- if options.mark_msg_read is not None:
- map_client.set_message_property(options.mark_msg_read, "Read", True)
+ print("Creating Session")
- if options.mark_msg_unread is not None:
- map_client.set_message_property(options.mark_msg_unread, "Read", False)
+ opts = { "Target": "map",
+ "Channel": dbus.Byte(int(options.port)) }
+ if options.source:
+ opts["Source"] = options.source
- if options.mark_msg_deleted is not None:
- map_client.set_message_property(options.mark_msg_deleted, "Deleted", True)
+ path = client.CreateSession(options.device, opts)
- if options.mark_msg_undeleted is not None:
- map_client.set_message_property(options.mark_msg_undeleted, "Deleted", False)
+ map_client = MapClient(path, options.verbose)
+ map_client.cmdloop()
- if options.update_inbox:
- map_client.update_inbox()
+ except (KeyboardInterrupt, SystemExit):
+ pass
+ except Exception as e:
+ print("Error", e)
- mainloop.run()
+ mainloop.quit()
+ mainloop_thread.join()
--
1.8.1
^ permalink raw reply related
* [PATCH 8/8] obexd: Remove transferred file only if the GET operation failed
From: Christian Fetzer @ 2013-01-11 15:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Fetzer
In-Reply-To: <1357919757-10334-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
From: Christian Fetzer <christian.fetzer@bmw-carit.de>
Since 9606375649e12f1b9f302bbb5bb8f87957387ddd xfer_complete() sets the
transfer status rather than the size. Adapt obc_transfer_free to check
for the completed status to avoid deletion of completed transfers.
---
obexd/client/transfer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 541f405..427eab7 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -327,7 +327,8 @@ static void obc_transfer_free(struct obc_transfer *transfer)
}
if (transfer->op == G_OBEX_OP_GET &&
- transfer->transferred != transfer->size)
+ transfer->status != TRANSFER_STATUS_COMPLETE &&
+ transfer->filename)
remove(transfer->filename);
if (transfer->fd > 0)
--
1.8.1
^ permalink raw reply related
* [PATCH 7/8] obexd: Change behavior of parse_filter_read
From: Christian Fetzer @ 2013-01-11 15:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Fetzer
In-Reply-To: <1357919757-10334-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
From: Christian Fetzer <christian.fetzer@bmw-carit.de>
Calls to ListMessages with filter 'Read' set to true should
request the MSE to send read messages only.
The old code requests the MSE to send unread messages only.
This behavior is not matching the other filters.
---
obexd/client/map.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 3e4cde9..99982c0 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1179,9 +1179,9 @@ static GObexApparam *parse_filter_read(GObexApparam *apparam,
dbus_message_iter_get_basic(iter, &dbus_status);
if (dbus_status)
- status = FILTER_READ_STATUS_ONLY_UNREAD;
- else
status = FILTER_READ_STATUS_ONLY_READ;
+ else
+ status = FILTER_READ_STATUS_ONLY_UNREAD;
return g_obex_apparam_set_uint8(apparam, MAP_AP_FILTERREADSTATUS,
status);
--
1.8.1
^ permalink raw reply related
* [PATCH 6/8] obexd: Use defines for values in parse_filter_read parse_filter_priority
From: Christian Fetzer @ 2013-01-11 15:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Fetzer
In-Reply-To: <1357919757-10334-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
From: Christian Fetzer <christian.fetzer@bmw-carit.de>
---
obexd/client/map.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 57ce1e6..3e4cde9 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -77,6 +77,14 @@ static const char * const filter_list[] = {
#define FILTER_BIT_MAX 15
#define FILTER_ALL 0x0000FFFF
+#define FILTER_READ_STATUS_NONE 0
+#define FILTER_READ_STATUS_ONLY_UNREAD 1
+#define FILTER_READ_STATUS_ONLY_READ 2
+
+#define FILTER_PRIORITY_NONE 0
+#define FILTER_PRIORITY_ONLY_HIGH 1
+#define FILTER_PRIORITY_ONLY_NONHIGH 2
+
#define STATUS_READ 0
#define STATUS_DELETE 1
#define FILLER_BYTE 0x30
@@ -1162,7 +1170,7 @@ static GObexApparam *parse_period_end(GObexApparam *apparam,
static GObexApparam *parse_filter_read(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint8 status = 0;
+ guint8 status = FILTER_READ_STATUS_NONE;
dbus_bool_t dbus_status = FALSE;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
@@ -1170,7 +1178,10 @@ static GObexApparam *parse_filter_read(GObexApparam *apparam,
dbus_message_iter_get_basic(iter, &dbus_status);
- status = (dbus_status) ? 0x01 : 0x02;
+ if (dbus_status)
+ status = FILTER_READ_STATUS_ONLY_UNREAD;
+ else
+ status = FILTER_READ_STATUS_ONLY_READ;
return g_obex_apparam_set_uint8(apparam, MAP_AP_FILTERREADSTATUS,
status);
@@ -1207,7 +1218,7 @@ static GObexApparam *parse_filter_sender(GObexApparam *apparam,
static GObexApparam *parse_filter_priority(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint8 priority;
+ guint8 priority = FILTER_PRIORITY_NONE;
dbus_bool_t dbus_priority = FALSE;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
@@ -1215,7 +1226,10 @@ static GObexApparam *parse_filter_priority(GObexApparam *apparam,
dbus_message_iter_get_basic(iter, &dbus_priority);
- priority = (dbus_priority) ? 0x01 : 0x02;
+ if (dbus_priority)
+ priority = FILTER_PRIORITY_ONLY_HIGH;
+ else
+ priority = FILTER_PRIORITY_ONLY_NONHIGH;
return g_obex_apparam_set_uint8(apparam, MAP_AP_FILTERPRIORITY,
priority);
--
1.8.1
^ permalink raw reply related
* [PATCH 5/8] obexd: Fix segfault in parse_filter_read and parse_filter_priority
From: Christian Fetzer @ 2013-01-11 15:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Fetzer
In-Reply-To: <1357919757-10334-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
From: Christian Fetzer <christian.fetzer@bmw-carit.de>
Calls to ListMessages with filter 'Read' or 'Priority' caused a segfault
in parse_filter_read / parse_filter_priority. The functions read
D-Bus boolean values (uint32) into uint8.
0 0x00007ffff730332d in ?? () from /usr/lib/libdbus-1.so.3
1 0x00007ffff7304219 in dbus_message_iter_next () from /usr/lib/libdbus-1.so.3
2 0x000000000043ef0f in parse_message_filters (
apparam=<error reading variable: Cannot access memory at address 0x7ffffeffff08>,
iter=<error reading variable: Cannot access memory at address 0x7ffffeffff00>)
at obexd/client/map.c:1246
---
obexd/client/map.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index cea9369..57ce1e6 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1163,13 +1163,14 @@ static GObexApparam *parse_filter_read(GObexApparam *apparam,
DBusMessageIter *iter)
{
guint8 status = 0;
+ dbus_bool_t dbus_status = FALSE;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
return NULL;
- dbus_message_iter_get_basic(iter, &status);
+ dbus_message_iter_get_basic(iter, &dbus_status);
- status = (status) ? 0x01 : 0x02;
+ status = (dbus_status) ? 0x01 : 0x02;
return g_obex_apparam_set_uint8(apparam, MAP_AP_FILTERREADSTATUS,
status);
@@ -1207,13 +1208,14 @@ static GObexApparam *parse_filter_priority(GObexApparam *apparam,
DBusMessageIter *iter)
{
guint8 priority;
+ dbus_bool_t dbus_priority = FALSE;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
return NULL;
- dbus_message_iter_get_basic(iter, &priority);
+ dbus_message_iter_get_basic(iter, &dbus_priority);
- priority = (priority) ? 0x01 : 0x02;
+ priority = (dbus_priority) ? 0x01 : 0x02;
return g_obex_apparam_set_uint8(apparam, MAP_AP_FILTERPRIORITY,
priority);
--
1.8.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox