Skip to content

Commit 81f0d69

Browse files
committed
Get Serial Number
1 parent 67c05a3 commit 81f0d69

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

comms.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ func (d *Device) SetBrightness(pct int) {
125125
}
126126

127127
preamble := d.deviceType.brightnessPacket
128-
payload := append(preamble, byte(pct))
129-
d.fd.SendFeatureReport(payload)
128+
//payload := append(preamble, byte(pct))
129+
d.fd.SendFeatureReport(preamble)
130130
}
131131

132132
// ClearButtons writes a black square to all buttons
@@ -137,6 +137,15 @@ func (d *Device) ClearButtons() {
137137
}
138138
}
139139

140+
// Display the Serial Number
141+
func (d *Device) SetSerial(b []byte) error {
142+
_, err := d.fd.Write(b)
143+
if err != nil {
144+
return err
145+
}
146+
return nil
147+
}
148+
140149
// WriteColorToButton writes a specified color to the given button
141150
func (d *Device) WriteColorToButton(btnIndex int, colour color.Color) error {
142151
img := getSolidColourImage(colour)

devices/mini.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ func init() {
5050
miniName, // Name
5151
image.Point{X: int(miniButtonWidth), Y: int(miniButtonHeight)}, // Width/height of a button
5252
0x63, // USB productID
53-
[]byte{'\x03', '\x02'}, // Reset packet
53+
[]byte{'\x03', '\x00', '\x42', '\x00', '\x4C', '\x00', '\x33', '\x00', '\x31', '\x00', '\x4A', '\x00', '\x31', '\x00', '\x42', '\x00', '\x30', '\x00', '\x31', '\x00', '\x35', '\x00', '\x38', '\x00', '\x32', '\x00'}, // Reset packet
5454
6, // Number of buttons
55-
[]byte{'\x03', '\x08'}, // Set brightness packet preamble
56-
4, // Button read offset
57-
"JPEG", // Image format
55+
//[]byte{'\x05', '\x55', '\xaa', '\xd1', '\x01'}, // Set brightness packet preamble
56+
[]byte{'\x03', '\x00', '\x42', '\x00', '\x4C', '\x00', '\x33', '\x00', '\x31', '\x00', '\x4A', '\x00', '\x31', '\x00', '\x42', '\x00', '\x30', '\x00', '\x31', '\x00', '\x35', '\x00', '\x38', '\x00', '\x32', '\x00'}, // Reset packet
57+
0, // Button read offset
58+
"BMP", // Image format
5859
miniImageReportPayloadLength, // Amount of image payload allowed per USB packet
5960
GetImageHeaderMini, // Function to get the comms image header
6061
)

streamdeck.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,7 @@ func (sd *StreamDeck) updateButton(b Button) error {
118118
func (sd *StreamDeck) SetBrightness(brightness int) {
119119
sd.dev.SetBrightness(brightness)
120120
}
121+
122+
func (sd *StreamDeck) SetSerial(b []byte) error {
123+
return sd.dev.SetSerial(b)
124+
}

0 commit comments

Comments
 (0)