Skip to content

fix(libgpod): write iPod nano 7G libraries on firmware 1.0.1 (command set 9) - #1

Open
neilbags wants to merge 1 commit into
Pred8or:pr/8-tags-adaptersfrom
neilbags:fix/nano7-fw-1.0.1-command-set-9
Open

neilbags wants to merge 1 commit into
Pred8or:pr/8-tags-adaptersfrom
neilbags:fix/nano7-fw-1.0.1-command-set-9

Conversation

@neilbags

@neilbags neilbags commented Nov 4, 2026

Copy link
Copy Markdown

Warning

Vibecoded slop. Unreviewed.

Target: Pred8or/podkit:pr/8-tags-adapters, the top of the stack in jvgomg#76–jvgomg#83. The change touches tools/prebuild/libgpod-nano.patch, which doesn't exist on jvgomg/podkit:main yet. It logically belongs with jvgomg#78 (command set selection) and jvgomg#79 (keep_device_choices), so cherry-pick or squash it wherever it fits best.

Problem

On an iPod nano 7G running firmware 1.0.1 (build 37A10002), every database write fails:

[run_post_process_commands]: Error fetching user version command set
Failed to recreate iPod database: ... SQLite post-process commands: no command set 25

The SysInfoExtended read live over USB lists only UserVersionCommandSets 9. The patch accepts only 25, which firmware 1.0.4 provides.

podkit device reset deletes the audio files before it writes, so this failure leaves the device with no iTunesDB.

Set 9 compared with set 25

set 9 (fw 1.0.1) set 25 (fw 1.0.4 capture)
commands 117 127
shared commands 116, same order, same SQL
only in this set UpdateDeviceUpdateLevelTo1107 CreateIsHomeVideo, FakePragmaITunes26, 8× ItemStats{Audio,Subtitle}{Language,TrackID}, UpdateDeviceUpdateLevelTo1109

Change

  • run_post_process_commands: on nano 6G/7G, use set 9 when the device lists no set 25. Set 25 is still preferred, and every other set (for example only 26) is still rejected.
  • keep_device_choices: copy the track choice columns only when the new Dynamic.itdb has them (new helper, has_track_choices). Set 9 doesn't create them, so the UPDATE failed whenever the device already had a Dynamic.itdb.
  • New test test_nano_firmware_1_0_1_command_set_9. It builds set 9 from the set 25 capture, then checks create and resave, the 1107 update level, and that the track choice columns are absent.
  • Updated the tools/nano7/README.md paragraph about command sets, and added a changeset.

Testing

  • tools/nano7/test-libgpod.sh, run in an Alpine 3.21 builder against the statically built patched libgpod: 19 tests pass, 1 skipped (no time zone data in the builder). The new test fails against the unfixed patch.
  • Real device, a nano 7G 16GB on fw 1.0.1, using the musl binaries in the upstream packages/podkit-docker/Dockerfile:
    • device init worked, then sync of a test MP3 and a 14-track MP3 album with artwork.
    • Each write printed 117 out of 117 post process commands successfully executed.
    • podkit device music lists all 14 tracks with the right metadata.
    • Not verified: whether the firmware shows and plays the library.
  • Known difference from fw 1.0.4: Library.itdb's user_version stays 0, because set 9 has no FakePragmaITunes26. I don't know whether firmware 1.0.1 checks it.

… set 9)

⚠️ Vibecoded slop. Not reviewed by a human!

Firmware 1.0.1 (build 37A10002) lists only SQLite post-process command
set 9 in SysInfoExtended. The nano patch accepted only set 25, so every
write failed with "SQLite post-process commands: no command set 25".
`podkit device reset` deleted the audio files before that failure, which
left the device without an iTunesDB.

Set 9 is set 25 minus 11 later commands: CreateIsHomeVideo,
FakePragmaITunes26, the eight item_stats audio/subtitle language and
track ID commands, and UpdateDeviceUpdateLevelTo1109 (set 9 runs
UpdateDeviceUpdateLevelTo1107 instead). The 116 shared commands are in
the same order with the same SQL.

- Use set 9 when the device lists no set 25. Set 25 is still preferred,
  and other sets (for example only 26) are still rejected.
- keep_device_choices() only copies the track choice columns when the
  new Dynamic.itdb has them. Set 9 does not create them, so the UPDATE
  failed whenever the device already had a Dynamic.itdb.

Tested on a nano 7G 16GB running firmware 1.0.1, through the Docker
image: a library was initialised, then a test MP3 and a 14-track MP3
album with artwork were synced and listed back by `podkit device music`.
All 117 set-9 commands ran. Playback on the device has not been checked.
Library.itdb's user_version stays 0 because set 9 has no
FakePragmaITunes26.
tools/nano7/test-libgpod.sh passes (19 tests, 1 skipped because the
Alpine builder has no time zone data). The new set-9 test fails against
the unfixed patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant