als fehler sagt er mir, dass 16 bytes fuer die funktion IowReadResult24 fehlen
ein paar C grundkentnisse wuerden nicht schaden....
Code: Alles auswählen
import ctypes
iowkit = ctypes.cdll.LoadLibrary(os.path.join(os.path.split(__file__)[0], "iowkit.dll"))
#typedef DWORD HANDLE;
#typedef struct _IOWKIT24_IO_REPORT
# {
# UCHAR ReportID;
# union
# {
# WORD Value;
# BYTE Bytes[2];
# };
# }
#IOWKIT24_IO_REPORT, *PIOWKIT24_IO_REPORT;
#
#ULONG IOWKIT_API IowKitRead(IOWKIT_HANDLE devHandle, ULONG numPipe,
# PCHAR buffer, ULONG length);
class IowReadResult24(ctypes.Structure):
_fields_ = [("ReportId", ctypes.c_ubyte),
("IowReadResult", ctypes.c_ubyte*63 ),
("Value", ctypes.c_void_p)]
handle = iowkit.IowKitOpenDevice()
if handle == 0:
print "nicht angeschlossen"
print "handle:", handle
datac = IowReadResult24()
written = iowkit.IowKitRead(ctypes.c_void_p(handle), ctypes.c_ulong(1), ctypes.pointer(datac), ctypes.sizeof(IowReadResult24))
print datac