[PR #6850] Add support for DA2 and DA3 device attributes reports #26797

Open
opened 2026-01-31 09:18:12 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6850

State: closed
Merged: Yes


This PR adds support for the DA2 (Secondary Device Attributes) and
DA3 (Tertiary Device Attributes) escape sequences, which are standard
VT queries reporting basic information about the terminal.

The Secondary Device Attributes response is made up of a number of
parameters:

  1. An identification code, for which I've used 0 to indicate that we
    have the capabilities of a VT100 (using code 0 for this is an XTerm
    convention, since technically DA2 would not have been supported by a
    VT100).
  2. A firmware revision level, which some terminal emulators use to
    report their actual version number, but I thought it best we just
    hardcode a value of 10 (the DEC convention for 1.0).
  3. Additional hardware options, which tend to be device specific, but
    I've followed the convention of the later DEC terminals using 1 to
    indicate the presence of a PC keyboard.

The Tertiary Device Attributes response was originally used to provide
a unique terminal identification code, and which some terminal emulators
use as a way to identify themselves. However, I think that's information
we'd probably prefer not to reveal, so I've followed the more common
practice of returning all zeros for the ID.

In terms of implementation, the only complication was the need to add an
additional code path in the OutputStateMachine to handle the > and
= intermediates (technically private parameter prefixes) that these
sequences require. I've done this as a single method - rather than one
for each prefix - since I think that makes the code easier to follow.

VALIDATION

I've added output engine tests to make sure the sequences are dispatched
correctly, and adapter tests to confirm that they are returning the
responses we expect. I've also manually confirmed that they pass the
Test of terminal reports in Vttest.

Closes #5836

**Original Pull Request:** https://github.com/microsoft/terminal/pull/6850 **State:** closed **Merged:** Yes --- This PR adds support for the `DA2` (Secondary Device Attributes) and `DA3` (Tertiary Device Attributes) escape sequences, which are standard VT queries reporting basic information about the terminal. The _Secondary Device Attributes_ response is made up of a number of parameters: 1. An identification code, for which I've used 0 to indicate that we have the capabilities of a VT100 (using code 0 for this is an XTerm convention, since technically DA2 would not have been supported by a VT100). 2. A firmware revision level, which some terminal emulators use to report their actual version number, but I thought it best we just hardcode a value of 10 (the DEC convention for 1.0). 3. Additional hardware options, which tend to be device specific, but I've followed the convention of the later DEC terminals using 1 to indicate the presence of a PC keyboard. The _Tertiary Device Attributes_ response was originally used to provide a unique terminal identification code, and which some terminal emulators use as a way to identify themselves. However, I think that's information we'd probably prefer not to reveal, so I've followed the more common practice of returning all zeros for the ID. In terms of implementation, the only complication was the need to add an additional code path in the `OutputStateMachine` to handle the `>` and `=` intermediates (technically private parameter prefixes) that these sequences require. I've done this as a single method - rather than one for each prefix - since I think that makes the code easier to follow. VALIDATION ---------- I've added output engine tests to make sure the sequences are dispatched correctly, and adapter tests to confirm that they are returning the responses we expect. I've also manually confirmed that they pass the _Test of terminal reports_ in Vttest. Closes #5836
claunia added the pull-request label 2026-01-31 09:18:12 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26797