Move DeviceType to first position in GetIdentification

This commit is contained in:
daylily
2026-01-10 01:38:54 +08:00
parent 18f97c820a
commit 0333c4033e
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -24,6 +24,10 @@ enum Chroma {
Black,
}
// GetIdentification is always `0x00`, and the device should always return a response starting with
// the two-byte sequence `0x00 [DeviceType]`. Theoretically this leaves space for different devices
// to adopt different schemas (although we hope to only use this as a last resort).
#[derive(Deserialize)]
enum Request<'a> {
GetIdentification,
@@ -38,7 +42,7 @@ enum Request<'a> {
#[derive(Serialize)]
enum Response<'a> {
GetIdentification { serial: &'a str, model: DeviceType },
GetIdentification { model: DeviceType, serial: &'a str },
UpdateDisplay,
SetPattern,
}
+1 -1
View File
@@ -26,8 +26,8 @@ const requestSchema = p.enumType('Request', {
export type Response = p.InferType<typeof responseSchema>
const responseSchema = p.enumType('Response', {
GetIdentification: p.structVariant('GetIdentification', {
serial: p.string(),
model: deviceTypeSchema,
serial: p.string(),
}),
UpdateDisplay: p.unitVariant('UpdateDisplay'),
SetPattern: p.unitVariant('SetPattern'),