]> git.baikalelectronics.ru Git - kernel.git/commit
can: gs_usb: fix endianess problem with candleLight firmware
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 19 Nov 2020 13:03:17 +0000 (14:03 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 26 Nov 2020 10:50:32 +0000 (11:50 +0100)
commitf5508b183b9332546f29350cb517390ac2e6724a
tree60ff929eb6808ebaf7b739c685f9c87c1c58c11a
parentf6b51e4ffdfee7e0c56084afbcecfa5e0551bf36
can: gs_usb: fix endianess problem with candleLight firmware

The firmware on the original USB2CAN by Geschwister Schneider Technologie
Entwicklungs- und Vertriebs UG exchanges all data between the host and the
device in host byte order. This is done with the struct
gs_host_config::byte_order member, which is sent first to indicate the desired
byte order.

The widely used open source firmware candleLight doesn't support this feature
and exchanges the data in little endian byte order. This breaks if a device
with candleLight firmware is used on big endianess systems.

To fix this problem, all u32 (but not the struct gs_host_frame::echo_id, which
is a transparent cookie) are converted to __le32.

Cc: Maximilian Schneider <max@schneidersoft.net>
Cc: Hubert Denkmair <hubert@denkmair.de>
Reported-by: Michael Rausch <mr@netadair.de>
Link: https://lore.kernel.org/r/b58aace7-61f3-6df7-c6df-69fee2c66906@netadair.de
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Fixes: f619109f865f ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/r/20201120103818.3386964-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c