All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] obexd: Emit file information for client
@ 2018-01-12  6:23 ERAMOTO Masaya
  2018-01-12  6:25 ` [PATCH BlueZ 2/2] tools/obexctl: Fix display of size/bandwidth on completion ERAMOTO Masaya
  2018-01-12 17:37 ` [PATCH BlueZ 1/2] obexd: Emit file information for client Luiz Augusto von Dentz
  0 siblings, 2 replies; 4+ messages in thread
From: ERAMOTO Masaya @ 2018-01-12  6:23 UTC (permalink / raw)
  To: linux-bluetooth

When running obexctl and then starting to transfer a file, obexctl does
not retrieve the "Size" property. Thus it outputs the huge remaining time
as below:

  [NEW] Transfer /org/bluez/obex/server/session1/transfer0
  [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Status: active
  [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 32683 (@32KB/s 4286681714:4294967273)
  [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 65444 (@32KB/s 428259:59)

This change makes obexd emit the file information including the "Size"
property, since obexctl may output the huge remaining time first if
obexctl calls g_dbus_proxy_refresh_property(). As the result, obexctl can
retrieve the "Size" property and the info command of obexctl can output
the filename of the transferring file.
---
 obexd/src/manager.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 78b138c85..6c83479f4 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -533,10 +533,15 @@ void manager_cleanup(void)
 
 void manager_emit_transfer_started(struct obex_transfer *transfer)
 {
+	const GDBusPropertyTable *property;
+
 	transfer->status = TRANSFER_STATUS_ACTIVE;
 
-	g_dbus_emit_property_changed(connection, transfer->path,
-					TRANSFER_INTERFACE, "Status");
+	for (property = transfer_properties;
+				property && property->name; property++)
+		g_dbus_emit_property_changed(connection, transfer->path,
+						TRANSFER_INTERFACE,
+						property->name);
 }
 
 static void emit_transfer_completed(struct obex_transfer *transfer,
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] tools/obexctl: Fix display of size/bandwidth on completion
  2018-01-12  6:23 [PATCH BlueZ 1/2] obexd: Emit file information for client ERAMOTO Masaya
@ 2018-01-12  6:25 ` ERAMOTO Masaya
  2018-01-12 17:37 ` [PATCH BlueZ 1/2] obexd: Emit file information for client Luiz Augusto von Dentz
  1 sibling, 0 replies; 4+ messages in thread
From: ERAMOTO Masaya @ 2018-01-12  6:25 UTC (permalink / raw)
  To: linux-bluetooth

Outputs the wrong size and bandwidth on completion of transfer as below:

  [CHG] Transfer /org/bluez/obex/server/session3/transfer2 Transferred: 5339965 (@32KB/s 00:01)
  [CHG] Transfer /org/bluez/obex/server/session3/transfer2 Transferred: 5372726 (@32KB/s 00:00)
  [CHG] Transfer /org/bluez/obex/server/session3/transfer2 Transferred: 0 (@18446744073704178KB/s 00:00)
  [CHG] Transfer /org/bluez/obex/server/session3/transfer2 Status: complete
---
 tools/obexctl.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/obexctl.c b/tools/obexctl.c
index 05bbd3e84..ca139f050 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -1862,6 +1862,14 @@ static void print_transferred(struct transfer_data *data, const char *str,
 	int seconds, minutes;
 
 	dbus_message_iter_get_basic(iter, &valu64);
+
+	/*
+	 * Use the file size to output the proper size/speed since obexd emits
+	 * zero as the current transferred size on completion of transfer.
+	 */
+	if (valu64 == 0)
+		valu64 = data->size;
+
 	speed = valu64 - data->transferred;
 	data->transferred = valu64;
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 1/2] obexd: Emit file information for client
  2018-01-12  6:23 [PATCH BlueZ 1/2] obexd: Emit file information for client ERAMOTO Masaya
  2018-01-12  6:25 ` [PATCH BlueZ 2/2] tools/obexctl: Fix display of size/bandwidth on completion ERAMOTO Masaya
@ 2018-01-12 17:37 ` Luiz Augusto von Dentz
  2018-01-15  6:50   ` ERAMOTO Masaya
  1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2018-01-12 17:37 UTC (permalink / raw)
  To: ERAMOTO Masaya; +Cc: linux-bluetooth

Hi Eramoto,

On Fri, Jan 12, 2018 at 4:23 AM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> When running obexctl and then starting to transfer a file, obexctl does
> not retrieve the "Size" property. Thus it outputs the huge remaining time
> as below:
>
>   [NEW] Transfer /org/bluez/obex/server/session1/transfer0
>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Status: active
>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 32683 (@32KB/s 4286681714:4294967273)
>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 65444 (@32KB/s 428259:59)
>
> This change makes obexd emit the file information including the "Size"
> property, since obexctl may output the huge remaining time first if
> obexctl calls g_dbus_proxy_refresh_property(). As the result, obexctl can
> retrieve the "Size" property and the info command of obexctl can output
> the filename of the transferring file.
> ---
>  obexd/src/manager.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/obexd/src/manager.c b/obexd/src/manager.c
> index 78b138c85..6c83479f4 100644
> --- a/obexd/src/manager.c
> +++ b/obexd/src/manager.c
> @@ -533,10 +533,15 @@ void manager_cleanup(void)
>
>  void manager_emit_transfer_started(struct obex_transfer *transfer)
>  {
> +       const GDBusPropertyTable *property;
> +
>         transfer->status = TRANSFER_STATUS_ACTIVE;
>
> -       g_dbus_emit_property_changed(connection, transfer->path,
> -                                       TRANSFER_INTERFACE, "Status");
> +       for (property = transfer_properties;
> +                               property && property->name; property++)
> +               g_dbus_emit_property_changed(connection, transfer->path,
> +                                               TRANSFER_INTERFACE,
> +                                               property->name);
>  }

Im not following why we need to emit every single property? Isn't that
enough to send the Size only?

Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 1/2] obexd: Emit file information for client
  2018-01-12 17:37 ` [PATCH BlueZ 1/2] obexd: Emit file information for client Luiz Augusto von Dentz
@ 2018-01-15  6:50   ` ERAMOTO Masaya
  0 siblings, 0 replies; 4+ messages in thread
From: ERAMOTO Masaya @ 2018-01-15  6:50 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On 01/13/2018 02:37 AM, Luiz Augusto von Dentz wrote:
> Hi Eramoto,
> 
> On Fri, Jan 12, 2018 at 4:23 AM, ERAMOTO Masaya
> <eramoto.masaya@jp.fujitsu.com> wrote:
>> When running obexctl and then starting to transfer a file, obexctl does
>> not retrieve the "Size" property. Thus it outputs the huge remaining time
>> as below:
>>
>>   [NEW] Transfer /org/bluez/obex/server/session1/transfer0
>>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Status: active
>>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 32683 (@32KB/s 4286681714:4294967273)
>>   [CHG] Transfer /org/bluez/obex/server/session1/transfer0 Transferred: 65444 (@32KB/s 428259:59)
>>
>> This change makes obexd emit the file information including the "Size"
>> property, since obexctl may output the huge remaining time first if
>> obexctl calls g_dbus_proxy_refresh_property(). As the result, obexctl can
>> retrieve the "Size" property and the info command of obexctl can output
>> the filename of the transferring file.
>> ---
>>  obexd/src/manager.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/obexd/src/manager.c b/obexd/src/manager.c
>> index 78b138c85..6c83479f4 100644
>> --- a/obexd/src/manager.c
>> +++ b/obexd/src/manager.c
>> @@ -533,10 +533,15 @@ void manager_cleanup(void)
>>
>>  void manager_emit_transfer_started(struct obex_transfer *transfer)
>>  {
>> +       const GDBusPropertyTable *property;
>> +
>>         transfer->status = TRANSFER_STATUS_ACTIVE;
>>
>> -       g_dbus_emit_property_changed(connection, transfer->path,
>> -                                       TRANSFER_INTERFACE, "Status");
>> +       for (property = transfer_properties;
>> +                               property && property->name; property++)
>> +               g_dbus_emit_property_changed(connection, transfer->path,
>> +                                               TRANSFER_INTERFACE,
>> +                                               property->name);
>>  }
> 
> Im not following why we need to emit every single property? Isn't that
> enough to send the Size only?

I want to make obexctl print out as much as possible of file information.

For example,
  - If obexd sends the Size property only, the info command of obexctl
    prints out the Session/Status/Size/Transferred properties and does
    not print out the Name property etc..
  - If obexctl retrieves the Name property at cmd_info(), the info
    command does not first print out it as below:

    # info /org/bluez/obex/server/session2/transfer1
    Transfer /org/bluez/obex/server/session2/transfer1
            Session: /org/bluez/obex/server/session2
            Status: active
            Size: 395755855
            Transferred: 949991
    [CHG] Transfer /org/bluez/obex/server/session2/transfer1 Transferred: 982752 (@32KB/s 200:50)
    [CHG] Transfer /org/bluez/obex/server/session2/transfer1 Name: bluez.tar.gz

I will modify this commit message and resend this patch set.


Regards,
Eramoto


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-15  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12  6:23 [PATCH BlueZ 1/2] obexd: Emit file information for client ERAMOTO Masaya
2018-01-12  6:25 ` [PATCH BlueZ 2/2] tools/obexctl: Fix display of size/bandwidth on completion ERAMOTO Masaya
2018-01-12 17:37 ` [PATCH BlueZ 1/2] obexd: Emit file information for client Luiz Augusto von Dentz
2018-01-15  6:50   ` ERAMOTO Masaya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.