305. The settings store written over USB: the Harmony 600's saved KPN delay cleared, and on the 0.2 build a successful write answers 1¶
todo.md L9 after section 304: an editor that changes a delay on an arch 14 remote has to be able to
replace or remove one the remote saved, since a saved value wins at every start, section 303. Danny asked
for the KPN box's saved power on delay on the Harmony 600 to be cleared, so that the configuration's own
value applies again. That needs the 0x14 0xB3 write, which section 304 found and did not send.
The write, read before it was sent¶
On the Harmony 600's 0.2 image. The 650's is byte identical over everything below: the gate and parsers
0xBC4E to 0xBE96 and 0xC0CE to 0xC1A0, the execution path 0xC65C to 0xC700 and 0xCCD4 to
0xCDA0, the reply builder 0xD172 to 0xD220, the store routines 0xD276 to 0xDE70, and the
helpers they call at 0x10CB0, 0x1598A, 0x19906, 0x19960 and 0x19C06 to 0x19D12, which is a
wider range than section 304 compared:
- The parser at
0xC13Ctakes the setting, high byte first, and a value; the executor at0xCD04calls0xDD16, which calls the append at0xDB60, and the executor then stores the return code at0xD67,0xCD1E, and clears the flag0xD4Bonly when the code is nonzero,0xCD24. So a success answers0xF0 0x11 0xB3 0x01 0x01 0x01 0x00and a failure the same frame with 4 in the fourth byte and the code in the seventh. Section 304 had the success as 4; that is corrected there in place. 0xDB60refuses a setting of0xFFor more, code 5, and a store with no active block, 6. It looks the setting up,0xDA04, and returns 0 without writing when it already holds the value. Otherwise0xD368finds the first record from offset 4 whose setting byte is0xFF, code 4 when there is none, and the two bytes are programmed there as one word,EECON10x24and the0x55 0xAAunlock at0xD276, then read back, code 7 on a mismatch.- Three paths erase, and none shows in the reply. A write that ends at offset
0x400, the block's last record, starts the copy at0xDCF8after it succeeded:0xD442copies the latest value of every setting into the other block and erases the old one,0xD330from0xD7DC, a 1 KiB erase, and the write still answers 0. Code 4 makes0xDD16run the same copy and try again; if that is still 4 it erases both blocks,0xDD5Eto0xDDAC, formats block 0 with0xD804and tries once more, which loses every saved setting. So a host sees 4 only when all of that failed. The old block is two blocks below the identity block. The rail below keeps every write away from all three. - A slot is free to the save when its key's high byte reads
0xFF,0xE0D0to0xE0EA: the lookup answers0x00FFfor it, which is also its answer for an absent setting. The purge's own test at0xDE94compares a lookup against0xFFFFand cannot fire, since a lookup's high byte is always 0. So the first of the four writes below already frees the slot for the save. That the restore's keyed lookup then misses it rests on the key no longer matching, which holds for every key a configuration here uses, none of them having a high byte of0xFF.
No request names an address. A 0xB3 carries a setting and a value; where the record lands is the
firmware's choice, so the only thing a host can do wrong in placement is start the copy.
What clearing is¶
Four writes of 0xFF, the slot's key high, key low, value high and value low, which is the order and
the value of the firmware's own purge, 0xE28C calling 0xDE70, which writes a slot's four settings in
ascending order. The store's history has runs of that shape, 8=ff 9=ff a=ff b=ff for slot position 2,
which held key 0x3EA4 then rather than the KPN box's, and later 0=ff to 7=ff and 18=ff to
1f=ff; section 303 found that history consistent with the purge, and who wrote those records is not
established. The first write alone already frees the slot, by the test above. Why an empty slot gives the configuration back its value is section 303's guard on
the Harmony 600's configuration: list 154 reads the KPN box's slot into variable 59, and only when that
is not 0xFEFD, the firmware's answer for an absent key, does list 3043 copy it into variable 67, the
delay. So with the slot empty, variable 67 keeps what base slot 13 seeds it with. That takes effect at
the next start, which runs the restore; until then variable 67 holds the 10 the last start gave it.
The rail¶
assertSettingsWriteAllowed in packages/usb/src/rails.ts, judged on what writeSettings reads off the
remote, behind HARMONY_ENABLE_WRITES=1 and its own door, HARMONY_SETTINGS_WRITE=1: the unit against
its lab record; arch 14 on its own list; firmware 0.2, since the 700's 2.8 append at 0x1186E is unread;
the forty delay settings only; one to eight writes; and a store in the shape all three arch 14 units are
in, block 0's header fc ff 00 00, block 1 erased, records contiguous, with no write reaching the last
record. predictStoreAfter in packages/usb/src/settings.ts models the append, unchanged values
included, and is what the read back is compared with. The encoder is in writes.ts, which the barrel
does not export.
On the Harmony 600¶
packages/usb/bin/write-settings.ts, first without --commit, which read the unit, the store and the
four settings through the remote's lookup, and then with it:
- the store before the write is byte for byte the store in the page
0xFFbackup taken before section 303's writes: 59 records, 451 free, the KPN box's power on slot 2 at key0x0EDCand 10 tenths; - four writes sent and all four accepted by
decodeSettingsWriteReply, which passes only the frameF0 11 B3 01 01 01 00, so each answered status 1 and code 0, the corrected reading and not the one section 304 first gave. The replies themselves were not filed; the script journals them since; - the two blocks read back are the prediction, 2048 of 2048 bytes: four records at
0x7A, of which only the four setting bytes changed, since a value of0xFFis already what erased flash holds; - the remote's lookup answers
0xFFfor all four settings, and the PS3's inter device slot, key0x0E26at 15, is untouched; - the remote enumerated afterwards, by an enumeration whose output was not filed.
After a start¶
Danny took the batteries out, ran section 303's bench test off the cable, and plugged the remote back in for two reads:
- Variable 67, the KPN box's power on delay, holds 15, the configuration's value, where it held the
saved 10 after section 303's battery pull. The restore's scratch, variable 59, holds
0xFEFD, the firmware's answer for an absent key, so the guard skipped the copy as section 303 read it should. The PS3's inter device delay still holds its saved 15. - The store read over USB holds the PS3's slot and no power on slot, so the start's sweep wrote nothing back.
So the clear did what it was for, on the remote's own memory. The bench test moved less than the delay did. KPN code 35 to code 41 was 2.404 and 2.403 seconds on the receiver's clock in section 303's two runs, and is 2.508 now: 0.104 seconds longer, where the delay grew by 0.5. The two earlier runs agree to half a millisecond, so the change is real; what else sets that gap is not established here. The TV's power code is sent between the two, heard at 21.12 seconds with six repeats, and code 41 follows at 22.62.
The configuration's delay, heard¶
To make the change too large to hide, section 303's file was written again, PowerOnDelay_79993804 at 45
tenths, the same two blocks and the same rails, the whole configuration read back identical. This time
nothing saved stands over it: after the bench test variable 67 held 45. The test heard KPN code 35
to code 41 at 5.520 seconds on the receiver's clock, against 2.508 at 15 tenths: 3.012 seconds
longer for the 3.0 written. The page named neither KPN frame, the receiver merging their opening
flashes as in section 303, so they are named by position and shape: the first frame's flashes are the
earlier run's frame 32 exactly, and the second opens the burst whose other two frames are each one flash
from the earlier burst's. The 1.5 second file then went back the same way, read back identical.
So on this unit the configuration's power on delay governs once no saved value stands over it, and a change large enough is heard in full. The 15 against 10 run's 0.104 seconds stays unexplained; the television's power code, sent seven times between the two KPN codes, is a candidate nobody has tested.
The television's seven copies, predicted before the Harmony 650 was read, and confirmed¶
The television on this configuration is a Panasonic, identified 80 of 80 against one codeset in
Logitech's catalogue, the TX-P42GT30E range. Of its 81 stored codes 79 hold 3 copies of the frame, which
is the :3 every command of that codeset states, and two hold 7: codes 42 and 49, PowerOn and
PowerOff. Code 4 is the same PowerOn frame at 3 copies. Nothing in the archive stated 7 at the
time, its version 1: the device files named only a codeset, and the family's definition has PressMinimumRepeats and
HoldMinimumRepeats null. Logitech's account model has a power feature whose power on and off actions
are IRPressActions with a Duration, which would compile to more copies. Danny is adding the same
model to the Harmony 650 through MyHarmony, in an activity, with its power settings left as offered.
Prediction, written before that configuration is read: its PowerOn and PowerOff used by the
activity hold 7 copies, and the rest 3, which would make 7 the account's default for this device
rather than a setting of the 600's account. If they hold 3, the 600's 7 is that account's own.
Confirmed. The 650 was read whole over USB after the sync, 1016225 bytes. The television is its second device group,
named Panasonic_TV by the configuration's own strings, 85 codes: two at 7 copies, codes 9 and 10, and
83 at 3. The two are the 600's codes 49 and 42 word for word, so the same PowerOff and PowerOn
blocks, and neither names a held block, so a press of either is the whole block. The LG television on
the same remote, group 0, holds all 83 of its codes at 1 copy, its power codes included.
What the account says explains the number. UserFeatureManager/GetUserFeatures, a read, for every
device on the 650's account record: the television's power feature holds PowerOn and PowerOff as
IRPressActions with Duration 1000, and none of the other seven power actions on that record,
on four devices, states one, null on each; Kodi has no power actions. One copy of either code lasts
134.6 ms and 136.4 ms, a frame and its gap, the blocks being 942306 and 954486 microseconds for seven,
so seven fit in a second and an eighth would not. That is the closure, the count off the frames against
the duration off the account, with nothing in common between the two. The margin is thin: without
the gap after the last copy, an eighth PowerOn would take 1002.1 ms, 2.1 ms over. The archive stated
no power feature for any of its devices when this was written, at schema version 1, so the account was
the only source. It states them now: its author added the features to every device record after
this project told him of the call below, schema version 2, and the television's record carries
power.on and power.off with durationMs 1000, powerOnDelay 5000, inputDelay 1000, the twelve
inputs, two digit channels, both states, and the delays and repeats, every one equal to what the service
answered here. Across the archive 3234 of 276236 devices hold a power press for a stated time, 2220 of
them for 1000 ms and 1788 for 2000. Version 2 changed nothing this project's reader takes, which
ARCHIVE_SCHEMA_VERSION's docstring records. Its step order is the service's, checked against the raw
capture it was projected from, a release asset of the archive: the service stores 3884 of 477079 power,
input switching and channel entry lists out of order, its author's notes say the steps' Order field is
authoritative, and the archive holds every one of them in Order sequence, where array position would
have turned a power toggle's press, wait, press into press, press, wait. It projects a hold of 0 ms as a
plain press. This said the per input and per state lists were not compared; they are now, todo-later
1.4, after the archive's author stated in his README that every list is sorted on Order. Of 680091
per input lists 55744 are stored out of order, of 82622 routes to a state value 5282, and of 29326 of a
state's own stepping and bracketing lists 68; the archive holds every one of the 792039 in Order
sequence, and none of the 61094 stored out of order in its stored order. Comparing them needs the
archive's own grouping undone first: a state's values arrive one entry per route and are grouped by name
in first appearance order, a route repeating an earlier one of its value is dropped, an input with no name
is dropped (10 of 1089522 inputs, each its device's only one), and a state stated twice word for word is
one state. One path stays unaligned, Panasonic's TX-W32D3DPL stating AV4Input twice with different
next lists, where the archive kept the first.
What that comparison is for beyond the order. The three fields the archive drops and section 321
needs, whether a state step sends or only records, the input numbering and the connected app mark, are now
derived from the raw capture by make catalogue-raw into a side file in the archive's coordinates, and
attached only to lists the comparison found equal, so a field cannot land on the wrong step.
catalogueRules in packages/codec/src/catalogueraw.ts answers a device's rules from both, marked by
source. On section 321's calibration devices the side file states what that section had to leave
unexplained: the Panasonic TX-29AK40F and the Thomson 25DT60H, whose compiles each hold one silent input
transition, each have exactly one input state step marked as only recording; the Sony KDL-32W705B's
Netflix carries InputOrder 1 and the online mark; every state step of the LG OLED65G26LA sends. And
InputOrder is not a unique numbering: the Denon AVR-1912 numbers CD and QuickSelect 1 both 11.
The 1000 is the catalogue's, and Logitech's service hands it out. On the 650's record the
television's power feature has Id 0 and DateModified null, as the PlayStation's does, where the four
features that were saved carry an id and a date; the other two records on the same login holding this
model carry the same 1000, one unsaved in the same way and one saved with its PowerOnDelay changed to
8000. That pointed at the catalogue and is now read off it: UserFeatureManager/CopyFeaturesFromGlobalDevice,
called the way MyHarmony's add device flow calls it, device id 0 and the catalogue entry's id, returns the
same power feature with Duration 1000 on PowerOn and PowerOff, Id 0 and an unpersisted device.
The id it takes is the archive's own globalDeviceId, 219481 for this model, and the reply names
version 4 of entry 304807, the id the account record carries; called with 304807 it is refused with a
fault from GetGlobalDevice. It wrote nothing measurable: the account record's device list and the
television's features read identical before and after both calls. MyHarmony's decompiled client sets no
power action duration anywhere; its power settings page loads the actions from the service and saves them
back unchanged. So the chain is catalogue, then account, then Logitech's compiler, and the remote only
ever sees the seven copies. The 600's own account record was not read, so its 7 is tied to a duration by
the identical blocks and not by a capture.
What it does not settle. Seven is consistent with the compiler sending as many copies as fit inside the duration and with any rule that lands between seven and eight, and one duration on one codeset cannot tell those apart. Three records on one login are one value seen three times rather than three samples. And the PlayStation's codes at 36 and 30 copies stand with no duration stated, so a duration is not the only thing that raises a count. Section 306 measures four more devices and section 307 eight more: the count is the frames that start inside the hold in five families and those that end inside it in the television's own.
Scope, decision 16¶
Sent on the Harmony 600 alone, so the reply, the landing and the read back are measured there only. The 650's 0.2 build is byte identical over the ranges above, so they are the firmware's statement there, and the rail admits it. The 700's 2.8 is refused, its append being unread. Arch 12 (Harmony One) has no such command family and arch 9 (Harmony 525) is unread, section 304.
Sources checked before the work¶
Sections 282, 303 and 304; the 0.2 image, above. Logitech's own templates in the mirrored Harmony
Desktop client and MyHarmony's own, in its decompiled Web.Driver, beside its HID command builder: no
template exists for skin 71, the 600, and skin 66's, the 700's, carries 0xB2 only as the firmware
update status read, B2 06 00; no template carries 0xB3 or a version request with a payload. So the
firmware is the only source for this write. Section 303 had said MyHarmony's source holds no USB layer,
which the review below found wrong, and it is corrected there.
The two reviews¶
The blind re-measure, given the question, the two images and the filed stores and not this text,
reproduced the frame, the five codes, the landing at the first free record, the copy on the last record,
the 650's identity over the path and the read back byte for byte, and added the double erase behind code
4, which this section now describes. The sentence audit corrected nine claims before this landed: two
sentences of section 304 that an unchanged value refutes; this project's first write "outside external
flash", which section 295's reinstall already was, where what is new is the first append to the
settings store; the purge stated as the history's author; MyHarmony's source said to hold no USB layer,
in section 303 too; the success claimed as filed when it was inferred, and a test that would have passed
a run that stopped; the code 4 path; the library treating only 0xFFFF as an empty key where the
firmware tests the high byte; the 650 identity cited over a narrower range than the one that matters;
and the order of section 304's "the remote is what caught it".
The television's seven copies had their own pair. The blind re-measure reproduced every count on both files, the identical blocks and the 1000 ms as the only duration stated. The sentence audit found the fit test comparing against a literal rather than the account's duration, the thin margin, an unfiled claim about the read, the six devices where Kodi has no power actions, the three records being one login and the 600's own record unread, and the unsaved feature as evidence the text had understated; all are corrected above. The catalogue half was then measured rather than inferred, by the call above.
Falsification¶
A successful write answering 4; a record landing anywhere but the first free one; a store read back that differs from the prediction; after a start, variable 67 holding anything but the configuration's 15; at 45 tenths, a gap that does not move by the 3.0 seconds written; a power code held for a stated duration whose stored copies overrun it, or leave room for another.
Where it lands¶
tests/test_arch14_write_target.py: the codes, the flag, the word programming and the copy on the last record on both 0.2 images, the four records against the filed stores and journal, and after the start the variable, the store and the gap.packages/usb/test/settings.test.ts: the request, the reply, the prediction and its refusals, the rail in a subprocess with each flag shut and with both open, and the read back against the prediction.packages/codec/test/irframe.test.ts: the television's two seven copy codes on the 650 and the 600, word for word the same, every other code of it at three, the LG at one, the 1000 ms on the account's capture as the only duration any power action states, and the same 1000 ms on the catalogue's own entry.packages/codec/src/driving.tsreads those rules out of the archive's version 2 for any device: timing, power, inputs, channel entry and states, five step shapes as four kinds, refusing any field or shape outside the set surveyed over all 276236 records.packages/codec/test/driving.test.tscompares the television's record with both service replies field for field, and walks the whole archive with exact counts: 3234 devices hold a power press for a stated time, 49 steps hold with no time, 14 of them naming digits rather than a command.packages/codec/src/catalogueraw.tsandpackages/codec/bin/catalogue-raw.ts,make catalogue-raw: the raw capture kept current, a device fetched out of it through an index, and the fields the archive drops attached to its reading.packages/codec/test/catalogueraw.test.tsholds the per input and per state order counts above, the projection and its refusals on made up records, the derived files' freshness againstSHA256SUMS, and the calibration devices read through the one door.docs/usb-protocol.md,docs/config-format.mdandCLAUDE.md's list of what has been written.
Section 304 | the archive | section 306. Section 305 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.