Harmony 300 and 350: USB¶
These remotes plug into a computer with a USB cable, and the computer treats them as a small set of files: it asks for a file by its path, such as the one holding the configuration, and gets its bytes. That is a different protocol from the command protocol of the Harmony One and the Harmony 600, 650 and 700. The protocol itself is the file protocol, from Logitech's own specification; this file states what holds for both models and what this library does with them.
Identity¶
| field | value | from |
|---|---|---|
| USB product id | 0xC124, file based | FILE_BASED_PRODUCTS in packages/usb/src/transport.ts, and the model's row in REMOTES |
| flash addresses and escape sub commands | none: a file based remote is read by file name, and openHarmony refuses it |
isFileBasedRemote in packages/usb/src/transport.ts |
Generated from packages/usb and REMOTES in packages/silhouettes/bin/remotes.ts by make remote-reference-write. Change the source, not this block.
The product id comes from FILE_BASED_PRODUCTS in packages/usb/src/transport.ts, which lists 0xC124 as
"Harmony 300, and measured here on a Harmony 350"; the command protocol's profiles hold no entry for this
family.
- One product id for both models,
046D:C12412. bcdDeviceis BCD of 1000 plus a skin,0x1104on a 3502, so the skin can be read from a listing without opening the device. It is a constant in each build's own image, one word of its device descriptor, firmware.md11. On a Harmony 300 it names the family's base skin and not a unit's regional one, the 300's usb.md./sys/sysinfoanswers its architecture and skin,arch 0x10 skin 0x68on a 350 and skin0x4Fon a 30034. Its field names are strings in the firmware, listed asSYSINFO_FIELDSinpackages/usb/src/filepipe.ts, which no archive section or test holds8. Theguidfield and/sys/guididentify a unit and never leave the terminal.
The protocol¶
- A packet is
FF, a command, a sequence number, a count and parameters. Commands: ping, open, write, read, commit, device control, close, a bus command and a control family whose members reset the filesystem and reboot6, the file protocol. - A request names a file by path; an open reply carries a handle and a big endian size, and a file's stated size is its only end, packets padding with NUL. Logitech's client states it6, and it was confirmed on a Harmony Touch57.
What the firmware does with a write¶
Logitech's client writes a configuration to these remotes in seven steps, the file protocol. This library sends them through one railed path, below, and none has been sent to a remote; what follows is what the 1.4 firmware does with each, read in the image9.
| step | what the remote does |
|---|---|
the file system reset, 0xFF with 0x66 |
closes whatever file is open, and answers. Nothing it calls erases, writes flash, touches the settings store or changes the configuration's verdict, so a remote whose sequence stops right after it is as it was. It is needed because an open is refused while another file is open, which an interrupted earlier attempt leaves behind |
| open for writing | erases before it answers. For /cfg/usercfg it ignores the size the host sends, clears the configuration's verdict and erases six 64 KiB blocks from 0x020000: the 256 KiB the configuration may use and the 128 KiB after it, which on a 512 KiB flash part is the log, memory.md. The old configuration is gone once the open is sent |
| write | programs each data packet's bytes at a running address that starts at the file's place and moves on by every packet, a packet's length being the low six bits of its second byte. Nothing compares that address with the file's size, so the bound is the writer's |
the check, 0x06 subcommand 0x01 |
for /cfg/usercfg, tests GSPM at the start and LWJL at 0x47 and compares the checksum word stored at end_addr - 2 with the expected value the host sends. It recomputes nothing, and the type, seed, offset and length the host sends are parsed and never used. A match answers m at byte 7 and sets the verdict; anything else answers u |
flush, 0x05 |
reads no flag, so "do not validate the region" means nothing to this firmware. For /fw/normalmode it stores a request the close turns into a reboot; for a configuration nothing it calls does more than answer |
close, 0x07 |
closes the file, through the same routine as the reset |
the reboot, 0xFF with 0x00 |
a processor reset after a short delay, with nothing on the way that writes flash; 0x62 and 0x6E do the same |
A writer has to send the whole container, its end marker included. A read stops four bytes short
because the open for reading states end_addr - 0x020000 as the size, and the validator a remote runs at
start demands PTYY at end_addr, which the check does not look at, so an m does not prove the marker
arrived. What that validator checks and what a failing configuration does is
the firmware page9.
A write that fails half way can be sent again: no file command waits on the configuration being valid, so a remote whose configuration was left erased or broken still answers every step of the sequence above, recovery10.
The firmware refuses no writable row of its file table. Fourteen rows allow writing, /fw/bootloader
and /fw/safemode in internal program flash among them, and an open for writing erases what it
opens: 64 KiB blocks of the external flash, or 1 KiB pages of the processor's own program flash for a file
kept there9. Whether the processor's own write protection would stop that is not
checked8. So a writer for this family opens /cfg/usercfg and nothing else.
What this library does with these models¶
The rows below describe this library's code, which is their evidence; the footnotes name the measurement each rests on.
| where | |
|---|---|
openHarmony refuses them: isHarmony excludes every id in FILE_BASED_PRODUCTS, and make remotes reports them separately1 |
packages/usb/src/transport.ts |
openFileBasedRemote reads them, allowing a bare ping, an open for reading, a read and a close, and only for the paths on INERT_PATHS, which include /cfg/usercfg5 |
packages/usb/src/filepipe.ts |
opening any other path needs HARMONY_FILE_PATH_EXPERIMENT=1, a door that exists because on this family a path can be an action: a Harmony Touch has names that act on an open for reading, its vibration test names /tde/haptic/diagnostic and /tde/haptic/calibrate5 |
packages/usb/src/filepipe.ts |
one write path, for /cfg/usercfg alone: writeFileConfig sends the client's seven steps, the end marker included, then reads the file back and compares it byte for byte. It refuses unless HARMONY_ENABLE_WRITES=1 and HARMONY_FILE_WRITE=1 are set, the remote states architecture 16, its /sys/guid matches the unit record the caller names, and the container passes the checks the firmware makes, no longer than the file's 256 KiB since the firmware bounds no write. Its own list, ARCHITECTURES_WITH_A_FILE_WRITE_TARGET; the command protocol's write lists do not name this architecture |
packages/usb/src/filewrite.ts, packages/usb/src/rails.ts |
the transport passes a write, check, flush, close, file system reset or reboot only when that path authorised exactly those bytes, both flags are set and the report is one the path sends; an open for writing names /cfg/usercfg or is refused |
packages/usb/src/filepipe.ts |
| a configuration is read this way off both models, the end marker appended, memory.md34 | packages/usb/src/filepipe.ts |
Not checked¶
- The unread files,
/sys/batteryand/cfg/logamong them, on these two models8. - The packet length these models use; it was 64 on a Harmony Touch only5.
- Anything on a unit about the write: every row of the table above is read in one firmware build, and no write, check, flush or reset has been sent to a remote8.
- What the check answers for the files whose routines were not read, the firmware images, the
bootloader and
/sys/sku8.
-
Measured on a unit. Section 193 ↩↩
-
Measured on a unit. Section 195 ↩↩
-
Measured on a unit. Section 262 ↩↩
-
Measured on a unit. Section 264 ↩↩
-
Measured on a unit. Section 200 ↩↩↩↩
-
Stated by Logitech, in their client. Section 198 ↩↩
-
Measured on a unit. Section 201 ↩