126. A device's name is in the config as ASCII, and a state variable's transitions say which device it is¶
The application needs a list of devices with their names before it can show anything, and section 86
had given it the list: a device is an infrared group. The names looked like the harder half. Base slot
0 names no devices: its level 1 nodes are state variables, Root and State above them, and on
some generators a HarmonyAssistant menu, and that is the whole tree in all fifteen containers that
carry one.
The label is in there anyway, as a prefix.
A level 1 name is the device's label plus what the variable tracks about it¶
<label>_<property>_<values>
<values> is the count section 86 read. <property> is one word: Power, Input, InputType,
TVInput, CompAVInput, Screen. What is left is the user's own words for the device, underscores
included, and it runs to four tokens in two containers here.
A name that belongs to the config rather than to a device has a number where the property is.
CurrentActivityState_0_4 and CurrentLocation_1, and on arch 14 the whole delay family,
DefaultPowerOnDelay_<id>_255, whose qualifier is a Logitech device identifier. So the discriminator
is that no property is spelled as a number, which is section 86's own observation that the qualifier is
"a device identifier on the arch 14 configs, and a small number elsewhere" turned into a test. It
matters more as a negative than a positive: reading a global as a device invents a device with no
infrared group, and the elimination rule below would then pair that invention with a real group.
The link is base slot 13, and section 86 had already read it¶
A variable's record carries its transitions, eight bytes each, holding one action list instruction. For
a device's Power or Input variable that instruction is 0x7F, naming the base slot 10 list that
performs the transition, and performing it means sending the device's own code. Opcode 0x7D is
{ u8 group; u8 index }, section 33, so the group is right there:
TV_Power_2 -> record 30's transitions -> 0x7F list -> 0x7D operand 0x020C -> group 2
Across fifteen containers and four architectures:
| device variables whose transitions reach exactly one group | 102 |
| reach more than one | 0 |
| reach none, so the variable has nothing to switch between | 13 |
| two variables of one device disagreeing about the group | 0 |
| two devices claiming one group | 0 |
The reader refuses both of the last two cases rather than picking a winner, and nothing in the corpus makes it do so.
Two routes fill in behind it, and they are ranked¶
- Elimination, when exactly one label and one group are left unpaired. Five devices, and every one of them is the case where a device's only variable has no transitions.
- The screen, for a group base slot 0 does not name at all: the title of the device's own mode, meaning a mode whose keys send that group's codes and nobody else's. Three devices. A candidate that already names an activity is dropped, which is what separates a device from the activity that uses it: one config has both, and the activity's name is the device's with a verb in front.
Taken only when one candidate survives, because the calibration says this route is weak. Run against the devices route one already names, the mode title is the label on arch 9, 4 of 4, and arch 14, 13 of 13, and it is a command name on arch 8, 1 of 31, and arch 12, 0 of 7, which draw no title at all. So the ordering is not a preference: on two architectures the third route would be wrong most of the time.
Two independent closures¶
The label is drawn. Every one of the 55 labels route one pairs also appears in the config's screen text, 53 exactly and 2 as a truncated prefix where a menu cut a long name to the width it had. Those are two encodings of one string decoded by unrelated code: base slot 0's bytes are ASCII, and the screen's are glyph codes resolved through the per config font table of section 112. Neither reader knows the other exists.
The pairing is what agrees, not the label. On arch 9 and arch 14 the device's own mode draws its label as a title, 17 of 17. Shifting the pairing to the next group breaks 16 of 16 cases that can be shifted, the seventeenth being a config with one device, which can only shift onto itself. So the agreement is about which group a label belongs to and not about the label existing somewhere.
The result¶
63 of 63 devices named, in fifteen containers on four
architectures: arch 8 34, arch 9 5, arch 12 8, arch 14 16. make devices, and 55 of those come from
the names, 5 from elimination and 3 from the screen.
Two of the three screen cases and four of the five eliminations are the same shape, a device the user added and never gave a state to: no power toggle, no input list, so no variable and nothing to switch. That is worth knowing for the application, because such a device still has its codes and still appears in the menu.
The bug, which only one architecture could show¶
The walk from a list to the groups it sends to is shared by both consumers, and the first version memoised it. A nested walk stops at whatever the outer walk had already visited, so its result is only correct in that context, and caching it lets a list inherit a truncated answer from whoever reached it first.
Nothing failed on arch 8, arch 9 or arch 12, whose lists carry 0x7D directly. Arch 14 emits
{0x7F, 0x7D, 0x7C}, section 33, where the send sits in the list the first instruction names, so
every arch 14 device lost its name at once and the total went from 63 to 47. The lesson is the one
CLAUDE.md states about opcode tables, in its other direction: the shared walk was right to be shared,
and what was wrong was an optimisation whose correctness depended on the caller. A test asserts the
property rather than the fix, that a list reaching a group only through 0x7F is in the map with
something in it.
The last hop: what a button sends, and which devices an activity drives¶
0x7D names the device, so the same walk answers two more questions the application asks, and both
were one query away once it existed:
- What a button sends. A tagged list binds a key to a base slot 10 list, and the list's codes are
what the key sends. 4448 bindings across the corpus send at least one, and 4431 of them are event
type
0x80, a press; the seventeen that are not are event type 0 in a base slot 9 set, tags 1, 2 and 5, which are that set's enter and leave handlers rather than keys. Nothing sends a code on a release or on a repeat, anywhere. Most bindings send nothing at all, because navigation and screen switching are bindings too.
Both kinds of tagged list carry them, and reading only the pages was a real gap for a while: a mode page's list holds the soft keys, and a base slot 9 set holds the hard keys while an activity runs. The volume keys of the bench Harmony One are in its activities' sets and in no mode page, so a view built on pages alone showed every soft key on the screen and not one volume key. 3106 page bindings against 1342 set ones. * Which devices an activity drives. The starting chain selects a base slot 9 set, section 120, and that set is the key map the activity installs, so the devices its bindings address are the devices the activity uses. Every activity in the corpus drives one to three, and every group it names is a group the config has.
The union is taken over the whole set rather than over the start sequence alone, deliberately: an activity that sends the volume to a receiver is using that receiver whether or not it switched it on.
inventory composes all of it into one object, and that exists so that the application does not.
Naming a device needs the infrared groups, the state variables, the action lists and, three times in the
corpus, the screen text; naming an activity needs the touch hit map on arch 12 and the modes elsewhere.
An application assembling that itself would be a second copy of the composition, and by the rule this
project keeps about second copies, the first thing to drift.
What it does not settle¶
- A command has no name. An infrared record carries a code and nothing else, so "the volume up command of device 3" is a group and an index. Where a command is drawn on a screen it has a label, and that is a soft key on a page rather than a property of the record.
- An activity's name is the label as drawn, which a menu may have cut short. One Harmony 525 activity reads as its row's own text where the mode it enters says a longer string with that text as a prefix. Which of the two an interface should show is a product question, and nothing here decides it.
- The arch 14 device identifiers are not tied to groups. The delay variables carry a Logitech identifier per device, four distinct ones on the 600 for four groups, and their records have no transitions, so nothing here pairs an identifier with a group.
Where it landed¶
packages/codec/src/inventory.ts: devices, deviceVariables, deviceModeTitles,
infraredCodesPerList and its reduction infraredGroupsPerList, which is the shared walk, plus
keyCodes, activities and inventory. make devices prints the figures with the source
column, packages/codec/test/inventory.test.ts carries the closures and the controls, and
docs/config-format.md has the structured form.
Section 125 | the archive | section 127. Section 126 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.