Skip to content

Commit 25f5bf3

Browse files
committed
Adding basic pixelSetting and pixelSet protos
1 parent 9eee16d commit 25f5bf3

File tree

4 files changed

+99
-3
lines changed

4 files changed

+99
-3
lines changed

hid-io-protocol/src/commands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ pub mod h0021 {
464464
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
465465
pub enum Command {
466466
Control = 0x0001,
467-
ResetController = 0x0002,
467+
Reset = 0x0002,
468468
Clear = 0x0003,
469-
NextFrame = 0x0004,
469+
Frame = 0x0004,
470470
InvalidCommand = 0xFFFF,
471471
}
472472

python/hidiocore/schema/hidio.capnp

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,94 @@ interface Node extends(Common.Node) {
226226
}
227227
}
228228

229+
struct PixelSet {
230+
enum Type {
231+
directSet @0;
232+
}
233+
234+
type @0 :Type;
235+
startAddress @1 :UInt16;
236+
directSetData @2 :Data;
237+
}
238+
239+
struct PixelSetStatus {
240+
struct Success {}
241+
struct Error {}
242+
243+
union {
244+
success @0 :Success;
245+
error @1 :Error;
246+
}
247+
}
248+
249+
struct PixelSetting {
250+
enum Command {
251+
control @0;
252+
# General LED control commands
253+
254+
reset @1;
255+
# LED controller reset modes
256+
257+
clear @2;
258+
# Frame clearing commands
259+
260+
frame @3;
261+
# Frame control commands
262+
}
263+
264+
enum ControlArg {
265+
disable @0;
266+
# Disable HID-IO LED controller
267+
# This will usually give LED control back to the device and may disable the LEDs for some
268+
# devices
269+
270+
enableStart @1;
271+
# Enables LED frame display in free running mode
272+
273+
enablePause @2;
274+
# Enable LED frame display, frame: nextFrame must be called to iterate to the next frame.
275+
}
276+
277+
enum ResetArg {
278+
softReset @0;
279+
# Clear current pixel frame and any settings
280+
281+
hardReset @1;
282+
# Initiate a hard reset of the LED controller and initialize
283+
# default settings
284+
}
285+
286+
enum ClearArg {
287+
clear @0;
288+
# Clear current pixel frame
289+
# Will need to iterate to the next frame if using EnablePause
290+
}
291+
292+
enum FrameArg {
293+
nextFrame @0;
294+
# Iterate to next pixel buffer frame if using EnablePause
295+
}
296+
297+
command @0 :Command;
298+
299+
union {
300+
control @1 :ControlArg;
301+
reset @2 :ResetArg;
302+
clear @3 :ClearArg;
303+
frame @4 :FrameArg;
304+
}
305+
}
306+
307+
struct PixelSettingStatus {
308+
struct Success {}
309+
struct Error {}
310+
311+
union {
312+
success @0 :Success;
313+
error @1 :Error;
314+
}
315+
}
316+
229317
struct Info {
230318
# Result of an info command
231319

@@ -292,4 +380,11 @@ interface Node extends(Common.Node) {
292380
# Send an arbitrary piece of data to device as a test command
293381
# Will Ack piece of data back if successful
294382
# Must have full auth-level to use
383+
384+
pixelSetting @7 (command :PixelSetting) -> (status :PixelSettingStatus);
385+
# Configures LED settings
386+
# See pixelSet for updating specific LED channels
387+
388+
pixelSet @8 (data :PixelSet) -> (status :PixelSetStatus);
389+
# Sets specific LED channels
295390
}

python/hidiocore/schema/keyboard.capnp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ interface Keyboard extends(HidIo.Node) {
149149
# Called whenever a subscribed packet type (to this device) is available
150150
}
151151

152+
152153
subscribe @0 (subscriber :Subscriber, options :List(SubscriptionOption)) -> (subscription :Subscription);
153154
# Subscribes to a Subscriber interface
154155
# Registers push notifications for this node, the packets received will depend on the SubscriptionOption list

src/module/vhid/uhid/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ pub fn udev_find_device(
665665
// Setup poll
666666
let result = unsafe {
667667
ppoll(
668-
(&mut fds[..]).as_mut_ptr(),
668+
fds[..].as_mut_ptr(),
669669
fds.len() as nfds_t,
670670
&mut ptimeout,
671671
std::ptr::null(),

0 commit comments

Comments
 (0)