Hello All,

i'm tring to learn pyusb, i'm on a mac osx 10.6.4
i buid libusb from source with "log enabled"
googling i tried learn how to read data from an USB device (a joystick)
i find this code :

import usb
import usb.core
myVendorId = 1133
myProductId = 49685
dev = usb.core.find(idVendor=myVendorId, idProduct=myProductId)
dev.set_configuration()
test = dev.read(0x81,8)

but it gives me errors about "permision denied", 
se the log :


>>> myVendorId = 1133
>>> myProductId = 49685
>>> dev = usb.core.find(idVendor=myVendorId, idProduct=myProductId)
libusb:debug [libusb_get_device_list] 
libusb:info [process_new_device] allocating new device for location 0x1d000000
libusb:info [process_new_device] found device with address 1 at 
001-05ac-8005-09-00
libusb:info [process_new_device] allocating new device for location 0x1d200000
libusb:info [process_new_device] found device with address 2 at 
002-05ac-021b-00-00
libusb:info [process_new_device] allocating new device for location 0x3d000000
libusb:info [process_new_device] found device with address 1 at 
001-05ac-8005-09-00
libusb:info [process_new_device] using existing device for location 0x3d100000
libusb:info [process_new_device] found device with address 2 at 
002-046d-c215-00-00
libusb:info [process_new_device] allocating new device for location 0x5d000000
libusb:info [process_new_device] found device with address 1 at 
001-05ac-8005-09-00
libusb:info [process_new_device] allocating new device for location 0x5d200000
libusb:info [process_new_device] found device with address 2 at 
002-05ac-8240-00-00
libusb:info [process_new_device] allocating new device for location 0x7d000000
libusb:info [process_new_device] found device with address 1 at 
001-05ac-8005-09-00
libusb:info [process_new_device] allocating new device for location 0x7d100000
libusb:warning [process_new_device] could not retrieve device descriptor: 
device not responding. skipping device
libusb:debug [libusb_unref_device] destroy device 104.0
libusb:info [process_new_device] allocating new device for location 0xfd000000
libusb:info [process_new_device] found device with address 1 at 
001-05ac-8006-09-00
libusb:info [process_new_device] allocating new device for location 0xfd400000
libusb:debug [discovered_devs_append] need to increase capacity
libusb:info [process_new_device] found device with address 2 at 
002-05ac-8501-ff-ff
libusb:debug [libusb_get_device_descriptor] 
libusb:debug [libusb_get_device_descriptor] 
libusb:debug [libusb_get_device_descriptor] 
libusb:debug [libusb_get_device_descriptor] 
libusb:debug [libusb_unref_device] destroy device 29.1
libusb:debug [libusb_unref_device] destroy device 29.2
libusb:debug [libusb_unref_device] destroy device 61.1
libusb:debug [libusb_unref_device] destroy device 93.1
libusb:debug [libusb_unref_device] destroy device 93.2
libusb:debug [libusb_unref_device] destroy device 125.1
libusb:debug [libusb_unref_device] destroy device 253.1
libusb:debug [libusb_unref_device] destroy device 253.2
libusb:debug [libusb_close] 
libusb:debug [usbi_remove_pollfd] remove fd 6
>>> dev.set_configuration()
libusb:debug [libusb_get_config_descriptor] index 0
libusb:debug [libusb_open] open 61.2
libusb:debug [usbi_add_pollfd] add fd 6 events 1
libusb:info [darwin_open] device open for access
libusb:debug [libusb_set_configuration] configuration 1
>>> test = dev.read(0x81,8)
libusb:debug [libusb_get_config_descriptor] index 0
libusb:debug [libusb_get_config_descriptor] index 0
libusb:debug [libusb_get_config_descriptor] index 0
libusb:debug [libusb_get_config_descriptor] index 0
libusb:debug [libusb_claim_interface] interface 0
libusb:error [darwin_claim_interface] USBInterfaceOpen: another process has 
device opened for exclusive access
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sasha/Downloads/pyusb-1.0.0-a0/usb/core.py", line 617, in read
    self._ctx.managed_claim_interface(self, intf)
  File "/Users/sasha/Downloads/pyusb-1.0.0-a0/usb/core.py", line 104, in 
managed_claim_interface
    self.backend.claim_interface(self.handle, i)
  File "/Users/sasha/Downloads/pyusb-1.0.0-a0/usb/_debug.py", line 53, in 
do_trace
    return f(*args, **named_args)
  File "/Users/sasha/Downloads/pyusb-1.0.0-a0/usb/backend/libusb10.py", line 
461, in claim_interface
    _check(_lib.libusb_claim_interface(dev_handle, intf))
  File "/Users/sasha/Downloads/pyusb-1.0.0-a0/usb/backend/libusb10.py", line 
353, in _check
    raise USBError(_str_error[retval.value])
usb.core.USBError: Access denied (insufficient permissions)
>>> 


have you any clue on what i need to "read data" coming from such device ?

the output of : 

system_profiler SPUSBDataType

is : 

USB:

    USB High-Speed Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBEHCI
      PCI Device ID: 0x27cc 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0xfd 

        Built-in iSight:

          Product ID: 0x8501
          Vendor ID: 0x05ac  (Apple Inc.)
          Version:  1.89
          Speed: Up to 480 Mb/sec
          Manufacturer: Micron
          Location ID: 0xfd400000
          Current Available (mA): 500
          Current Required (mA): 100

    USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27c8 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x1d 

        Apple Internal Keyboard / Trackpad:

          Product ID: 0x021b
          Vendor ID: 0x05ac  (Apple Inc.)
          Version:  0.18
          Speed: Up to 12 Mb/sec
          Manufacturer: Apple Computer
          Location ID: 0x1d200000
          Current Available (mA): 500
          Current Required (mA): 40

    USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27c9 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x3d 

        Logitech Extreme 3D:

          Product ID: 0xc215
          Vendor ID: 0x046d  (Logitech Inc.)
          Version:  2.04
          Speed: Up to 1.5 Mb/sec
          Manufacturer: Logitech
          Location ID: 0x3d100000
          Current Available (mA): 500
          Current Required (mA): 30

    USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27ca 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x5d 

        IR Receiver:

          Product ID: 0x8240
          Vendor ID: 0x05ac  (Apple Inc.)
          Version:  1.10
          Speed: Up to 12 Mb/sec
          Manufacturer: Apple Computer, Inc.
          Location ID: 0x5d200000
          Current Available (mA): 500
          Current Required (mA): 100

    USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27cb 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x7d 

        Bluetooth USB Host Controller:

          Product ID: 0x8205
          Vendor ID: 0x05ac  (Apple Inc.)
          Version: 19.65
          Speed: Up to 12 Mb/sec
          Manufacturer: Apple Inc.
          Location ID: 0x7d100000
          Current Available (mA): 500
          Current Required (mA): 0


the device i'm intersted on, is :

USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27c9 
      PCI Revision ID: 0x0002 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x3d 

        Logitech Extreme 3D:

          Product ID: 0xc215
          Vendor ID: 0x046d  (Logitech Inc.)
          Version:  2.04
          Speed: Up to 1.5 Mb/sec
          Manufacturer: Logitech
          Location ID: 0x3d100000
          Current Available (mA): 500
          Current Required (mA): 30


thanks for any help!!!

regrads,

Massimo.



------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to