Skip to content

Commit

Permalink
use uint32_t for CAN IDs #12
Browse files Browse the repository at this point in the history
  • Loading branch information
driftregion committed Mar 9, 2023
1 parent d2ad739 commit 28a3b54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions iso14229.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static ssize_t tp_send(struct UDSTpHandle *hdl, const void *buf, size_t count,
#endif

#if UDS_TP == UDS_TP_LINUX_SOCKET
static int LinuxSockBind(const char *if_name, uint16_t rxid, uint16_t txid) {
static int LinuxSockBind(const char *if_name, uint32_t rxid, uint32_t txid) {
int fd = 0;
if ((fd = socket(AF_CAN, SOCK_DGRAM | SOCK_NONBLOCK, CAN_ISOTP)) < 0) {
perror("Socket");
Expand Down Expand Up @@ -232,7 +232,7 @@ static int LinuxSockBind(const char *if_name, uint16_t rxid, uint16_t txid) {
}

static int LinuxSockTpOpen(UDSTpHandle_t *hdl, const char *if_name, uint16_t phys_rxid,

This comment has been minimized.

Copy link
@muehlke

muehlke Mar 9, 2023

phys_rxid and phys_txid should also be uint32_t

uint16_t phys_txid, uint16_t func_rxid, uint16_t func_txid) {

This comment has been minimized.

Copy link
@muehlke

muehlke Mar 9, 2023

phys_rxid and phys_txid should also be uint32_t

uint16_t phys_txid, uint32_t func_rxid, uint32_t func_txid) {
assert(if_name);
UDSTpLinuxIsoTp_t *impl = (UDSTpLinuxIsoTp_t *)hdl->impl;
hdl->recv = tp_recv;
Expand Down
24 changes: 12 additions & 12 deletions iso14229.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,14 @@ typedef struct {
#if UDS_TP == UDS_TP_CUSTOM
UDSTpHandle_t *tp;
#elif UDS_TP == UDS_TP_ISOTP_C
uint16_t phys_recv_id;
uint16_t phys_send_id;
uint16_t func_send_id;
uint32_t phys_recv_id;
uint32_t phys_send_id;
uint32_t func_send_id;
#elif UDS_TP == UDS_TP_LINUX_SOCKET
const char *if_name;
uint16_t phys_recv_id;
uint16_t phys_send_id;
uint16_t func_send_id;
uint32_t phys_recv_id;
uint32_t phys_send_id;
uint32_t func_send_id;
#else
#error "transport undefined"
#endif
Expand Down Expand Up @@ -651,14 +651,14 @@ typedef struct {
#if UDS_TP == UDS_TP_CUSTOM
UDSTpHandle_t *tp;
#elif UDS_TP == UDS_TP_ISOTP_C
uint16_t phys_send_id;
uint16_t phys_recv_id;
uint16_t func_recv_id;
uint32_t phys_send_id;
uint32_t phys_recv_id;
uint32_t func_recv_id;
#elif UDS_TP == UDS_TP_LINUX_SOCKET
const char *if_name;
uint16_t phys_send_id;
uint16_t phys_recv_id;
uint16_t func_recv_id;
uint32_t phys_send_id;
uint32_t phys_recv_id;
uint32_t func_recv_id;
#else
#error "transport undefined"
#endif
Expand Down

1 comment on commit 28a3b54

@muehlke
Copy link

@muehlke muehlke commented on 28a3b54 Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phys_rxid and phys_txid from LinuxSockTpOpen() should also be uint32_t

Please sign in to comment.