Skip to content

91. Infrared learning is a command family the firmware brackets and a stream nobody has found

The last square of the client dig. docs/host-client.md's rule is firmware first, and this section is a clean example of what that buys and what it costs: the client describes the whole of infrared learning, the firmware settles the half of it that is control flow, and the half that carries the actual pulse data is not located in any image here and therefore stays client-sourced.

What the firmware settles

0x70 START_IRCAP is already in the dispatch table, taking no arguments and setting state 5. What had not been read is what happens next, and the state machine says it plainly.

  • State 5 has its own command chain, at 0x0C5D4 in the 700 image. It accepts exactly one command, 0x80, and that sets the state variable to 6. So 0x80 is the stop, and it is a command that only exists inside a learning session.
  • Any other command during a session aborts it. The fall through at 0x0C5EE clears the state variable to 0 and sets the error byte, so a host that sends anything else mid-learn does not get an error reply, it gets a session that quietly ended.
  • States 6 and 7 share one executor, 0x0CB20, reached from the main state chain at 0x0C720 where both cases point at it. It sets the state to 7, then emits two response bytes, 0xF0 and then 0x70. That is the acknowledgement shape this document already records for WRITE_MISC, which replies 0xF0 then 0xA0: a bare acknowledgement naming the command it acknowledges.
  • The 600 0.2 image carries the same three instruction shape with its own addresses, setting its own state variable to 6 and its own error byte, so this is the architecture and not one build.

So the bracket is firmware fact: 0x70 opens, 0x80 closes, 0xF0 plus the command echoes the close, and the states run 5, 6, 7.

A negative that did not survive being checked

This section first said the following, and it is wrong in its inference rather than its facts, so it is corrected here rather than deleted.

No 0x90 is emitted by the response builder in either arch 14 image. Enumerating every MOVLW k ; MOVWF f pair in the 700 and listing what the response byte at 0x358 can hold gives eighteen distinct literals, of which the command shaped ones are 0x30, 0x50, 0x70, 0xA0, 0xD0 and 0xF0, all echoes.

Every word of that is still true, and it establishes nothing. The same scan finds no 0x60 either, and 0x60 is the code of READ_FLASH's data response, which certainly exists and which this project has driven thousands of times. A data response carries a computed length nibble, so its code byte is assembled at run time out of 0x60 and a count and never appears as a literal anywhere. A scan for literals therefore cannot see any data response, and using it to argue about one is a category error.

It was caught by running the scan on the Harmony One to answer a follow up question and noticing 0x60 missing from a list that had to contain it. Worth recording as a shape: a search that can only find one kind of thing proves nothing about a kind it cannot find, and the way to notice is to run it against something already known to be there.

The receiver exists on every architecture, which is the real answer

Asking the question of the hardware instead settles it. Learning needs a capture, and a PIC18 does that with a CCP module, whose mode is stated in the low nibble of its control register: 0100 to 0111 are the four capture modes, 10xx compare, 11xx PWM. What each image writes:

image CCP1 CCP2
One 3.4, arch 12 0x0C PWM at 0x2DA62 0x04 and 0x05 capture, at 0x2B46C, 0x2B4D8, 0x2041A
700 2.8, arch 14 0x0C PWM at 0x1AFB4 the same three, at 0x0904C, 0x090B8, 0x0941E
600 0.2, arch 14 0x0C PWM at 0x196D8 the same three, same addresses as the 700
525, arch 9 0x0C PWM at 0x076B8 the same three, at 0x05EEC, 0x05F58, 0x0141A

CCP1 in PWM is the carrier this project already read from the transmit side, section 32. CCP2 in capture on both edges is the receiver, and it is configured in all four images including arch 9. Modes 0x04 and 0x05 are every falling edge and every rising edge, which is exactly what measuring an envelope and a gap alternately requires, and it matches the alternation the client's reader expects.

There is a driver around it, read on the One: 0x2B46C selects falling edge capture, clears the CCP2 interrupt flag in PIR2 and enables it in PIE2; 0x2B476 is the mirror that disables and clears; and 0x2B47E reads the capture register twice into two different pairs and compares them, which is a glitch check on a value that can change under the read. 0x2B510 clears eight state bytes and jumps into the starter, so it is the session initialiser.

So the capability is not in doubt on any architecture here.

The samples do reach the host, and the firmware search cannot find how

The owner used this feature. With the classic software the remote was put into a learning mode, a second remote was held against the back of it, a button was pressed, and the client recognised the received code immediately and moved on to processing it. That is a first hand account of observed behaviour, recorded here as such: it is not a measurement and it is not firmware, and it is still much better evidence about what the system did than anything derivable from a client that nobody has run.

It settles the question this section was holding open. The samples reach the host live, during the session, which is exactly the model Logitech's own learning service implements. So a sender exists.

And an exhaustive search of the response path does not contain it. On both architectures:

  • every state body in the machine emits its response codes as literals or as a code ORed with a computed length nibble, and the scan sees both forms. The One has 10 states and the 700 has 70. Not one of them emits 0x90, on either architecture.
  • the byte at a time sender has 32 callers on the One and every one of them lies inside the command response region, 0x26980 to 0x26D92. None is in the capture driver.
  • the response buffer's write pointer and its length counter are touched only inside the USB transport layer, 0x2003C to 0x203BE. The capture driver touches neither.
  • the internal 0xFE pages carry no separate learner: the One's configures no capture at all, and the 600's hits are its own application firmware at the same addresses.

Every one of those is a fact, and together they say a search from the response path backwards has been run out. So an assumption in that search is wrong rather than the feature being absent.

Two of the three candidates die on the client's transport layer

The next remark killed the easiest one: codes have been learned on all of these remotes, repeatedly, and the feature is called Learn Command in the classic software. So it is not a case of reading the wrong firmware.

Reading the client's HID channel kills a second. It is one pipe in each direction with no report ids, and the read side hands every report it gets straight to whichever service is listening. There is no second endpoint the capture could be using, and this project's own descriptor work agrees: one interrupt IN endpoint, number 1, docs/usb-protocol.md.

And it is genuinely unsolicited. The learning service calls something on every packet that looks like a poll and is not: it only takes the next item off a queue the reader thread has already filled, with a timeout, and sends nothing to the remote. So the remote pushes reports of its own accord while a session is open, and no request is outstanding to carry them as a reply.

Which says exactly where the sender has to be

If the reports arrive on endpoint 1 IN, the firmware has to fill the same buffer every command response uses, whose descriptor is at 0x40C and whose byte count at 0x40D the response builder increments once per appended byte. There is no other way out of the part.

0x40D is touched in four places, all inside the transport. 0x40C is touched in nine, and eight are in the transport and one is not: 0x2AF1A, in a routine at 0x2AEF4 that gates on a mode variable and clears the descriptor's bit 6. That is the only code in the image outside the USB layer that touches the input endpoint's descriptor, which makes it the one place worth reading next. Whether it is the learn sender or ordinary USB plumbing that happens to sit outside the region this project drew around the transport is not established, and it should be read before it is believed: this section has already retracted one conclusion drawn from a suggestive absence.

What the client supplies, and it is unconfirmed

Restated in this project's own words, per rule 3. All of it belongs to docs/host-client.md's ledger and none of it enters docs/config-format.md.

A data report is: a code byte whose length nibble is zero, then a byte carrying two counters in its nibbles, then big endian u16 words, and the byte count in the last byte of the report. That last part is the striking one, because every other command in this protocol declares its length in the low nibble of byte 0, and here that nibble is zero and the real count lives at the far end of the report. Word count is (count - 2) / 2.

The two counters are a sequence, 0 to 15 and expected to increment, and a dropped counter. A change in the dropped counter means the remote lost samples, and the number lost is twice the increase, so samples are dropped in pairs, which fits data that alternates between two kinds. The client tolerates exactly one out of order report, holding it back until its partner arrives, and gives up on the second.

The first three words of a session are calibration, not data: a last pulse on time, a first pulse time, and a clock count. The carrier period is the gap between the two times divided by one less than the clock count, in microseconds, and the frequency is a million over that. Section 32's carrier finding is about the same quantity from the transmit side, where 38 kHz implies a stored 263, so the two are checkable against each other whenever a real session is captured.

After calibration the words alternate envelope and gap, and the unit of an envelope word depends on the architecture: on the older ones it is a count of carrier cycles and has to be divided by the frequency just measured, and on the newer ones it is already microseconds. A gap word is total elapsed time rather than a duration, so the preceding envelope is subtracted from it. The architecture split is at architecture id 2, which is below everything this project targets, so for arch 8, 9, 12 and 14 the microsecond reading is the one that applies.

Finally, the session is bracketed on the host side by two configuration state changes, one before and one after, and after the stop the client waits an architecture specific reboot delay before carrying on. So stopping a learn can restart the remote, which is worth knowing before anyone drives this.

A second client, found the same day, and what two sources agree on

Added 9 August 2026. Harmony Desktop.app is a different application from the decompiled classic client and from the MyHarmony one this project had checked, and its packet layouts are served per model as ordinary files. It describes the same session, for the Harmony One by name, and the two clients were written years apart by different means.

Where they agree, believe it more. The classic client said the session is bracketed by two configuration state changes; this one gives the bytes, a restart command with a subcommand, an entry point selecting start or stop learn, and a configuration type. Both agree the capture opens with 0x70 and closes with 0x80, which the firmware had already settled, and both terminate the read on 0xF0 0x70, which the firmware had also settled. So the bracket now has three independent sources and the entry point values have one.

Where they disagree is the useful part. The classic client takes learn reports off a queue its reader thread filled without sending anything, which reads as the remote pushing reports unsolicited during the session. The Desktop one models the same bytes as a command's response stream: two packets after the start, an unspecified number after the stop, ending at the acknowledgement. Both put the samples on the one IN endpoint and end at the same terminator, so they can be one wire behaviour described from two heights, and that would explain why no separate sender exists to be found. But which it is decides what an implementation does, keep reading during the session or read after the stop, and it is not established.

Settled by section 98, and in the classic client's favour. The reports are pushed: the transport checks a toggle and two buffer status bytes on every pass and hands the endpoint whichever of two buffers at 0x0600 and 0x0642 is full, consulting no command at all. A host must keep reading during the session.

What it changes for the search: 0x2AF1A is no longer the obvious next thing to read. The response paths of the 0x70 and 0x80 handlers are, because both clients say the bytes come back the way every other response does.

Also wrong, section 98, and instructively. There is no response path to read, because the samples never pass through the response machinery: the firmware points the endpoint's buffer descriptor straight at the capture buffer. The search failed twice because both attempts assumed the bytes would be sent, and START_IRCAP names the buffers in the four addresses it clears.

And the enter and leave commands are writes. The restart command puts a remote into a mode, and its entry points cover far more than learning: config updates, firmware updates and upgrades. It sits behind WRITES_ENABLED in packages/usb/src/rails.ts when it is implemented, and no read path may issue it. docs/host-client.md has the rest, marked client sourced.

Where it lands

  • docs/usb-protocol.md, the state machine and the two commands, from the firmware.
  • docs/host-client.md, the packet layout, the counters, the carrier arithmetic and the reboot delay, in the ledger, marked unconfirmed.
  • tests/test_usb_firmware.py, which pins the state 5 chain and the shared executor on both arch 14 images, so the bracket cannot rot, and the capture mode selection on all four.
  • reference/superseded.md, so the withdrawn inference cannot be restated.

Section 90 | the archive | section 92. Section 91 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.