2022-12-14 00:22:21

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 3/3] client/player: Use bt_shell_echo to print transfer progress

From: Luiz Augusto von Dentz <[email protected]>

This uses bt_shell_echo to print transfer progress.
---
client/player.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/client/player.c b/client/player.c
index 2c15fb0c2d01..259e0eb0933c 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3045,11 +3045,11 @@ static bool transport_recv(struct io *io, void *user_data)
return true;
}

- bt_shell_printf("[seq %d] recv: %u bytes\n", transport->seq, ret);
+ bt_shell_echo("[seq %d] recv: %u bytes", transport->seq, ret);

transport->seq++;

- if (transport->fd) {
+ if (transport->fd >= 0) {
len = write(transport->fd, buf, ret);
if (len < 0)
bt_shell_printf("Unable to write: %s (%d)",
@@ -3423,7 +3423,6 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)

for (i = 0; i < num; i++, transport->seq++) {
ssize_t ret;
- int queued;
int secs = 0, nsecs = 0;

ret = read(fd, buf, transport->mtu[1]);
@@ -3445,13 +3444,10 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)

elapsed_time(!transport->seq, &secs, &nsecs);

- ioctl(transport->sk, TIOCOUTQ, &queued);
-
- bt_shell_printf("[seq %d %d.%03ds] send: %zd bytes "
- "(TIOCOUTQ %d bytes)\n",
+ bt_shell_echo("[seq %d %d.%03ds] send: %zd bytes ",
transport->seq, secs,
(nsecs + 500000) / 1000000,
- ret, queued);
+ ret);
}

free(buf);
--
2.37.3