Daten an USBport senden

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
INFACT
User
Beiträge: 385
Registriert: Freitag 5. Dezember 2008, 16:08

Hi,

Ich habe vor meinen (kapputten) Usb stick zu (zer)hacken. Ich wollte so eine kleine wippe Bauen, die sich bewegt. Ich habe schon dieses Vordere ding abgenommen, dass man in ein Usbport steckt. Ich kann auch eine LED an die Energiepole halten, und damit die LED zum leuchten bringen. Die Mittleren beiden "kabel" an dem USB ding sind zur datenübertragung. Wie kann ich denn etwas an einen usbport senden (das geht doch in python oder [mit ctypes])? Ich stelle mir das so vor wie Sockets. Dass man daten sendet und empfängt. Geht das irgentwie? Und bekomme ich irgentwo eine kleine liste von standard befehlen, wie zb. listdir für einen USB stick, her?

MfG Robin
[b][i]ein kleines game für die die lust haben http://konaminut.mybrute.com[/i][/b]
;-)
Benutzeravatar
HWK
User
Beiträge: 1295
Registriert: Mittwoch 7. Juni 2006, 20:44

INFACT
User
Beiträge: 385
Registriert: Freitag 5. Dezember 2008, 16:08

oha, habe nicht gedacht dass es sowas gibt.
Danke!
[b][i]ein kleines game für die die lust haben http://konaminut.mybrute.com[/i][/b]
;-)
INFACT
User
Beiträge: 385
Registriert: Freitag 5. Dezember 2008, 16:08

Ich habe mir das jetzt auf windows 7 (py2.6) installiert.
Ich wollte das Beispiel machen aber jetzt kommt immer der Fehler:

Code: Alles auswählen

>>> import usb.core

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import usb.core
ImportError: DLL load failed: The specified module could not be found.
Edit: Ich habe es gerade auch auf linux probiert:
/pyusb-0.4.2$ python setup.py install
running install
running build
running build_ext
building 'usb' extension
creating build
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pyusb.c -o build/temp.linux-i686-2.6/pyusb.o
In file included from pyusb.c:11:
pyusb.h:6:17: error: usb.h: No such file or directory
In file included from pyusb.c:11:
pyusb.h:121: error: expected specifier-qualifier-list before ‘usb_dev_handle’
pyusb.h:132: warning: ‘struct usb_endpoint_descriptor’ declared inside parameter list
pyusb.h:132: warning: its scope is only this definition or declaration, which is probably not what you want
pyusb.h:136: warning: ‘struct usb_endpoint_descriptor’ declared inside parameter list
pyusb.h:141: warning: ‘struct usb_interface_descriptor’ declared inside parameter list
pyusb.h:145: warning: ‘struct usb_interface_descriptor’ declared inside parameter list
pyusb.h:150: warning: ‘struct usb_config_descriptor’ declared inside parameter list
pyusb.h:154: warning: ‘struct usb_config_descriptor’ declared inside parameter list
pyusb.h:172: warning: ‘struct usb_bus’ declared inside parameter list
pyusb.c: In function ‘PyUSB_Error’:
pyusb.c:37: warning: implicit declaration of function ‘usb_strerror’
pyusb.c:37: warning: initialization makes pointer from integer without a cast
pyusb.c: In function ‘installModuleConstants’:
pyusb.c:248: error: ‘USB_CLASS_PER_INTERFACE’ undeclared (first use in this function)
pyusb.c:248: error: (Each undeclared identifier is reported only once
pyusb.c:248: error: for each function it appears in.)
pyusb.c:249: error: ‘USB_CLASS_AUDIO’ undeclared (first use in this function)
pyusb.c:250: error: ‘USB_CLASS_COMM’ undeclared (first use in this function)
pyusb.c:251: error: ‘USB_CLASS_HID’ undeclared (first use in this function)
pyusb.c:252: error: ‘USB_CLASS_PRINTER’ undeclared (first use in this function)
pyusb.c:253: error: ‘USB_CLASS_MASS_STORAGE’ undeclared (first use in this function)
pyusb.c:254: error: ‘USB_CLASS_HUB’ undeclared (first use in this function)
pyusb.c:255: error: ‘USB_CLASS_DATA’ undeclared (first use in this function)
pyusb.c:256: error: ‘USB_CLASS_VENDOR_SPEC’ undeclared (first use in this function)
pyusb.c:257: error: ‘USB_DT_DEVICE’ undeclared (first use in this function)
pyusb.c:258: error: ‘USB_DT_CONFIG’ undeclared (first use in this function)
pyusb.c:259: error: ‘USB_DT_STRING’ undeclared (first use in this function)
pyusb.c:260: error: ‘USB_DT_INTERFACE’ undeclared (first use in this function)
pyusb.c:261: error: ‘USB_DT_ENDPOINT’ undeclared (first use in this function)
pyusb.c:262: error: ‘USB_DT_HID’ undeclared (first use in this function)
pyusb.c:263: error: ‘USB_DT_REPORT’ undeclared (first use in this function)
pyusb.c:264: error: ‘USB_DT_PHYSICAL’ undeclared (first use in this function)
pyusb.c:265: error: ‘USB_DT_HUB’ undeclared (first use in this function)
pyusb.c:266: error: ‘USB_DT_DEVICE_SIZE’ undeclared (first use in this function)
pyusb.c:267: error: ‘USB_DT_CONFIG_SIZE’ undeclared (first use in this function)
pyusb.c:268: error: ‘USB_DT_INTERFACE_SIZE’ undeclared (first use in this function)
pyusb.c:269: error: ‘USB_DT_ENDPOINT_SIZE’ undeclared (first use in this function)
pyusb.c:270: error: ‘USB_DT_ENDPOINT_AUDIO_SIZE’ undeclared (first use in this function)
pyusb.c:271: error: ‘USB_DT_HUB_NONVAR_SIZE’ undeclared (first use in this function)
pyusb.c:272: error: ‘USB_MAXENDPOINTS’ undeclared (first use in this function)
pyusb.c:273: error: ‘USB_ENDPOINT_ADDRESS_MASK’ undeclared (first use in this function)
pyusb.c:274: error: ‘USB_ENDPOINT_DIR_MASK’ undeclared (first use in this function)
pyusb.c:275: error: ‘USB_ENDPOINT_TYPE_MASK’ undeclared (first use in this function)
pyusb.c:276: error: ‘USB_ENDPOINT_TYPE_CONTROL’ undeclared (first use in this function)
pyusb.c:277: error: ‘USB_ENDPOINT_TYPE_ISOCHRONOUS’ undeclared (first use in this function)
pyusb.c:278: error: ‘USB_ENDPOINT_TYPE_BULK’ undeclared (first use in this function)
pyusb.c:279: error: ‘USB_ENDPOINT_TYPE_INTERRUPT’ undeclared (first use in this function)
pyusb.c:280: error: ‘USB_MAXINTERFACES’ undeclared (first use in this function)
pyusb.c:281: error: ‘USB_MAXALTSETTING’ undeclared (first use in this function)
pyusb.c:282: error: ‘USB_MAXCONFIG’ undeclared (first use in this function)
pyusb.c:283: error: ‘USB_REQ_GET_STATUS’ undeclared (first use in this function)
pyusb.c:284: error: ‘USB_REQ_CLEAR_FEATURE’ undeclared (first use in this function)
pyusb.c:285: error: ‘USB_REQ_SET_FEATURE’ undeclared (first use in this function)
pyusb.c:286: error: ‘USB_REQ_SET_ADDRESS’ undeclared (first use in this function)
pyusb.c:287: error: ‘USB_REQ_GET_DESCRIPTOR’ undeclared (first use in this function)
pyusb.c:288: error: ‘USB_REQ_SET_DESCRIPTOR’ undeclared (first use in this function)
pyusb.c:289: error: ‘USB_REQ_GET_CONFIGURATION’ undeclared (first use in this function)
pyusb.c:290: error: ‘USB_REQ_SET_CONFIGURATION’ undeclared (first use in this function)
pyusb.c:291: error: ‘USB_REQ_GET_INTERFACE’ undeclared (first use in this function)
pyusb.c:292: error: ‘USB_REQ_SET_INTERFACE’ undeclared (first use in this function)
pyusb.c:293: error: ‘USB_REQ_SYNCH_FRAME’ undeclared (first use in this function)
pyusb.c:294: error: ‘USB_TYPE_STANDARD’ undeclared (first use in this function)
pyusb.c:295: error: ‘USB_TYPE_CLASS’ undeclared (first use in this function)
pyusb.c:296: error: ‘USB_TYPE_VENDOR’ undeclared (first use in this function)
pyusb.c:297: error: ‘USB_TYPE_RESERVED’ undeclared (first use in this function)
pyusb.c:298: error: ‘USB_RECIP_DEVICE’ undeclared (first use in this function)
pyusb.c:299: error: ‘USB_RECIP_INTERFACE’ undeclared (first use in this function)
pyusb.c:300: error: ‘USB_RECIP_ENDPOINT’ undeclared (first use in this function)
pyusb.c:301: error: ‘USB_RECIP_OTHER’ undeclared (first use in this function)
pyusb.c:302: error: ‘USB_ENDPOINT_IN’ undeclared (first use in this function)
pyusb.c:303: error: ‘USB_ENDPOINT_OUT’ undeclared (first use in this function)
pyusb.c:304: error: ‘USB_ERROR_BEGIN’ undeclared (first use in this function)
pyusb.c: At top level:
pyusb.c:407: warning: ‘struct usb_endpoint_descriptor’ declared inside parameter list
pyusb.c:404: error: conflicting types for ‘set_Endpoint_fields’
pyusb.h:129: note: previous declaration of ‘set_Endpoint_fields’ was here
pyusb.c: In function ‘set_Endpoint_fields’:
pyusb.c:409: error: dereferencing pointer to incomplete type
pyusb.c:410: error: dereferencing pointer to incomplete type
pyusb.c:411: error: dereferencing pointer to incomplete type
pyusb.c:412: error: dereferencing pointer to incomplete type
pyusb.c:413: error: dereferencing pointer to incomplete type
pyusb.c: At top level:
pyusb.c:419: warning: ‘struct usb_endpoint_descriptor’ declared inside parameter list
pyusb.c:417: error: conflicting types for ‘new_Endpoint’
pyusb.h:134: note: previous declaration of ‘new_Endpoint’ was here
pyusb.c: In function ‘new_Endpoint’:
pyusb.c:427: warning: passing argument 2 of ‘set_Endpoint_fields’ from incompatible pointer type
pyusb.c:404: note: expected ‘struct usb_endpoint_descriptor *’ but argument is of type ‘struct usb_endpoint_descriptor *’
pyusb.c: At top level:
pyusb.c:547: warning: ‘struct usb_interface_descriptor’ declared inside parameter list
pyusb.c:544: error: conflicting types for ‘set_Interface_fields’
pyusb.h:138: note: previous declaration of ‘set_Interface_fields’ was here
pyusb.c: In function ‘set_Interface_fields’:
pyusb.c:551: error: dereferencing pointer to incomplete type
pyusb.c:552: error: dereferencing pointer to incomplete type
pyusb.c:553: error: dereferencing pointer to incomplete type
pyusb.c:554: error: dereferencing pointer to incomplete type
pyusb.c:555: error: dereferencing pointer to incomplete type
pyusb.c:556: error: dereferencing pointer to incomplete type
pyusb.c:558: error: dereferencing pointer to incomplete type
pyusb.c:564: error: dereferencing pointer to incomplete type
pyusb.c:565: error: dereferencing pointer to incomplete type
pyusb.c: At top level:
pyusb.c:571: warning: ‘struct usb_interface_descriptor’ declared inside parameter list
pyusb.c:569: error: conflicting types for ‘new_Interface’
pyusb.h:143: note: previous declaration of ‘new_Interface’ was here
pyusb.c: In function ‘new_Interface’:
pyusb.c:578: warning: passing argument 2 of ‘set_Interface_fields’ from incompatible pointer type
pyusb.c:544: note: expected ‘struct usb_interface_descriptor *’ but argument is of type ‘struct usb_interface_descriptor *’
pyusb.c: At top level:
pyusb.c:706: warning: ‘struct usb_config_descriptor’ declared inside parameter list
pyusb.c:703: error: conflicting types for ‘set_Configuration_fields’
pyusb.h:147: note: previous declaration of ‘set_Configuration_fields’ was here
pyusb.c: In function ‘set_Configuration_fields’:
pyusb.c:711: error: dereferencing pointer to incomplete type
pyusb.c:712: error: dereferencing pointer to incomplete type
pyusb.c:713: error: dereferencing pointer to incomplete type
pyusb.c:714: error: dereferencing pointer to incomplete type
pyusb.c:715: error: dereferencing pointer to incomplete type
pyusb.c:716: error: dereferencing pointer to incomplete type
pyusb.c:718: error: dereferencing pointer to incomplete type
pyusb.c:722: error: dereferencing pointer to incomplete type
pyusb.c:723: error: dereferencing pointer to incomplete type
pyusb.c:729: error: dereferencing pointer to incomplete type
pyusb.c: At top level:
pyusb.c:738: warning: ‘struct usb_config_descriptor’ declared inside parameter list
pyusb.c:736: error: conflicting types for ‘new_Configuration’
pyusb.h:152: note: previous declaration of ‘new_Configuration’ was here
pyusb.c: In function ‘new_Configuration’:
pyusb.c:745: warning: passing argument 2 of ‘set_Configuration_fields’ from incompatible pointer type
pyusb.c:703: note: expected ‘struct usb_config_descriptor *’ but argument is of type ‘struct usb_config_descriptor *’
pyusb.c: In function ‘set_Device_fields’:
pyusb.c:933: error: dereferencing pointer to incomplete type
pyusb.c:936: error: dereferencing pointer to incomplete type
pyusb.c:937: error: dereferencing pointer to incomplete type
pyusb.c:939: error: dereferencing pointer to incomplete type
pyusb.c:940: error: dereferencing pointer to incomplete type
pyusb.c:943: error: dereferencing pointer to incomplete type
pyusb.c:944: error: dereferencing pointer to incomplete type
pyusb.c:946: error: dereferencing pointer to incomplete type
pyusb.c:947: error: dereferencing pointer to incomplete type
pyusb.c:950: error: dereferencing pointer to incomplete type
pyusb.c:951: error: dereferencing pointer to incomplete type
pyusb.c:952: error: dereferencing pointer to incomplete type
pyusb.c:953: error: dereferencing pointer to incomplete type
pyusb.c:954: error: dereferencing pointer to incomplete type
pyusb.c:955: error: dereferencing pointer to incomplete type
pyusb.c:956: error: dereferencing pointer to incomplete type
pyusb.c:957: error: dereferencing pointer to incomplete type
pyusb.c:958: error: dereferencing pointer to incomplete type
pyusb.c:959: error: dereferencing pointer to incomplete type
pyusb.c:961: error: dereferencing pointer to incomplete type
pyusb.c:963: error: dereferencing pointer to incomplete type
pyusb.c:968: error: dereferencing pointer to incomplete type
pyusb.c:972: error: dereferencing pointer to incomplete type
pyusb.c:973: error: dereferencing pointer to incomplete type
pyusb.c: At top level:
pyusb.c:1082: warning: ‘struct usb_bus’ declared inside parameter list
pyusb.c:1080: error: conflicting types for ‘new_Bus’
pyusb.h:170: note: previous declaration of ‘new_Bus’ was here
pyusb.c: In function ‘new_Bus’:
pyusb.c:1091: error: dereferencing pointer to incomplete type
pyusb.c:1092: error: dereferencing pointer to incomplete type
pyusb.c:1093: error: dereferencing pointer to incomplete type
pyusb.c:1093: warning: left-hand operand of comma expression has no effect
pyusb.c:1093: warning: value computed is not used
pyusb.c:1093: error: dereferencing pointer to incomplete type
pyusb.c:1101: error: dereferencing pointer to incomplete type
pyusb.c:1101: warning: left-hand operand of comma expression has no effect
pyusb.c:1101: warning: value computed is not used
pyusb.c:1101: error: dereferencing pointer to incomplete type
pyusb.c:1101: warning: left-hand operand of comma expression has no effect
pyusb.c:1101: warning: value computed is not used
pyusb.c: In function ‘Py_usb_DeviceHandle_controlMsg’:
pyusb.c:1200: warning: implicit declaration of function ‘usb_control_msg’
pyusb.c:1200: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_setConfiguration’:
pyusb.c:1254: warning: implicit declaration of function ‘usb_set_configuration’
pyusb.c:1254: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_claimInterface’:
pyusb.c:1291: warning: implicit declaration of function ‘usb_claim_interface’
pyusb.c:1291: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1295: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c: In function ‘Py_usb_DeviceHandle_detachKernelDriver’:
pyusb.c:1310: warning: unused variable ‘_self’
pyusb.c: In function ‘Py_usb_DeviceHandle_releaseInterface’:
pyusb.c:1351: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c:1354: warning: implicit declaration of function ‘usb_release_interface’
pyusb.c:1354: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1354: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c:1361: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c: In function ‘Py_usb_DeviceHandle_setAltInterface’:
pyusb.c:1398: warning: implicit declaration of function ‘usb_set_altinterface’
pyusb.c:1398: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_bulkWrite’:
pyusb.c:1449: warning: implicit declaration of function ‘usb_bulk_write’
pyusb.c:1449: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_bulkRead’:
pyusb.c:1501: warning: implicit declaration of function ‘usb_bulk_read’
pyusb.c:1501: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_interruptWrite’:
pyusb.c:1556: warning: implicit declaration of function ‘usb_interrupt_write’
pyusb.c:1556: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_interruptRead’:
pyusb.c:1608: warning: implicit declaration of function ‘usb_interrupt_read’
pyusb.c:1608: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_resetEndpoint’:
pyusb.c:1643: warning: implicit declaration of function ‘usb_resetep’
pyusb.c:1643: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_reset’:
pyusb.c:1662: warning: implicit declaration of function ‘usb_reset’
pyusb.c:1662: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_clearHalt’:
pyusb.c:1694: warning: implicit declaration of function ‘usb_clear_halt’
pyusb.c:1694: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_getString’:
pyusb.c:1748: warning: implicit declaration of function ‘usb_get_string_simple’
pyusb.c:1748: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1750: warning: implicit declaration of function ‘usb_get_string’
pyusb.c:1750: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_getDescriptor’:
pyusb.c:1811: warning: implicit declaration of function ‘usb_get_descriptor’
pyusb.c:1811: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1813: warning: implicit declaration of function ‘usb_get_descriptor_by_endpoint’
pyusb.c:1813: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘Py_usb_DeviceHandle_del’:
pyusb.c:1988: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1991: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c:1992: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:1993: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c:1996: warning: implicit declaration of function ‘usb_close’
pyusb.c:1996: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c: In function ‘new_DeviceHandle’:
pyusb.c:2062: warning: implicit declaration of function ‘usb_open’
pyusb.c:2062: warning: assignment makes pointer from integer without a cast
pyusb.c:2070: error: ‘Py_usb_DeviceHandle’ has no member named ‘deviceHandle’
pyusb.c:2071: error: ‘Py_usb_DeviceHandle’ has no member named ‘interfaceClaimed’
pyusb.c: In function ‘busses’:
pyusb.c:2090: warning: implicit declaration of function ‘usb_find_busses’
pyusb.c:2095: warning: implicit declaration of function ‘usb_find_devices’
pyusb.c:2100: warning: implicit declaration of function ‘usb_get_busses’
pyusb.c:2100: warning: assignment makes pointer from integer without a cast
pyusb.c:2107: error: dereferencing pointer to incomplete type
pyusb.c:2111: error: dereferencing pointer to incomplete type
pyusb.c:2112: warning: passing argument 1 of ‘new_Bus’ from incompatible pointer type
pyusb.c:1080: note: expected ‘struct usb_bus *’ but argument is of type ‘struct usb_bus *’
pyusb.c: In function ‘initusb’:
pyusb.c:2172: warning: implicit declaration of function ‘usb_init’
error: command 'gcc' failed with exit status 1
[b][i]ein kleines game für die die lust haben http://konaminut.mybrute.com[/i][/b]
;-)
Antworten