flashpod 0.2.3__tar.gz → 0.2.4__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.
Files changed (26) hide show
  1. {flashpod-0.2.3 → flashpod-0.2.4}/PKG-INFO +1 -1
  2. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/ipod_flash.py +15 -4
  3. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/platform/macos.py +6 -2
  4. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/platform/windows.py +13 -2
  5. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/PKG-INFO +1 -1
  6. {flashpod-0.2.3 → flashpod-0.2.4}/pyproject.toml +1 -1
  7. {flashpod-0.2.3 → flashpod-0.2.4}/LICENSE +0 -0
  8. {flashpod-0.2.3 → flashpod-0.2.4}/README.md +0 -0
  9. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/__init__.py +0 -0
  10. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/__main__.py +0 -0
  11. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/cli.py +0 -0
  12. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/contrib/99-flashpod-firewire-ipod.rules +0 -0
  13. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/fat32.py +0 -0
  14. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/fatfs.py +0 -0
  15. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/firmware/firmware.json +0 -0
  16. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/itunesdb.py +0 -0
  17. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/platform/__init__.py +0 -0
  18. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/platform/base.py +0 -0
  19. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/platform/linux.py +0 -0
  20. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod/resources.py +0 -0
  21. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/SOURCES.txt +0 -0
  22. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/dependency_links.txt +0 -0
  23. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/entry_points.txt +0 -0
  24. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/requires.txt +0 -0
  25. {flashpod-0.2.3 → flashpod-0.2.4}/flashpod.egg-info/top_level.txt +0 -0
  26. {flashpod-0.2.3 → flashpod-0.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashpod
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Command-line iPod sync + card-flashing tooling for early FireWire-era iPods, pure Python
5
5
  Author: David Barnhart
6
6
  License-Expression: MIT
@@ -402,7 +402,10 @@ def pick_device(scan, render, path_of, empty_msg):
402
402
 
403
403
  ``scan()`` returns the candidate list (called again on each refresh),
404
404
  ``render(items)`` prints the table, ``path_of(item)`` yields the device path
405
- to return.
405
+ to return — or ``None`` for an entry that exists but can't be written, such
406
+ as the empty slot of a multi-slot card reader. Rejecting it here is much
407
+ kinder than letting it through: with no media, every downstream call fails
408
+ obscurely ("could not determine size", access denied) and reads as a bug.
406
409
 
407
410
  The loop accepts 'r' to re-scan. Without it, a reader plugged in — or a card
408
411
  inserted — after the list was drawn stays invisible until you quit and start
@@ -430,7 +433,13 @@ def pick_device(scan, render, path_of, empty_msg):
430
433
  render(items)
431
434
  continue
432
435
  if sel.isdigit() and int(sel) < len(items):
433
- return path_of(items[int(sel)])
436
+ path = path_of(items[int(sel)])
437
+ if path:
438
+ return path
439
+ print(color(" that slot is empty — insert a card and press 'r' "
440
+ "to rescan, or pick another device", C_YEL),
441
+ file=sys.stderr)
442
+ continue
434
443
  print(color(" invalid selection", C_RED), file=sys.stderr)
435
444
 
436
445
 
@@ -481,7 +490,7 @@ def _render_candidates(cands):
481
490
  def choose_device():
482
491
  return pick_device(
483
492
  list_candidates, _render_candidates,
484
- lambda d: "/dev/" + d["name"],
493
+ lambda d: ("/dev/" + d["name"]) if int(d.get("size") or 0) else None,
485
494
  "No removable/USB disks found. Plug in the card and retry.")
486
495
 
487
496
  def device_label(dev):
@@ -795,7 +804,9 @@ def flash(device=None, firmware=None,
795
804
 
796
805
  total_sectors = plat.device_sectors(dev)
797
806
  if total_sectors <= 0:
798
- sys.exit(color("could not determine size of %s" % dev, C_RED))
807
+ sys.exit(color("could not determine size of %s is a card inserted? "
808
+ "An empty slot in a multi-slot reader still appears as "
809
+ "a disk, but reports size 0." % dev, C_RED))
799
810
  confirm(dev, total_sectors, assume_yes or dry_run, lba48, max_data_sectors)
800
811
  plat.unmount_all(dev, dry_run)
801
812
  write_layout(dev, fw, total_sectors, dry_run, do_format, lba48, max_data_sectors)
@@ -85,9 +85,13 @@ class MacOSPlatform(Platform):
85
85
  (i, d, ipod_flash.fmt_size(size), name), file=sys.stderr)
86
86
  print(file=sys.stderr)
87
87
 
88
+ def to_path(item):
89
+ d, info = item
90
+ size = int(info.get("TotalSize") or info.get("Size") or 0)
91
+ return ("/dev/" + d) if size else None # 0 = empty reader slot
92
+
88
93
  return ipod_flash.pick_device(
89
- self._external_disks, render,
90
- lambda item: "/dev/" + item[0],
94
+ self._external_disks, render, to_path,
91
95
  "No external disks found. Plug in the card reader and retry.")
92
96
 
93
97
  def device_sectors(self, dev):
@@ -163,11 +163,22 @@ class WindowsPlatform(Platform):
163
163
  print(" [%d] \\\\.\\PhysicalDrive%-3d %10s %s (%s)" %
164
164
  (i, num, ipod_flash.fmt_size(size), name.strip(), bus),
165
165
  file=sys.stderr)
166
+ if not size:
167
+ # A multi-slot reader shows one disk per slot; an empty one
168
+ # reports size 0 / "No Media". Say so, or it reads as a
169
+ # normal target and every later failure ("could not
170
+ # determine size", access denied) looks like a flashpod bug.
171
+ print(color(" no card inserted — empty reader slot",
172
+ ipod_flash.C_YEL), file=sys.stderr)
166
173
  print(file=sys.stderr)
167
174
 
175
+ def to_path(d):
176
+ if not d[1]:
177
+ return None # empty slot: rejected by pick_device
178
+ return "\\\\.\\PhysicalDrive%d" % d[0]
179
+
168
180
  return ipod_flash.pick_device(
169
- self._removable_disks, render,
170
- lambda d: "\\\\.\\PhysicalDrive%d" % d[0],
181
+ self._removable_disks, render, to_path,
171
182
  "No removable disks found. Plug in the card and retry.")
172
183
 
173
184
  def device_sectors(self, dev):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashpod
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Command-line iPod sync + card-flashing tooling for early FireWire-era iPods, pure Python
5
5
  Author: David Barnhart
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flashpod"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Command-line iPod sync + card-flashing tooling for early FireWire-era iPods, pure Python"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes