python Programming Glossary: smb_request
Python & Ctypes: Passing a struct to a function as a pointer to get back data http://stackoverflow.com/questions/4351721/python-ctypes-passing-a-struct-to-a-function-as-a-pointer-to-get-back-data an array as one of it's fields. so... In C typedef struct _SMB_REQUEST unsigned char Address unsigned char Command unsigned char BlockLength.. char BlockLength unsigned char Data SMB_MAX_DATA_SIZE SMB_REQUEST I think I have to set values for the Address Command and BlockLength.. a pointer SMBUS_API int SmBusReadByte SMBUS_HANDLE handle SMB_REQUEST request So I've set up the struct in Python like so class SMB_REQUEST..
Python & Ctypes: Passing a struct to a function as a pointer to get back data http://stackoverflow.com/questions/4351721/python-ctypes-passing-a-struct-to-a-function-as-a-pointer-to-get-back-data as follows data create_string_buffer SMB_MAX_DATA_SIZE smb_request SMB_REQUEST ' x53' x00' 1 data This responds with TypeError.. found If I try leaving out the data array like so smb_request SMB_REQUEST ' x53' x00' 1 No error. However then when I try.. to the function int_response smbus_read_byte smbus_handle smb_request I get ArgumentError argument 2 type 'exceptions.TypeError' expected..
|