Skip to content

Message data #1

Description

@danielkucera

I'm trying to get message data but I'm getting segfaults:

        if (cmd == RES1):
            print("1 SPI_IOC_MESSAGE")
            print("struct addr", data)
            msg = spi_ioc_transfer.from_address(data)
            data_len = int(msg.len)
            tx_buf_add = int(msg.tx_buf)
            print("tx_buf addr", tx_buf_add)
            print("data_len", data_len)
            tx_buf = (ctypes.c_ubyte).from_address(tx_buf_add)
            print(tx_buf)
#            print(''.join([i for i in tx_buf]))
            return msg.len
        if (cmd == RES2):

results in:

DEBUG:fuse.log-mixin:-> ioctl / (1075866368L, 140722147878816, 1L, 0L, 139711975837784)
1075866368
1 SPI_IOC_MESSAGE
struct addr 139711975837784
tx_buf addr 140722147878848
data_len 38
Segmentation fault (core dumped)

data_len is correct but the tx_buf address is very strange.
Can you help?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions