pypicoboot 1.1__tar.gz → 1.1.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypicoboot
3
- Version: 1.1
3
+ Version: 1.1.2
4
4
  Summary: Pico Boot for Python
5
5
  Home-page: https://github.com/polhenarejos/pypicoboot
6
6
  Author: Pol Henarejos
@@ -17,4 +17,4 @@
17
17
  */
18
18
  """
19
19
 
20
- __version__ = "1.1"
20
+ __version__ = "1.1.2"
@@ -158,22 +158,23 @@ class PicoBoot:
158
158
  if disconnected:
159
159
  self.__device.close()
160
160
 
161
- self.__observer = PicoBootObserver(self.dev)
161
+ self.__observer = PicoBootObserver(self)
162
162
  self.__monitor = PicoBootMonitor(device=self.dev, cls_callback=self.__observer)
163
163
 
164
164
  @classmethod
165
165
  def open(cls, vid: int = DEFAULT_VID, pid: list[int] = [DEFAULT_PID_RP2040, DEFAULT_PID_RP2350], serial: Optional[str] = None) -> "PicoBoot":
166
- class find_pids(object):
166
+ class find_vidpids(object):
167
167
 
168
- def __init__(self, pids: list[int]):
168
+ def __init__(self, vid: int, pids: list[int]):
169
+ self._vid = vid
169
170
  self._pids = pids
170
171
 
171
172
  def __call__(self, device: usb.core.Device) -> bool:
172
- if device.idProduct in self._pids:
173
+ if device.idProduct in self._pids and device.idVendor == self._vid:
173
174
  return True
174
175
  return False
175
176
 
176
- devices = usb.core.find(find_all=True, custom_match=find_pids(pid))
177
+ devices = usb.core.find(find_all=True, custom_match=find_vidpids(vid, pid))
177
178
  devices = list(devices) if devices is not None else []
178
179
  if not devices:
179
180
  raise PicoBootError("No device found in PICOBOOT mode")
@@ -196,8 +197,8 @@ class PicoBoot:
196
197
  # Ensure active configuration
197
198
  # macOS does not allow detach_kernel_driver, and often returns Access Denied
198
199
  try:
199
- if dev.is_kernel_driver_active(0):
200
- dev.detach_kernel_driver(0)
200
+ if dev.is_kernel_driver_active(1):
201
+ dev.detach_kernel_driver(1)
201
202
  except usb.core.USBError:
202
203
  # If it fails, we continue anyway. It's normal on macOS.
203
204
  pass
@@ -205,7 +206,7 @@ class PicoBoot:
205
206
  # Also fine on backends that don't implement the function
206
207
  pass
207
208
 
208
- dev.set_configuration()
209
+ #dev.set_configuration()
209
210
  cfg = dev.get_active_configuration()
210
211
 
211
212
  intf = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypicoboot
3
- Version: 1.1
3
+ Version: 1.1.2
4
4
  Summary: Pico Boot for Python
5
5
  Home-page: https://github.com/polhenarejos/pypicoboot
6
6
  Author: Pol Henarejos
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes