New submission from Karl Ding <karl.jw.d...@gmail.com>:
When reading through the values exposed via the socket library, I noticed that currently, only the SocketCAN BCM opcode enums are exposed via the socket constants. These correspond to the following from the Linux headers: enum { TX_SETUP = 1, /* create (cyclic) transmission task */ TX_DELETE, /* remove (cyclic) transmission task */ TX_READ, /* read properties of (cyclic) transmission task */ TX_SEND, /* send one CAN frame */ RX_SETUP, /* create RX content filter subscription */ RX_DELETE, /* remove RX content filter subscription */ RX_READ, /* read properties of RX content filter subscription */ TX_STATUS, /* reply to TX_READ request */ TX_EXPIRED, /* notification on performed transmissions (count=0) */ RX_STATUS, /* reply to RX_READ request */ RX_TIMEOUT, /* cyclic message is absent */ RX_CHANGED /* updated CAN frame (detected content change) */ }; It would be nice to expose the BCM flags #defines as well. #define SETTIMER 0x0001 #define STARTTIMER 0x0002 #define TX_COUNTEVT 0x0004 #define TX_ANNOUNCE 0x0008 #define TX_CP_CAN_ID 0x0010 #define RX_FILTER_ID 0x0020 #define RX_CHECK_DLC 0x0040 #define RX_NO_AUTOTIMER 0x0080 #define RX_ANNOUNCE_RESUME 0x0100 #define TX_RESET_MULTI_IDX 0x0200 #define RX_RTR_FRAME 0x0400 #define CAN_FD_FRAME 0x0800 These BCM flags are used as part of the BCM header that has the aforementioned opcodes. The flags are set on the bcm_msg_head struct: struct bcm_msg_head { __u32 opcode; __u32 flags; __u32 count; struct bcm_timeval ival1, ival2; canid_t can_id; __u32 nframes; struct can_frame frames[0]; }; The existing documentation for the BCM constants (https://docs.python.org/3/library/socket.html#socket.CAN_BCM) seems to imply that these constants should already be included, but they are not. See the Linux headers for more details: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/can/bcm.h ---------- components: Library (Lib) messages: 343865 nosy: karlding priority: normal severity: normal status: open title: Expose additional socket constants for CAN_BCM flags type: enhancement versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37085> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com