From 98ea11ed412de27d2f64fa151c670fd5808816e5 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 22 Apr 2024 12:54:48 +0100 Subject: [PATCH] Linux rc6_0 protocol have 43 edges A similar patch has been submitted for ir-ctl in v4l-utils. Signed-off-by: Sean Young --- liblircd/src/ir-encode.c | 2 +- src/linux_protocol.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/liblircd/src/ir-encode.c b/liblircd/src/ir-encode.c index a088a7e..f76d5e5 100644 --- a/liblircd/src/ir-encode.c +++ b/liblircd/src/ir-encode.c @@ -390,7 +390,7 @@ static const struct { [RC_PROTO_NECX] = { "necx", 0xffffff, 67, 38000, nec_encode }, [RC_PROTO_NEC32] = { "nec32", 0xffffffff, 67, 38000, nec_encode }, [RC_PROTO_SANYO] = { "sanyo", 0x1fffff, 87, 38000, sanyo_encode }, - [RC_PROTO_RC6_0] = { "rc6_0", 0xffff, 41, 36000, rc6_encode }, + [RC_PROTO_RC6_0] = { "rc6_0", 0xffff, 43, 36000, rc6_encode }, [RC_PROTO_RC6_6A_20] = { "rc6_6a_20", 0xfffff, 52, 36000, rc6_encode }, [RC_PROTO_RC6_6A_24] = { "rc6_6a_24", 0xffffff, 60, 36000, rc6_encode }, [RC_PROTO_RC6_6A_32] = { "rc6_6a_32", 0xffffffff, 76, 36000, rc6_encode }, diff --git a/src/linux_protocol.rs b/src/linux_protocol.rs index ff627c3..87c29be 100644 --- a/src/linux_protocol.rs +++ b/src/linux_protocol.rs @@ -289,13 +289,16 @@ mod test { for _ in 0..1000 { let scancode = rng.next_u32() & linux.scancode_mask; - println!("proto: {proto:?} scancode:{scancode:#x}"); - irctl.resize(max_size as usize, 0); let len = unsafe { liblircd::protocol_encode(proto, scancode, irctl.as_mut_ptr()) }; + assert!( + len as usize <= max_size, + "{len} {max_size} proto:{proto:?} scancode:{scancode:#x}" + ); + irctl.resize(len as usize, 0); let mut vars = Vartable::new();