skip can_read logic if empty
This commit is contained in:
parent
b4b748c042
commit
b4dfc516fa
@ -118,6 +118,8 @@ void read_can(Tel *t, int soc) {
|
|||||||
struct can_frame frame;
|
struct can_frame frame;
|
||||||
int nbytes = read(soc, &frame, sizeof(struct can_frame));
|
int nbytes = read(soc, &frame, sizeof(struct can_frame));
|
||||||
|
|
||||||
|
if (nbytes < 0) return; // -1 EAGAIN means empty
|
||||||
|
|
||||||
if (nbytes > 0) {
|
if (nbytes > 0) {
|
||||||
|
|
||||||
switch (frame.can_id) {
|
switch (frame.can_id) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user