Skip to content

Commit 4b9c271

Browse files
authored
Merge pull request #56 from intercreate/fix/mtu-defaults
fix: use smpclient upstream mtu defaults
2 parents b1f8d25 + b6703a5 commit 4b9c271

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

smpmgr/common.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TransportDefinition:
3434
class Options:
3535
timeout: float
3636
transport: TransportDefinition
37-
mtu: int
37+
mtu: int | None
3838

3939

4040
def get_custom_smpclient(options: Options, smp_client_cls: Type[TSMPClient]) -> TSMPClient:
@@ -59,13 +59,8 @@ def get_custom_smpclient(options: Options, smp_client_cls: Type[TSMPClient]) ->
5959
options.transport.ble,
6060
)
6161
elif options.transport.ip is not None:
62-
logger.info(
63-
f"Initializing SMPClient with the SMPUDPTransport, {options.transport.ip=} and MTU 1024"
64-
)
65-
return smp_client_cls(
66-
SMPUDPTransport(1024),
67-
options.transport.ip,
68-
)
62+
logger.info(f"Initializing SMPClient with the SMPUDPTransport, {options.transport.ip=}")
63+
return smp_client_cls(SMPUDPTransport(), options.transport.ip)
6964
else:
7065
typer.echo(
7166
f"A transport option is required; "

smpmgr/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ def options(
8080
2.0,
8181
help="Transport timeout in seconds; how long to wait for initial connection and requests.",
8282
),
83-
mtu: int = typer.Option(
84-
4096,
83+
mtu: int
84+
| None = typer.Option(
85+
None,
8586
help=(
8687
"Maximum transmission unit supported by the SMP server serial transport."
87-
" Ignored for BLE transport since the BLE connection will report MTU."
88+
" Will default to smpclient upstream value."
89+
" Ignored for BLE transport since the BLE connection will report MTU."
8890
),
8991
),
9092
loglevel: LogLevel = typer.Option(None, help="Debug log level"),

0 commit comments

Comments
 (0)