From cf112ef561151c848cbf59890e0c127a60ddf674 Mon Sep 17 00:00:00 2001 From: saji Date: Thu, 7 Mar 2024 15:06:16 -0600 Subject: [PATCH] fix socketcan bugs --- socketcan/socketcan.go | 2 ++ socketcan/socketcan_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/socketcan/socketcan.go b/socketcan/socketcan.go index f3973af..246e967 100644 --- a/socketcan/socketcan.go +++ b/socketcan/socketcan.go @@ -144,6 +144,8 @@ func (sck *CanSocket) Send(msg *can.Frame) error { idToWrite |= unix.CAN_RTR_FLAG case can.CanErrFrame: return errors.New("you can't send error frames") + case can.CanDataFrame: + default: return errors.New("unknown frame type") } diff --git a/socketcan/socketcan_test.go b/socketcan/socketcan_test.go index 94b1dea..df585ee 100644 --- a/socketcan/socketcan_test.go +++ b/socketcan/socketcan_test.go @@ -51,7 +51,7 @@ func TestCanSocket(t *testing.T) { err := sock.Send(testFrame) if err != nil { - t.Error(err) + t.Fatal(err) } })