sdwire 0.2.3__py3-none-any.whl → 0.2.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sdwire/backend/detect.py CHANGED
@@ -1,7 +1,5 @@
1
1
  import logging
2
2
  from typing import List
3
- from adafruit_board_toolkit import circuitpython_serial as cpserial
4
- from serial.tools.list_ports_common import ListPortInfo
5
3
 
6
4
  from sdwire import constants
7
5
  from .device.sdwire import SDWire, SDWIRE_GENERATION_SDWIRE3
@@ -47,7 +45,6 @@ def get_sdwirec_devices() -> List[SDWireC]:
47
45
 
48
46
 
49
47
  def get_sdwire_devices() -> List[SDWire]:
50
-
51
48
  # Badgerd SDWire3
52
49
  # VID = 0bda PID = 0316
53
50
  # Badgerd SDWireC
@@ -62,20 +59,17 @@ def get_sdwire_devices() -> List[SDWire]:
62
59
  log.info("no usb devices found while searching for SDWire..")
63
60
  return []
64
61
 
65
- device_list = []
66
62
  for device in devices:
67
63
  product = None
68
64
  serial = None
69
- manufacturer = None
70
65
  bus = None
71
66
  address = None
72
67
  try:
73
- product = int(f"0x{device.get("ID_MODEL_ID")}", 16)
74
- vendor = int(f"0x{device.get("ID_VENDOR_ID")}", 16)
68
+ product = int(f"0x{device.get('ID_MODEL_ID')}", 16)
69
+ vendor = int(f"0x{device.get('ID_VENDOR_ID')}", 16)
75
70
  bus = int(device.get("BUSNUM"))
76
71
  address = int(device.get("DEVNUM"))
77
- serial = f"{device.get("ID_USB_SERIAL_SHORT")}:{bus}.{address}"
78
- manufacturer = ""
72
+ serial = f"{device.get('ID_USB_SERIAL_SHORT')}:{bus}.{address}"
79
73
  except Exception as e:
80
74
  log.debug(
81
75
  "not able to get usb product, serial_number and manufacturer information, err: %s",
@@ -1,5 +1,4 @@
1
1
  import logging
2
- from serial import Serial
3
2
  from .usb_device import USBDevice, PortInfo
4
3
 
5
4
  log = logging.getLogger(__name__)
@@ -13,12 +12,12 @@ class SDWire(USBDevice):
13
12
  def __init__(self, port_info: PortInfo, generation: int):
14
13
  super().__init__(port_info)
15
14
  self.generation = generation
16
- for sibling in self.dev_string.parent.children:
15
+ for child in self.dev_string.children:
17
16
  if (
18
- self.dev_string.device_path != sibling.device_path
19
- and sibling.device_type == "disk"
17
+ self.dev_string.device_path != child.device_path
18
+ and child.device_type == "disk"
20
19
  ):
21
- self.__block_dev = f"/dev/{sibling.device_path.split("/")[-1]}"
20
+ self.__block_dev = f"/dev/{child.device_path.split('/')[-1]}"
22
21
  break
23
22
 
24
23
  def switch_ts(self):
@@ -1,6 +1,5 @@
1
1
  import logging
2
2
  from pyftdi.ftdi import Ftdi
3
- from serial import Serial
4
3
  from .usb_device import USBDevice, PortInfo
5
4
 
6
5
  log = logging.getLogger(__name__)
@@ -19,7 +18,7 @@ class SDWireC(USBDevice):
19
18
  d.device_path != sibling.device_path
20
19
  and sibling.device_type == "disk"
21
20
  ):
22
- self.__block_dev = f"/dev/{sibling.device_path.split("/")[-1]}"
21
+ self.__block_dev = f"/dev/{sibling.device_path.split('/')[-1]}"
23
22
  break
24
23
  break
25
24
 
@@ -1,6 +1,5 @@
1
1
  from collections import namedtuple
2
2
  import pyudev
3
- from serial.tools.list_ports_common import ListPortInfo
4
3
 
5
4
  PortInfo = namedtuple(
6
5
  "PortInfo", ("device", "product", "manufacturer", "serial", "usb_device")
sdwire/backend/utils.py CHANGED
@@ -20,9 +20,11 @@ def handle_switch_target_command(ctx):
20
20
 
21
21
  def handle_switch_off_command(ctx):
22
22
  device = ctx.obj["device"]
23
- if isinstance(device, SDWireC):
24
- log.info("SDWireC or legacy sdwire devices dont have off functionality")
25
- print("SDWireC dont have off functionality")
23
+ if isinstance(device, SDWireC) or isinstance(device, SDWire):
24
+ log.info(
25
+ "SDWire3, SDWireC or legacy sdwire devices dont have off functionality"
26
+ )
27
+ print("SDWireC and SDWire3 dont have off functionality implemented")
26
28
  sys.exit(1)
27
29
 
28
30
 
sdwire/main.py CHANGED
@@ -3,7 +3,6 @@ import logging
3
3
  import click
4
4
  from .backend import utils
5
5
  from .backend import detect
6
- from .backend.device.sdwire import SDWire
7
6
 
8
7
 
9
8
  @click.group()
@@ -15,7 +14,7 @@ def main(debug=None):
15
14
 
16
15
  @main.command()
17
16
  def list():
18
- print(f"Serial\t\t\tProduct Info\t\tBlock Dev")
17
+ print("Serial\t\t\tProduct Info\t\tBlock Dev")
19
18
  for sdwire in detect.get_sdwire_devices():
20
19
  print(sdwire)
21
20
 
@@ -90,10 +89,5 @@ def off(ctx: click.Context):
90
89
  utils.handle_switch_off_command(ctx)
91
90
 
92
91
 
93
- # investigate further to use click in circuitpython
94
- # def invoke():
95
- # main.main("switch ts".split(), "sdwire", "_SDWIRE_COMPLETE")
96
-
97
-
98
92
  if __name__ == "__main__":
99
93
  main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sdwire
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: CLI application to interact with Badgerd SDWire devices
5
5
  License: GPL-3
6
6
  Author: Talha Can Havadar
@@ -9,12 +9,10 @@ Requires-Python: >=3.12,<4.0
9
9
  Classifier: License :: Other/Proprietary License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.12
12
- Requires-Dist: adafruit-board-toolkit (>=1.1.1,<2.0.0)
13
12
  Requires-Dist: click (>=8.1.7,<9.0.0)
14
- Requires-Dist: pyftdi (>=0.55.4,<0.56.0)
13
+ Requires-Dist: pyftdi (>=0.56.0,<0.57.0)
15
14
  Requires-Dist: pyudev (>=0.24.3,<0.25.0)
16
15
  Requires-Dist: pyusb (>=1.2.1,<2.0.0)
17
- Requires-Dist: semver (>=3.0.2,<4.0.0)
18
16
  Description-Content-Type: text/markdown
19
17
 
20
18
  # CLI for Badgerd SDWire Devices
@@ -0,0 +1,14 @@
1
+ sdwire/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ sdwire/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ sdwire/backend/detect.py,sha256=jiQ2JS9sMGUuymwyUO4FaGzIkXK3J7Ci45V1X8c94b4,2931
4
+ sdwire/backend/device/sdwire.py,sha256=nhjBjmxjjaM_rGYyXXdjr_85lEGny7c7-BC3KVcWoz4,1503
5
+ sdwire/backend/device/sdwirec.py,sha256=imkj2ObrgowiM7DP9TnVbCES-8bju0T69Qzdw5OURgE,1657
6
+ sdwire/backend/device/usb_device.py,sha256=5sdyOyPikIpFydKywzDkvvgLHFdMcsBC8tKosHRhfvQ,808
7
+ sdwire/backend/utils.py,sha256=kMEyBbRO91REgvgICuBONGiImO6jTr6EpqkZaxQH4aU,1507
8
+ sdwire/constants.py,sha256=s5mCx5NlJUM3aBbCPq2y3oOFoPPJ5wA3BR1snyK-cMg,119
9
+ sdwire/main.py,sha256=G1WaVd4kBR3bTfbmHekjx1yObiz4f1NLGqznFepd2NY,2132
10
+ sdwire-0.2.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
11
+ sdwire-0.2.5.dist-info/METADATA,sha256=OfCzihIvL2GUz8NhN-brLXW2EjUBZrp5Ov8HeUOXX4Q,3104
12
+ sdwire-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
+ sdwire-0.2.5.dist-info/entry_points.txt,sha256=pxy0zJKVcNWXPk5PtNjTLExOBpqFNth37wtdYdYRXCE,43
14
+ sdwire-0.2.5.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- sdwire/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- sdwire/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- sdwire/backend/detect.py,sha256=5lvoMjgBSAp9egNP7HwsdVAAEoA92_tw7YqcYtNKiSo,3135
4
- sdwire/backend/device/sdwire.py,sha256=LevVtz-RkvuJLAxSVok9ftpfIw-HrFSckltg6ur6TIU,1544
5
- sdwire/backend/device/sdwirec.py,sha256=62g8ujRXRj7PEJZPNXAUWiVUOqDcyQ8bwSWvQN2YDDw,1683
6
- sdwire/backend/device/usb_device.py,sha256=udfCkHZxnLX4m3FwsVuN04e1S4bA3BWBs7t7Kct_k5I,864
7
- sdwire/backend/utils.py,sha256=D_eO9LiMCWM9UPPumXfmqY30UxsHn-PvpURKJYFdmEY,1422
8
- sdwire/constants.py,sha256=s5mCx5NlJUM3aBbCPq2y3oOFoPPJ5wA3BR1snyK-cMg,119
9
- sdwire/main.py,sha256=HVXRAVj2VKkzIeH0ghW9z3VytdaiaB3dQlXFcIFc3xU,2312
10
- sdwire-0.2.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
11
- sdwire-0.2.3.dist-info/METADATA,sha256=czV1BkIDgIjRCp4VcbTvAzRbSfh0FHG7sLcFZ2Y7FWE,3198
12
- sdwire-0.2.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
- sdwire-0.2.3.dist-info/entry_points.txt,sha256=pxy0zJKVcNWXPk5PtNjTLExOBpqFNth37wtdYdYRXCE,43
14
- sdwire-0.2.3.dist-info/RECORD,,
File without changes