We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 796b525 commit 9eeba4fCopy full SHA for 9eeba4f
can/util.py
@@ -211,7 +211,16 @@ def _create_bus_config(config: Dict[str, Any]) -> typechecking.BusConfig:
211
raise CanInterfaceNotImplementedError(
212
f'Unknown interface type "{config["interface"]}"'
213
)
214
-
+ if "port" in config:
215
+ if isinstance(config["port"], str):
216
+ if config["port"].isnumeric():
217
+ config["port"] = int(config["port"])
218
+ if not 0 < config["port"] < 65535:
219
+ raise ValueError("Port config must be inside 0-65535 range!")
220
+ else:
221
+ raise ValueError("Port config must be a number!")
222
+ elif not isinstance(config["port"], int):
223
+ raise TypeError("Port config must be string or integer!")
224
if "bitrate" in config:
225
config["bitrate"] = int(config["bitrate"])
226
if "fd" in config:
0 commit comments