Created on 2019-05-29 06:53 by karlding, last changed 2019-07-31 12:04 by taleinat. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13646 | merged | karlding, 2019-05-29 07:25 | |
| PR 15049 | merged | miss-islington, 2019-07-31 08:47 | |
| Messages (4) | |||
|---|---|---|---|
| msg343865 - (view) | Author: Karl Ding (karlding) * | Date: 2019-05-29 06:53 | |
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
|
|||
| msg348792 - (view) | Author: Łukasz Langa (lukasz.langa) * | Date: 2019-07-31 08:47 | |
New changeset 31c4fd2a10d90beaa37d630e5f74a471e14e089d by Łukasz Langa (karl ding) in branch 'master': bpo-37085: Expose SocketCAN bcm_msg_head flags (#13646) https://github.com/python/cpython/commit/31c4fd2a10d90beaa37d630e5f74a471e14e089d |
|||
| msg348793 - (view) | Author: miss-islington (miss-islington) | Date: 2019-07-31 09:10 | |
New changeset d8b914a30b0849476345a19ce0a0ab1ade171b19 by Miss Islington (bot) in branch '3.8': bpo-37085: Expose SocketCAN bcm_msg_head flags (GH-13646) https://github.com/python/cpython/commit/d8b914a30b0849476345a19ce0a0ab1ade171b19 |
|||
| msg348799 - (view) | Author: Tal Einat (taleinat) * | Date: 2019-07-31 12:04 | |
Karl, many thanks for bringing this up, making a PR and iterating on it with me! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-07-31 12:04:47 | taleinat | set | status: open -> closed versions:
+ Python 3.9 messages:
+ msg348799 |
| 2019-07-31 09:10:43 | miss-islington | set | nosy:
+ miss-islington messages: + msg348793 |
| 2019-07-31 08:47:39 | lukasz.langa | set | nosy:
+ lukasz.langa messages: + msg348792 |
| 2019-07-31 08:47:35 | miss-islington | set | pull_requests: + pull_request14800 |
| 2019-05-29 07:25:54 | karlding | set | keywords:
+ patch stage: patch review pull_requests: + pull_request13541 |
| 2019-05-29 06:53:00 | karlding | create | |