socketcan: support newer kernels with renamed macro (#765)

This commit is contained in:
Adeeb Shihadeh 2021-11-04 15:01:12 -07:00 committed by GitHub
parent e9a4a2b688
commit bb5e2ccd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -15,6 +15,5 @@ jobs:
run: |
cd drivers/linux
make link
make all
make build
make install

View File

@ -17,6 +17,7 @@
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/netdevice.h>
#include <linux/usb.h>
#include <linux/version.h>
/* vendor and product id */
#define PANDA_MODULE_NAME "panda"
@ -283,7 +284,11 @@ static void panda_usb_process_can_rx(struct panda_dev_priv *priv_dev,
//if (msg->dlc & MCBA_DLC_RTR_MASK)
// cf->can_id |= CAN_RTR_FLAG;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
cf->can_dlc = get_can_dlc(msg->bus_dat_len & PANDA_DLC_MASK);
#else
cf->can_dlc = can_cc_dlc2len(msg->bus_dat_len & PANDA_DLC_MASK);
#endif
memcpy(cf->data, msg->data, cf->can_dlc);