Harmony Touch: devices and infrared¶
What a Harmony Touch does with its devices: what it is told about each one, how a command it holds becomes the blinking of its infrared lamp, and what a writer has to carry through. What a device and device mode are for the person holding a remote is how a Harmony works; how activities and button maps lead to a command is activities and button maps; how infrared works on every Harmony, the code families and how often a press sends a code, is infrared.
The scope is one firmware build and one synced set of documents. Everything read in the firmware was read in the Touch's production image 4.15.330, and everything measured was measured in the documents one sync handed a Touch: seven infrared devices using five code families14. One more device, composed by this project with a definition of its own, was added to those documents, delivered and heard, a device of ours6; and all seven were composed again under ids of ours from their catalogue records and run inside their activities, the catalogue's and the person's8; and all seven were written again by this project from their catalogue entries, every definition from its own table, and heard inside their activities, built from nothing10. What is read in the firmware was read in the decompiled engine, the remote's own program; the test anchors the parts it can name in the compiled files and lists the rest as read only. Nothing here is checked on another build or another model.
The engine runs on the image's Lua 5.1 interpreter, not on its LuaJIT. The image carries both, and the start up script starts the engine through its launcher, which on the remote runs it with the Lua 5.1.4 interpreter; LuaJIT 2.0.0 beta 10 is what the screens' launcher runs. The engine's files are compiled for Lua 5.1, which LuaJIT does not load, and its bit library is the one built into the engine's own native library4.
Built at the moment of sending¶
An infrared command is a lamp blinking in a precise rhythm, and on the older Harmonys that rhythm is worked out by Logitech's compiler and stored in the configuration as a list of durations, ready to play, infrared records. A Touch is given no command as durations. It is given each command as Logitech's catalogue writes it, a code family's name and a number, and the family's definition beside it, and it works out the durations itself each time a command is sent, in its own program, before handing them to the part that drives the lamp4.
The definitions it works from are Logitech's own catalogue definitions, unchanged: each family a Touch is given is, field for field, the definition Logitech's catalogue states for that family, under the catalogue's own protocol id1. So a Touch sends what the catalogue says, with no compiled step in between, from the same definitions older remotes were compiled from, with the differences listed under against a compiled configuration.
The two documents¶
A Touch's devices arrive as two of the documents a sync hands it, the platform on the cable5:
DeviceList, one entry per device: the device record, its features (power, inputs, channel tuning and states of its own) and its commands. Every device record states the same fields, 56 of them1.ProtocolList, one definition per code family the devices use, anIrProtocoleach in the sync measured. Every command names one of them by id and every one of them is named by a command, so the list holds the families in use and nothing else1.
Both are Logitech's own data model, the entity listing. Logitech's service hands both out: the client fetched each with one request on the account, and what it got is, as parsed JSON, the document the remote received2.
From a key press to the lamp¶
- The command is found by name, without regard to case: each device's commands are kept by their name in lower case, so of two commands whose names differ only in case the later one wins, on any device that is not both a network and an infrared device4. Which button leads to which command is activities and button maps.
- The transport is chosen per command, by its
TransportType: Bluetooth, a keyboard, a network device, or else infrared4. Every command of the sync measured was infrared, none was learned and none carried a raw code1. - The family is looked up by the command's protocol id, and a command whose family or device is missing sends nothing4.
- The engine builds one packet of durations from the command's code and the family's definition, the start, repeat and finish sequences each in full, below4.
- The packet goes to a native program with the device's control port. A press starts the code, a held key sends the same request again with no packet, and a release switches it off4. How that program plays the three sequences, and what keeps a held code repeating, are not checked18.
How many times a press repeats the code travels as a number beside the sequences rather than as copies
of them: the device's PressMinRepeats, or 3 when that is null or negative4. A compiled
configuration states the same count by holding that many copies in a record's first block,
sending. The family's own count is never
used on a Touch: a definition's PressMinimumRepeats and HoldMinimumRepeats are stored and nothing reads
them, and neither is the device's HoldMinRepeats4. Where Logitech's compiler writes a code
at its family's count17, a Touch therefore sends it at the device's, and whether the two ever differ for
a device a Touch is given is not checked18.
How a code becomes durations¶
A command's code is written in the catalogue's notation, G:<family>:(<A>)(<B>)(<C>):<n>, three groups
of items, how the catalogue writes a code. In the
sync measured every code had that form, with the family named exactly as its definition and <n>
31. What a Touch reads of it4:
- only the three bracketed groups, which are the start, the repeat and the finish sequence. The
G:, the family name and the trailing number are never read. What they mean is not checked18. - each item names a segment of the definition. An item whose second character is
xis a segment id, its first character, and a value, the digits after thex; any other item is a segment id on its own, the word. So the0xin front of a code is not a hexadecimal prefix: it is segment0and a separator, and the one digit the catalogue's notation puts before every value names the segment the value is sent in. - a segment's id comes from its name: the segment named exactly like the family is
0, a segment whose name holdsKeyCodeis what follows that word,Repeatfor... KeyCodeRepeat, and any other is the text after the family's name and a space.
The structure is taken from each command, never from the family: a definition states its own default
sequence in a field also called KeyCode, a list of segment references each naming a segment by
SegmentName, and no file on a Touch names SegmentName4. In the sync measured the
two always agreed, per group as many items, a value where the definition names an encoded segment and a word
where it names a code segment1.
A segment becomes durations in one of two ways4:
- An encoded segment, one that carries the bits of a value: its header's durations, one cell per bit,
its trailer's durations, and then a silence that pads the whole to the segment's
TotalLengthwhen that is longer. - The value's digits: with
EncodingType0 or 1 each hexadecimal digit is four bits, padded with zeros on the left to the segment'sNumberOfBitsor cut from the left when longer. With 2 or 3 each digit is one symbol choosing one of the definition's cells, padded and never cut. The engine does not tell 0 from 1: a biphase family's meaning is entirely in its two cells. - A toggle bit: when the segment states
ToggleBit, that bit, counted from the left of the padded value, is replaced by a value the remote keeps per device and per family, which starts at 0 and flips on every send. Whatever the code states at that place is ignored. Of the five families measured only one states a toggle bit, inside its frame1. - A code segment, literal durations: its
Atoms, padded toTotalLengthwhen that is longer. ItsHeader,TrailerandPayloadare never read, which loses nothing, since every code segment in Logitech's catalogue carries its header and trailer inside its atoms and none has a payload3.
A duration is a 16 bit word: 15 bits of microseconds and the top bit set while the lamp flickers4. A duration over 32767 is written as words of 32767, as many as fit, and one word for the rest, and one under 30 is raised to 30. Two durations of the same kind in a row, a cell ending in a silence and the next opening on one, stay two words4.
The carrier, how fast the lamp flickers, goes into the packet as a period in nanoseconds, rounded to the nearest nanosecond, where a compiled configuration truncates it416. The period goes through the engine's bit library, whose conversion of a number adds 252 + 251 in floating point and keeps the low word, and that rounds, an exact half to the even neighbour as an IEEE addition does4. That is inferred from the decoded conversion routine and not measured on the lamp: the routine was recognised by its constant and by the shape of the addition it calls. What the native program does with the period after that is not checked18.
The packet¶
Big endian throughout4:
| offset | bytes | holds |
|---|---|---|
| 0 | 1 | 1 for a code, 255 for a learned raw code |
| 1 | 4 | the carrier period in nanoseconds |
| 5 | 1 | the constant 50 |
| 6 | 2 | the silence before the code, the device's InterDeviceDelay in milliseconds; 0 for a raw code |
| 8 | 1 | how many times a press repeats the code, the device's PressMinRepeats, 3 when null or negative; 0 for a raw code |
| 9 | 1 | 0 |
| 10, 12, 14 | 2 each | where the start, the repeat and the finish sequence begin, 0 for a group that is empty |
| 16 | each sequence: its number of duration words, then the words |
A learned raw code, a Raw text starting F, has no start and no finish, only a repeat sequence at 16.
The text is F and the carrier in hexadecimal hertz, then P and S values in hexadecimal microseconds, the
lamp's on and off times, with any dashes ignored4. No command of the sync measured carried
one1. In more detail4:
- The remote keeps a
Rawonly when it starts withF, and sends a command's key code instead whenever itsKeyCodeis a text that is not empty, so a raw command statesKeyCodenull or empty. - It reads tokens of an optional
PorSand hexadecimal digits, the letters upper case only and the digits either case, so any other character only separates two tokens. The first token has to holdFand the carrier; its period is rounded like a family's, above. Every later token has to start withP, the lamp flickering, orS, dark; the engine tests forPalone. Each value becomes duration words like any other. - A token that breaks the pattern stops the reading where it stands, and the packet is sent with its sequence's word count still 0. What the native program then plays is not checked18.
So any spelling of that grammar reads the same; how Logitech's own learning code spells one is a convention of theirs and not something the remote requires.
The packet goes to the native program as /ir/ir_send, with the device's ControlPort as the ports it
goes out on and a key latency; a held key sends /ir/ir_send again with no packet, and a release sends it
switched off4. The native program names the period, the silence and the repeat count in its
own messages, as period_ns, presilence and min_repeat, and one of those messages reports the silence
updated for the repeat count4. What the constant 50, the byte after the repeat count and the ports do, and how the
start, the repeat and the finish are played, are not checked18.
Against a compiled configuration¶
The rhythms are the same numbers, since both come from the same definitions: Logitech's compiler built the older remotes' records from the catalogue, families, and a Touch sends the definition itself. Two things differ in how the numbers reach the lamp4:
| a compiled configuration | a Touch | |
|---|---|---|
| the carrier period | truncated, 26315 nanoseconds for 38 kHz16 | rounded, 26316 for 38 kHz |
| how often a press repeats | copies in the first block, at the family's count where it states one17 | a number beside the sequences, the device's count always |
Of the five families measured, rounding and truncating give different periods for the two at 38 kHz and the same for the other three1.
Delays a device states¶
All in milliseconds, read against the engine's own millisecond clock4:
InterKeyDelayis the wait after a command before the next one to the same device, when commands are sent as a list, as an activity's start and end and a sequence are. A single key press neither waits for it nor starts it. A state that carries a delay of its own, an input'sInputDelay, replaces it for that command when longer4.InterDeviceDelayis the silence a device needs after another device's last command before its own first, and it is also the packet's silence field4.PowerOnDelay, on the power feature, goes on the device's last power on command, so it holds back that device's next command only4. How an activity's start schedules around it is starting, switching and stopping.ConnectedAppPowerOnDelayreplaces the power on delay when an activity selects an input markedIsOnline4.Durationon an action is how long the code is held, in milliseconds: the engine starts the code, keeps it going until the time has passed, and stops it4. What a held power code took on a unit, the lamp and the wait after it, is under starting, switching and stopping.
The power feature's flags4: IsPowerAlwaysOn suppresses the power off only, the power on
is still sent; a device whose PowerTypeId is 0 or 3 is powered by hand and gets neither; PowerTypeId 1 makes
power two discrete states and 2 one state that steps. IsScartCableSupported: while an activity starts,
as long as a command for such a device is waiting, devices without the flag are held back.
A device of ours¶
A device composed by a program, with a definition written from the program's own table of code families, is listed and sent like one of Logitech's. One device was added to the device, map and protocol lists a Touch held and delivered in a sync: a projector with eleven commands, ten bound to keys of its own map and one, Power, only on its screen, every command in the Sony 12 bit family, whose definition was written from the rhythm table and listed under a protocol id of ours rather than the catalogue's. The remote stored and committed the three lists, showed the device in its device list, and sent every one of the eleven when its key or its screen entry was pressed: each heard at a receiver as the 12 bit frame the definition describes, the command of the key's name to that device and nothing else, at least three frames a press, the device's press repeat count being 36. Taken out again by a second sync, the device was gone and the rest of the set was as before. So the engine builds its packet from a definition it has never been given by Logitech exactly as from theirs, at least for a definition of the same fields and shape as one of theirs: that one had the fields and shape of Logitech's Sony 20 bit definition, which the same remote sent beside it.
Identifiers of ours are nine digits from 900000000. A device, a map and a protocol definition each carry an id
the others name it by. Logitech's device and activity ids in the documents a Touch held are eight digits and the
protocol ids are the catalogue's, below a thousand, so an id of nine digits from 900000000 lies outside both by a
factor of ten and below 231; the remote took a device and a definition under such ids, 900000001 and
9000000026, and an activity under 900000003, its map named 16417Activity900000003 by
it7, an activity of ours. That is a margin
and not a guarantee, so a writer still refuses an id the documents already hold, a device id whose digits contain
another device's or sit inside one, and an activity id already an activity's or a device's.
What the screens drew for that device is the model's display. Corrected: this said a device of ours used inside an activity, with power or input states of its own, was not checked; devices under ids of ours with the catalogue's power, input and channel features ran inside activities, below8. It then said a definition of ours inside an activity was not checked, until definitions of ours for five families were heard inside every activity of a set, built from nothing10.
The catalogue's and the person's¶
A device a person sets up is two kinds of thing: what the catalogue brings when the person picks a maker and model, and what the person chooses. A writer composes the second and carries the first. The person's: the device's name, its maker and model, its control port, its press repeat count, its inter key and inter device delays, its power on delay, whether it is kept on between activities and always on, its input delay, and its own map. The catalogue's, carried unchanged but for the device's id where a feature names it: every other field of the device record, its features (inputs, power, channel tuning) with their steps, its commands with their codes, and the definitions those commands name, under the catalogue's own protocol ids. Composed so from a description of a set Logitech's service built, every device field came out equal to theirs, or equal but for the id9. All seven devices of a set a Touch held were composed that way under ids of ours, with their records taken from the set the remote held, and every code of the ten tests that had run on the set before was heard from them, 418 of 418, inside their activities and in device mode8.
Two carried fields are the account's and not the catalogue's: DeviceProfileUri and ContentProfileKey, the
address and the key of the device's favourites documents, which the remote keeps apart from the six. In Logitech's
documents the key is the device's own id; under an id of ours it no longer is. The screens' favourites reader takes
the pair by the device's id and reads the key and the address from the device, so a writer carries the pair on the
tuning device and the favourites are still found12. Measured: with the pair carried on a TV
under an id of ours, the five favourite channels were each tuned as before, 15 of 15 codes8. A pair that does not match the remote's
favourites documents is not checked18.
Built from nothing¶
A set whose every device record and every definition was written by a program, with no Logitech document as input, is stored and sends every device's codes as it states them. The seven devices of the documents above were written again from a setup file and Logitech's catalogue: each device record from its catalogue entry, every definition from the program's own table of code families, five definitions in all, under protocol ids of ours, with the same devices, maps and activities as the whole setup above. Delivered with the other four documents in a sync, it was committed, and a test that starts every activity from off and ends it heard every one of its 38 expected codes at a receiver, each pause in its band, judged by rendering every code from the set's own definitions: Toshiba 32 Bit from four devices, Sharp 15 Bit 2 and Sharp 48 Bit 2 from the receiver's power and input codes, Sony 20 Bit and Microsoft 30 Bit; no other code was heard during the test10. With the Toshiba 32 Bit definition's header pulse made half as long again, the same pulses fit 15 of the 38, so the judging rests on the definitions10. Before that, one definition written by a program had been played, the Sony 12 bit definition above6.
The families a unit has played: from Logitech's definitions, the five of the documents a sync handed a Touch, heard in every activity and in device mode in the ten tests of starting, switching and stopping115; from definitions of ours, Sony 12 Bit in device mode, above6, and the same five, Toshiba 32 Bit, Sharp 15 Bit 2, Sharp 48 Bit 2, Sony 20 Bit and Microsoft 30 Bit, inside activities, in the test above10. No other family has been played on a Touch18; what the rest of the table would send is read in code, below.
What a definition has to state for a whole transmission. The engine sends an encoded segment as its header,
its cells, its trailer and then a silence up to the segment's TotalLength, and nothing else between one segment
and the next, how a code becomes durations4. So a definition
written from a family's rhythm has to carry what follows each frame, the trailer and the length it is padded to,
besides the lead in, the cells and the carrier; without them one frame follows the last with no gap. This project's
rhythm table states a family's frame, and the trailer and the gap only in its timings of one repetition and of the
first transmission, which is what its writer reads them from, and states no toggle bit and no finish sequence, so its
definitions carry neither, packages/config/src/families/harmony-touch/definition.ts11.
What these definitions leave out against Logitech's for the same families, field by field, and why each changes nothing the engine does, is held by the comparison that built them11. The one that could show on a unit is the Microsoft 30 Bit toggle bit, which Logitech's definition states and ours does not, so by the comparison's reading every press of a key sends the code as first stated11; a second press of the same key in a row was not sent in the test, and whether a console tells two presses from a hold without it is not checked18. The other codes of each family, beyond the ones that test sends, are the comparison's reading of the definitions and were not heard18.
Every family of the rhythm table¶
Of the 681 families of this project's rhythm table, 577 are
written into a definition a Touch reads, and every code tried through each sends the durations the table states for
that family, but where the engine's own spelling of a duration changes one and on three codes the table's renderer
declines. This is read in code and not on a unit14: each definition and a set of codes into it are read the way the engine reads them, segment
by segment, header, cells, trailer and pad, each duration as the engine's words, enginePacketOf in
packages/config/src/families/harmony-touch/packet.ts, and held against the table's own renderer over the family's first
transmission and its held repetition. The codes are chosen so every cell goes out at every place, with alternating and
fixed pseudo random values besides, each value at its segment's width14. A press is read as the
start sequence followed by the repeat sequence as many times as the family's first transmission repeats it; how the
native program plays the three sequences is not checked18.
What the engine changes, from a definition of ours and from Logitech's alike14:
- A duration under 30 microseconds goes out as 30, a zero included, and the rest of one over 32767 is raised the same way. Eight families state such a mark in a definition written at their name's widths, and the Touch sends it longer than the table states14; Logitech's definitions of those eight state the same short marks, so the Touch sends the same from either13.
- A frame longer than its padded length goes out whole with no pad. Three families meet it on one code each, where the table's renderer declines the value.
- The carrier period is rounded where the table's is truncated, so on 396 rows the period a Touch takes from the carrier a definition of ours states is a nanosecond longer than the row's.
No row has a toggle bit or a release, and so no definition of ours has either: a toggling family's code goes out the same on every press, where from Logitech's definition the toggle bit flips14, built from nothing.
The 104 rows not written are each a gap of this project's, never of the Touch's description14:
| why | rows | which |
|---|---|---|
| the family's name states no width for its values, or one that is not a whole number of cells | 96 | all of them stated rows; each is written at a width a caller states, and sends the table's durations then, but for the engine's spelling |
| the row was measured as a frame with nothing after it, so no trailer and no gap | 5 | Kreatel IP 22 Bit, MitsubishiO1 Dual 8 16 Bit, Roku 32 Bit 1, Panasonic 16 Bit, Sharp 48 Bit |
| the row is a whole record of a shape the writer has no segment spelling for | 3 | Galaxis 16 Bit Quad Toggle, Philips Hurd 16 Bit LongToggle, Samsung 38 Bit |
Logitech's own definition of every one of the 104 families is written in the same description, and read the way the
engine reads it, it makes a packet for every catalogue code of 103 of them and for all but 27 codes of the
104th, Galaxis 16 Bit Quad Toggle, whose 27 carry a second 0x inside a value that the engine cannot read as
digits14. Between them the 104 hold 8964 distinct codes of the catalogue, against 143161 for the
families written.
The reading is calibrated on Logitech's own definitions. Read the same way and played at the compiler's repeat count,
Logitech's definitions of the 29 measured rows written send those rows' blocks, which were measured off configurations
Logitech's compiler built, on 89448 of the 93504 catalogue codes of those families; 418 name other segments than the
family's default and 4 do not read, and the 3634 that differ are all of MemorexO1 32 Bit, whose row was measured
with another gap after the frame than Logitech's definition pads to14.
Which shapes the unit has played, and which not. Of the six shapes of frame, the families played from definitions of ours, above, are pulse distance, pulse width and biphase, each in one rhythm. No family of a cell table, 220 rows, nor of several rhythms in one press, 52 rows across the shapes, has been played from a definition of ours, and no definition is written for the quaternary, long toggle and sections shapes; 146 rows written at their name's widths are of a shape no played family has14.
What a writer must carry¶
The remote's own screens change DeviceList and send it back whole: the delay screens and their reset,
the port assignment screen, and a device's setup state, each by changing the document in place and saving
all of it4. So every field a writer puts in a device list can come back, the fields nothing
reads among them, and a writer that drops one has changed what Logitech's service holds. A device list changed
by a program and delivered in a sync was stored, committed and used: one with a device of ours appended,
below, and the same list with it taken out again6. This said
uploading a changed device list had not been measured until then.
Required, in that a document without the field stops the engine4: a device's
DeviceType, Manufacturer and Transport; a command's TransportType and its Raw key, which may be
null but has to be there; and, when infrared is sent, the device's PressMinRepeats and InterDeviceDelay.
A command whose KeyCode key is missing, rather than null, cannot be sent. ControlPort is taken as it
stands, so a missing one is not the engine's default.
ControlPort 0 means the remote's own lamp, any other value a hub or its blasters, in the screens'
reading; the values Logitech's schema names are Remote, HubInternal, HubBlaster1 and HubBlaster2,
the entity listing4. What a Touch with no
hub does with a nonzero port is not checked18.
Read by nothing on the remote, as no file of its engine, its screens or its native programs names them4:
| where | fields |
|---|---|
| a command | CommandTypeId, IsLearned, FunctionGroupId, DateTaught |
| a device | DefaultPressMinRepeats, HoldInterKeyDelay, HoldInterDeviceDelay, IsInterKeyDelayOptimized, DeviceOrder, GroupName, PrivateAddType, DongleIndex, Characterization, CopiedDeviceSource, DeviceSearchType, DeviceClassification, AppLaunchConfigs, PictureId, RegionalCharset, DecodedEdid, EncodedEdid, ActivityIds, GlobalLanguageVersionId- |
| a device feature | CanSkipInputs, IsAutoSwitch, PortTypes, ValueDelay, IsConfirmed, PowerOnResetInputName |
| a protocol | IsPadded, IsFullSequence, SendingType, HoldDelay, RelatedProtocols, IsPublic, NumberOfLinkedLanguage, and its KeyCode field's segment references |
Stored and never used: a protocol's PressMinimumRepeats and HoldMinimumRepeats, a device's
HoldMinRepeats4. Read by the screens alone: DefaultInterKeyDelay,
DefaultInterDeviceDelay, DefaultInputDelay and DefaultPowerOnDelay, which the delay screens reset to,
and ParentDeviceManufacturer, ParentDeviceModel and IsMultiCode4. A protocol's
ControlSection is read, for a network device's commands4.
Not checked¶
- What the native program does with the packet: the constant 50, the byte after the repeat count, the ports, how the start, repeat and finish sequences are played, and how the silence is adjusted for the repeat count18.
- What the native program does with the carrier period after the engine has rounded it18.
- What
G:and the trailing number of a code mean; a Touch ignores both18. - Learned raw codes, Bluetooth, keyboard and network devices, a finish sequence and encoding types 2 and 3, which are read in the engine and occur in no document measured18.
- Whether a device's repeat count and its family's ever differ for a device a Touch is given, which decides whether a Touch and a compiled configuration send such a code a different number of times18.
- What a nonzero control port does on a Touch with no hub18.
- A definition of ours of a shape no Logitech definition the remote holds has18, and on a unit any of a cell table or of several rhythms in one press, which every family of the rhythm table reads in code only18. Corrected: this listed a device of ours inside an activity and a device of ours with features, which the catalogue's and the person's ran under ids of ours8, and then a definition of ours inside an activity, which built from nothing ran for five families10.
- Any other firmware build, and the other remotes of the generation18.