1

First time using PyUSB, trying to reverse engineer an eye-toy (Play Station) for OS X. Though I get the following error, when attempting to establish a testing collection.

Traceback (most recent call last):
File "eye.py", line 5, in <module>
dev = usb.core.find(0x054C,0x0155)
File "/Library/Python/2.7/site-packages/usb/core.py", line 824, in find
return [d for d in device_iter(k, v)]
File "/Library/Python/2.7/site-packages/usb/core.py", line 794, in device_iter
for dev in backend.enumerate_devices():
AttributeError: 'int' object has no attribute 'enumerate_devices'

Current code...

import usb.core, time, usb

dev = usb.core.find(0x054C,0x0155)

if dev is None:
  raise ValueError('Device not found')           # if device not found report an error
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Robert
  • 2,222
  • 2
  • 21
  • 36

1 Answers1

2

usb.core.find isn't used with positional arguments like that.

I'm guessing that you have a vendor ID and a product ID.

If so, you should be doing this:

usb.core.find(idVendor= 0x054C, idProduct= 0x0155)

If you try to provide positional parameters, you're settings the values of find_all and backend.

S.Lott
  • 384,516
  • 81
  • 508
  • 779
  • Thanks, well I get device not found. Though they're the right vendor and product ID. – Robert Dec 19 '11 at 00:03
  • @Hmm: If you're no longer getting an exception, that's a separate question. Also, be prepared to prove that you've got the right vendor and product code. – S.Lott Dec 19 '11 at 00:03
  • @Hmm: If you're no longer getting an exception, that's still a separate question. – S.Lott Dec 19 '11 at 00:06