* [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode'
@ 2024-12-12 7:19 Ahmad Fatoum
2024-12-12 7:19 ` [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line Ahmad Fatoum
2024-12-12 8:20 ` [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-12 7:19 UTC (permalink / raw)
To: barebox; +Cc: Sohaib Mohamed, Ahmad Fatoum
The RatpFSServer constructor supports passing None to it, but the
command line interface panics before the function can be invoked.
As the function already supports NoneType and bytes input, just teach it
to accept str input as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/remote/main.py | 4 ++--
scripts/remote/ratpfs.py | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/remote/main.py b/scripts/remote/main.py
index 5aa176fdc426..020a78c3fcb0 100644
--- a/scripts/remote/main.py
+++ b/scripts/remote/main.py
@@ -48,7 +48,7 @@ def get_controller(args):
def handle_run(args):
ctrl = get_controller(args)
- ctrl.export(args.export.encode())
+ ctrl.export(args.export)
res = ctrl.command(' '.join(args.arg))
if res:
res = 1
@@ -160,7 +160,7 @@ def handle_listen(args):
def handle_console(args):
queue = Queue()
ctrl = get_controller(args)
- ctrl.export(args.export.encode())
+ ctrl.export(args.export)
ctrl.start(queue)
ctrl.send_async_console(b'\r')
cons = ConsoleInput(queue, exit=b'\x14') # CTRL-T
diff --git a/scripts/remote/ratpfs.py b/scripts/remote/ratpfs.py
index 3e05cf241868..3aa3eb45ac78 100644
--- a/scripts/remote/ratpfs.py
+++ b/scripts/remote/ratpfs.py
@@ -60,6 +60,8 @@ class RatpFSPacket(object):
class RatpFSServer(object):
def __init__(self, path=None):
if path:
+ if isinstance(path, str):
+ path = path.encode()
assert isinstance(path, bytes)
self.path = os.path.abspath(os.path.expanduser(path))
else:
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line
2024-12-12 7:19 [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Ahmad Fatoum
@ 2024-12-12 7:19 ` Ahmad Fatoum
2024-12-12 8:20 ` [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-12 7:19 UTC (permalink / raw)
To: barebox; +Cc: Sohaib Mohamed, Ahmad Fatoum
That way the output of
scripts/bbremote --port /dev/ttyUSB10 md /dev/zero 0 4
is 00000000 instead of b'00000000'.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/remote/main.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/remote/main.py b/scripts/remote/main.py
index 020a78c3fcb0..4bc855616ae3 100644
--- a/scripts/remote/main.py
+++ b/scripts/remote/main.py
@@ -71,7 +71,7 @@ def handle_getenv(args):
if not value:
res = 1
else:
- print(value)
+ print(value.decode())
res = 0
ctrl.close()
return res
@@ -81,7 +81,7 @@ def handle_md(args):
ctrl = get_controller(args)
(res,data) = ctrl.md(args.path, args.address, args.size)
if res == 0:
- print(binascii.hexlify(data))
+ print(binascii.hexlify(data).decode())
ctrl.close()
return res
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode'
2024-12-12 7:19 [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Ahmad Fatoum
2024-12-12 7:19 ` [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line Ahmad Fatoum
@ 2024-12-12 8:20 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-12-12 8:20 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Sohaib Mohamed
On Thu, 12 Dec 2024 08:19:27 +0100, Ahmad Fatoum wrote:
> The RatpFSServer constructor supports passing None to it, but the
> command line interface panics before the function can be invoked.
>
> As the function already supports NoneType and bytes input, just teach it
> to accept str input as well.
>
>
> [...]
Applied, thanks!
[1/2] bbremote: fix 'NoneType' object has no attribute 'encode'
https://git.pengutronix.de/cgit/barebox/commit/?id=29e5a10ef943 (link may not be stable)
[2/2] bbremote: decode bytes output of getenv and md on command line
https://git.pengutronix.de/cgit/barebox/commit/?id=c6c9b96ff460 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-12 8:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12 7:19 [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Ahmad Fatoum
2024-12-12 7:19 ` [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line Ahmad Fatoum
2024-12-12 8:20 ` [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox