mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-22 21:26:59 +08:00
75 lines
2.2 KiB
Diff
75 lines
2.2 KiB
Diff
--- a/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp
|
|
+++ b/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp
|
|
@@ -33,7 +33,6 @@
|
|
** $QT_END_LICENSE$
|
|
**
|
|
****************************************************************************/
|
|
-
|
|
#include "socketcanbackend.h"
|
|
|
|
#include <QtCore/qdatastream.h>
|
|
@@ -50,29 +49,7 @@
|
|
#include <sys/ioctl.h>
|
|
#include <sys/time.h>
|
|
|
|
-#ifndef CANFD_MTU
|
|
-// CAN FD support was added by Linux kernel 3.6
|
|
-// For prior kernels we redefine the missing defines here
|
|
-// they are taken from linux/can/raw.h & linux/can.h
|
|
-
|
|
-enum {
|
|
- CAN_RAW_FD_FRAMES = 5
|
|
-};
|
|
-
|
|
-#define CAN_MAX_DLEN 8
|
|
-#define CANFD_MAX_DLEN 64
|
|
-struct canfd_frame {
|
|
- canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
|
|
- __u8 len; /* frame payload length in byte */
|
|
- __u8 flags; /* additional flags for CAN FD */
|
|
- __u8 __res0; /* reserved / padding */
|
|
- __u8 __res1; /* reserved / padding */
|
|
- __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8)));
|
|
-};
|
|
-#define CAN_MTU (sizeof(struct can_frame))
|
|
-#define CANFD_MTU (sizeof(struct canfd_frame))
|
|
|
|
-#endif
|
|
|
|
#ifndef CANFD_BRS
|
|
# define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
|
|
--- a/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.h
|
|
+++ b/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.h
|
|
@@ -45,6 +45,31 @@
|
|
#include <QtCore/qstring.h>
|
|
#include <QtCore/qvariant.h>
|
|
|
|
+#ifndef CANFD_MTU
|
|
+// CAN FD support was added by Linux kernel 3.6
|
|
+// For prior kernels we redefine the missing defines here
|
|
+// they are taken from linux/can/raw.h & linux/can.h
|
|
+
|
|
+enum {
|
|
+ CAN_RAW_FD_FRAMES = 5
|
|
+};
|
|
+
|
|
+#define CAN_MAX_DLEN 8
|
|
+#define CANFD_MAX_DLEN 64
|
|
+struct canfd_frame {
|
|
+ canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
|
|
+ __u8 len; /* frame payload length in byte */
|
|
+ __u8 flags; /* additional flags for CAN FD */
|
|
+ __u8 __res0; /* reserved / padding */
|
|
+ __u8 __res1; /* reserved / padding */
|
|
+ __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8)));
|
|
+};
|
|
+#define CAN_MTU (sizeof(struct can_frame))
|
|
+#define CANFD_MTU (sizeof(struct canfd_frame))
|
|
+
|
|
+#endif
|
|
+
|
|
+
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class SocketCanBackend : public QCanBusDevice
|