[Python-modules-commits] [pyusb] 01/04: Import pyusb_1.0.0.orig.tar.gz
Ruben Undheim
rubund-guest at moszumanska.debian.org
Sun May 8 05:35:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
rubund-guest pushed a commit to branch master
in repository pyusb.
commit 9be99c0fe8c5f921d76915f790915b4612a06f3b
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date: Sun May 8 07:18:18 2016 +0200
Import pyusb_1.0.0.orig.tar.gz
---
ChangeLog | 480 ++----------------------------------------------
PKG-INFO | 2 +-
README.rst | 2 +-
ReleaseNotes.rst | 127 -------------
usb/__init__.py | 4 +-
usb/backend/__init__.py | 2 +-
usb/backend/libusb0.py | 25 ++-
7 files changed, 35 insertions(+), 607 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 182876a..57c00bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,481 +1,31 @@
Author: Wander Lairson Costa
- Merge pull request #125 from swinman/master
-
- make find and find_descriptor easier to understand
-Author: Walker Inman
- make find and find_descriptor easier to understand
-
- all( iter_ ) is more explicit than reduce( lambda x, y:x and y, iter_, True ),
- especially since reduce is no longer a builtin. Use all instead of
- complicated multi-line reduce statement for easier code comprehension.
- Also, introduce _all interop since all was introduced in 2.5
-
-Author: Wander Lairson Costa
- Merge pull request #124 from roques/autoclaim
-
- ctrl_transfer: claim receiving interface for non-VENDOR transfers
-Author: Wander Lairson Costa
- Merge pull request #119 from M3gaFr3ak/patch-1
-
- Fix OpenUSB link
-Author: Wander Lairson Costa
- Fix braino in faq doc.
-
-Author: Christian von Roques
- ctrl_transfer: claim receiving interface for non-VENDOR transfers
-
- This matches what the Linux kernel does in check_intf() when called from check_ctrlrecip()
- https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/devio.c
- and thus helps to prevent annoying warnings from the kernel.
-
- The previous code did this for STANDARD type transfers already, but not for CLASS.
-
-Author: wander
- Added a new FAQ doc.
-
-Author: Leon Loeser
- Fix OpenUSB link
-
- The link for OpenUSB doesn't work. It says "Page not found" on sourceforge. I replaced it with the link to the OpenUSB sourceforge wiki
-Author: Wander Lairson Costa
- Merge pull request #107 from rabryan/master
-
- add virtual com port utility to tools
-Author: Richard Bryan
- adds a virtual com port utility to tools
-
-Author: Wander Lairson Costa
- Merge pull request #113 from AlanJAS/master
-
- prevent get_device_speed error on libusb1
-Author: Alan Aguiar
- prevent get_device_speed error on libusb1
-
-Author: Wander Lairson Costa
- Merge pull request #112 from karlp/pulls/tutorial-config-setting
-
- doc: tutorial fix typo in cfg setting
-Author: Karl Palsson
- doc: tutorial fix typo in cfg setting
-
- Clarify the different methods of setting the configuration.
-
-Author: Wander Lairson Costa
- Give a readable error when a invalid configuration is passed.
-
- closes #111.
-
-Author: Wander Lairson Costa
- Make PyUSB thread safe.
-
- We synchronize every ResourceManager method and this should be enough to
- guarantee library thread safety.
-
-Author: Wander Lairson Costa
- Merge pull request #109 from AlanJAS/master
-
- fix get_device_speed for old libusb versions
-Author: Alan Aguiar
- fix get_device_speed for old libusb versions
-
-Author: Wander Lairson Costa
- Update docs to include pip install.
-
- closes #82
- closes #92
-
-Author: Wander Lairson Costa
- Create a specialized class for "no backend" exception.
-
- Now when no backend is found, the exception NoBackendError is raised,
- allowing the application to handle it properly.
-
- closes #95.
-
-Author: Wander Lairson Costa
- Merge branch 'iso-win32'
-
- closes #61.
-
-Author: Wander Lairson Costa
- Add environment variable to control isochronous tests.
-
- Isochronous tests fail in Windows running under VirualBox, so we allow
- them to be disabled.
+ Release notes not necessary anymore.
Author: Wander Lairson Costa
- Implement isochronous transfers for libusb-win32.
-
- libusb-win32 supports asynchronous isochronous transfers. We check in
- the libubs0 backend if the isochronous related functions are available
- and, if so, implement the iso transfer functions.
-
-Author: Wander Lairson Costa
- Merge pull request #104 from AndreySV/fix-setConfiguration-setAltInterface
-
- fix 0.x compatibility issue in functions setConfiguration() and setAltInterface()
-Author: Wander Lairson Costa
- Merge pull request #105 from jcflack/metadata
-
- For discussion anyway, one attempt at some relevant trove classifiers.
-Author: Andrey Skvortsov
- cleanup code in claimInterface()
-
- cleanup code to make argument handling consistent with functions
- setConfiguration, setAltInterface and detachKernelDriver.
-
-Author: Andrey Skvortsov
- fixes 0.x compatibility for detachKernelDriver()
-
- Argument interface can be interface number or an Interface object, but
- if interface is Interface object following trace is printed:
-
- File "./mp709.py", line 102, in open
- self.handle.detachKernelDriver(self.intf)
- File "/home/andrey/tmp/pyusb/usb/legacy.py", line 309, in detachKernelDriver
- self.dev.detach_kernel_driver(interface)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 1047, in detach_kernel_driver
- interface)
- File "/home/andrey/tmp/pyusb/usb/backend/libusb1.py", line 894, in detach_kernel_driver
- _check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf))
- ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
-
- This patch adds code that converts Interface object to interface number.
-
-Author: Andrey Skvortsov
- fixes 0.x compatibility for setAltInterface()
-
- If pyusb-0.x code is used and
- DeviceHandle.setConfiguration(self.dev.configurations[0])
- is called, the following trace is printed:
-
- self.handle.setAltInterface(self.intf)
- File "/home/andrey/tmp/pyusb/usb/legacy.py", line 267, in setAltInterface
- self.dev.set_interface_altsetting(self.__claimed_interface, alternate)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 872, in set_interface_altsetting
- self._ctx.managed_set_interface(self, interface, alternate_setting)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 177, in managed_set_interface
- self.managed_claim_interface(device, i)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 147, in managed_claim_interface
- self.backend.claim_interface(self.handle, i)
- File "/home/andrey/tmp/pyusb/usb/backend/libusb1.py", line 803, in claim_interface
- _check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
- ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
-
- If legacy function DeviceHandle.setAltInterface(self.intf) is
- called, function _ResourceManager.managed_set_configuration 'config'
- parameter's type will be <class 'usb.legacy.Interface' instead of
- 'int'.
-
-Author: Andrey Skvortsov
- fixes 0.x compatibility for setConfiguration()
-
- If pyusb-0.x code is used and
- DeviceHandle.setConfiguration(self.dev.configurations[0])
- is called, the following trace is printed:
-
- File "./mp709.py", line 109, in open
- self.handle.setConfiguration(self.dev.configurations[0])
- File "/home/andrey/tmp/pyusb/usb/legacy.py", line 259, in setConfiguration
- self.dev.set_configuration(configuration)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 839, in set_configuration
- self._ctx.managed_set_configuration(self, configuration)
- File "/home/andrey/tmp/pyusb/usb/core.py", line 129, in managed_set_configuration
- self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
- AttributeError: 'NoneType' object has no attribute 'bConfigurationValue'
-
- The problem is here, that in function
- _ResourceManager.managed_set_configuration(self, device, config)
- 'config' parameter has type 'usb.legacy.Configuration' from legacy code.
- But the function (managed_set_configuration) expects types 'usb.core.Configuration' or 'int'.
- With this patch managed_set_configuration gets 'int' configuration
- number from legacy code and util.find_descriptor(device, bConfigurationValue=config)
- finds and returns corresponding 'usb.core.Configuration' for further
- handling.
-
-Author: Chapman Flack
- First crack at some relevant setup.py classifiers.
-
-Author: Wander Lairson Costa
- Merge pull request #99 from jcflack/strings
-
- Handling device strings; making device's LANGID list accessible.
-Author: Chapman Flack
- Expose device's LANGIDs; suppress missing strings.
-
- When a device does not have a certain string (e.g. serial number),
- it supplies zero as the index for that string. Zero is never the
- index of a real string, only a signal not to request it. A request
- for string index zero has a special meaning, to find the list of
- languages the device strings are offered in. When code requested a
- string without testing the index for zero, it could get back a bogus
- string like a Cyrillic Љ character, as a result of trying to interpret
- the language ID codes as Unicode characters.
-
- Now get_string simply returns None if passed an index of zero.
-
- At the same time, there was no simple way for calling code to examine
- the supported language IDs for the device. The spec forbids sending
- string requests for a language the device does not support, so the
- supported IDs should be easy for the caller to check. Now there is
- a langids property on Device.
-
- If a device has no strings, the spec also allows it to have no langids
- list. The device might reply with an empty list, or fail the request
- with a backend pipe error. The latter is caught in the property accessor
- on core.Device, rather than in util.get_langids, because of an order
- constraint between when core imports util and when it defined USBError.
-
- The string property accessors on Device normally call get_string once
- and cache the result, but if the index is zero (so the result is None)
- they will end up calling get_string every time ... but all it does in
- that case is if 0 == index: return None so the cost is negligible and
- the code stays simple.
-
-Author: Wander Lairson Costa
- Merge pull request #98 from jcflack/housekeeping
-
- Conform _interop to the README goal to support 2.4+.
-Author: Chapman Flack
- Conform _interop to README's goal to support 2.4+.
-
- README.rst was saying 2.4+ should be supported but some vestiges from 2.3
- were in _interop.py.
-
- Wherever used (which was only in legacy.py), _sorted and _groupby are
- now replaced by their native counterparts.
-
- http://sourceforge.net/p/pyusb/mailman/message/34078264/
- Two commits formerly pushed to github, rebased at upstream's request.
-
-Author: Wander Lairson Costa
- Merge pull request #97 from jcflack/solaris
-
- Support the libusb0 that ships in Solaris
-Author: Chapman Flack
- Add a hardcoded PATH_MAX for Solaris.
-
- The preceding commit would make it work in most cases, but perhaps it
- is best not to rely on pathconf when the value from limits.h is known.
- In theory, pathconf could return a different value depending on the
- filesystem where . is, but the fixed value in limits.h will be what
- libusb was compiled with.
-
-Author: Chapman Flack
- Avoid hardcoding the index for _PC_PATH_MAX.
-
- POSIX explicitly leaves the values of these named constants unspecified.
- The value 4 is right for linux but wrong for solaris. Who knows what it is
- in another OS. The result of having the wrong index is the wrong value
- gets queried, making the ctypes structures the wrong sizes and causing
- pyusb to fail in perplexing ways.
-
- It's better to use the name ('PC_PATH_MAX') and allow Python to use the
- correct index for the platform.
+ Bump version to stable.
Author: Wander Lairson Costa
- Merge pull request #96 from MattHeard/patch-1
+ Merge pull request #140 from MattHeard/patch-3
- Fixed minor docstring typo.
+ Correct minor documentation typo
Author: Matt
- Fixed minor docstring typo
-Author: Wander Lairson Costa
- Merge pull request #93 from damib/master
-
- Claim interface only for standard control transfer requests.
-Author: Damiano Bortolato
- Claim interface only for standard control transfer requests.
-
- wIndex is the interface number to be claimed only for
- standard request types. For example Silicon Labs cp2103 defines
- a vendor control transfer to set some GPIO pins though wIndex
- parameter (se AN571 page 17).
-
-Author: Wander Lairson Costa
- Add script to setup python test environment.
-
-Author: Wander Lairson Costa
- Thanks to Maximilian Köhl and Matthew Chan.
-
- Maximilian Köhl.: PR #90
- Matthew Chan: PR #91
-
-Author: Wander Lairson Costa
- Merge pull request #91 from tuzzer/master
-
- util: change tostring() to tobytes() when running with Python 3.2+
-Author: tuzzer
- util: change tostring() to tobytes() when running with Python 3.2+
-
- This removes the DeprecationWarning that warns that tostring() is
- obsolete when running with Python 3.2+
-
-Author: Wander Lairson Costa
- Merge pull request #90 from koehlma/master
-
- libusb1: fix seg fault when get_device_speed is called
-Author: Maximilian Köhl
- libusb1: fix seg fault when get_device_speed is called
-
-Author: Wander Lairson Costa
- core: Fix seg fault when dispose is called after device disconnection.
-
- When dispose is called after the device is diconnected,
- release_interface might fail (see commit 5e9ef1536), then the interface
- stays in the claimed interfaces set. When the device is destroyed, its
- __del__ method will call dispose again and, since the interface is
- still marked as claimed, a new call to release_interface will be made
- with an invalid device handle, causing a segmentation fault.
-
- We fix that by always removing the interface from the claimed set.
-
- closes #89.
-
-Author: Wander Lairson Costa
- Fixed: Add speed property to all backends.
-
-Author: Wander Lairson Costa
- Thanks to Deliang Fan for PR #88.
-
-Author: Wander Lairson Costa
- Merge pull request #88 from DeliangFan/speed
-
- Support for getting usb device speed
-Author: fandeliang
- Support for getting usb device speed
-
- In some cases, we need to get the usb device speed type to attach
- it to specific usb controller. Fortunately, it's easy to get usb
- device speed information with libusb1.0.
-
-Author: Wander Lairson Costa
- core: Handle exceptions when releasing the interfaces.
-
- At object destruction, claimed interfaces are released. If the device
- is disconnected, the call to release_interface may fail and raise an
- exception.
-
- closes #84.
-
-Author: Wander Lairson Costa
- libusb1: fix hanging when the device is disconnected in a iso transfer.
-
- If the device is disconnected when a isochronous transfer is ongoing,
- it might raise an exception in the callback and the 'callback done'
- signaling flag is never set. This causes the program to hang
- forever.
-
- We move the error handling to the caller function, after the callback
- returns. In this way, the exception is raised in the main thread and
- client software is notified about the exceptional situation.
-
- closes #85.
-
-Author: Wander Lairson Costa
- Braino.
-
+ Correct minor documentation typo
Author: Wander Lairson Costa
- Use libusb_strerror when the function is available.
+ Merge pull request #134 from SimplicityGuy/master
- libusb_strerror returns a string containing the error message for the
- given error code. When the function is not available, we fallback to
- our own internal error code mapping strategy.
-
- closes #69.
+ Fixing Issue #133
+Author: Robert Wlodarczyk
+ Issue #133: Fixing `detach_kernel_driver`.
-Author: Wander Lairson Costa
- Implement "backend" property.
-
- The "backend" property returns the backend used by the device.
-
- closes #71.
+Author: Robert Wlodarczyk
+ Fixing minor alignment issue.
Author: Wander Lairson Costa
- Merge pull request #80 from 'ecejeff/master'.
+ Fixed typo in README.
- closes #80.
+ Thanks to Ioan Lupu.
Author: Wander Lairson Costa
- Thanks Jeffrey Nichols for the port numbers patch.
-
-Author: Jeffrey Nichols
- Support for port_numbers hierarchy tuple with libusb1.
-
-Author: Wander Lairson Costa
- Merge pull request #78 from 'dywisor/master'.
-
- closes #66 closes #78.
-
-Author: Wander Lairson Costa
- Thanks to André Erdmann for #66 fix.
-
-Author: André Erdmann
- finalize objects before exiting
-
- Fixes #66 ("Exception when script using pyusb finishes").
-
- See previous commit for details.
-
-Author: André Erdmann
- add object finalizer class
-
- Starting with (C)Python 3.4, the GC features "Safe object finalization" [0],
- which doesn't work nicely with pyusb's object structure.
-
- Required globals / modules may already have been deleted (set to None)
- when an object's __del__() method gets called [1], which
- randomly breaks libusb calls etc. when calling sys.exit().
-
- Use the atexit module to solve this (indirectly via weakref.finalize()).
-
- This commit adds a class that takes care of object finalization.
- Classes/objects can adopt this functionality by inheriting
- AutoFinalizedObject and renaming their __del__() method to _finalize_object().
+ Fix braino in libusb0.
- Shouldn't break existing use cases, but adds a few layers of indirection.
- A __del__() call gets processed as follows:
-
- __del__() -> finalize() -> [...]
- -> _do_finalize_object() -> _finalize_object()
-
- All methods in this call chain are provided by AutoFinalizedObject,
- derived classes should override the no-op _finalize_object() method.
-
- The "[...]" part depends on the python version:
- * < 3.4: <nothing>
- * >= 3.4: _finalizer() -> _do_finalize_object_ref()
-
-Author: Wander Lairson Costa
- Merge pull request #75 from jrtomps/docfix
-
- Fixes typo in find_class example.
-Author: Jeromy Tompkins
- Fixes typo in find_class example
-
-Author: Wander Lairson Costa
- Revert "Use libusb_strerror to translate erro codes to strings."
-
- This reverts commit 592e893a01fc4517dd27018dd71c8520c521135c.
-
- It causes regressions on systems using old versions of libusb that
- don't implement libusb_strerror.
-
- closes #57 closes #68.
-
- Conflicts:
- usb/backend/libusb1.py
-
-Author: Wander Lairson Costa
- Cleanup resources when device handle is deleted. closes #65.
-
- Legacy module has no explicity resource cleanup functions, so we free
- allocated resources in the __del__ method.
-
-Author: Wander Lairson Costa
- Trace unit tests.
-
- Tracing unit tests functions calls makes easier to track what's going
- on when regression tests fail.
-
-Author: Wander Lairson Costa
- Update version to release candidate 1.
+ Thanks to Ioan Lupu.
diff --git a/PKG-INFO b/PKG-INFO
index b36aca5..11457f2 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pyusb
-Version: 1.0.0rc1
+Version: 1.0.0
Summary: Python USB access module
Home-page: http://pyusb.sourceforge.net
Author: Wander Lairson Costa
diff --git a/README.rst b/README.rst
index 6e2ba5a..efc1f87 100644
--- a/README.rst
+++ b/README.rst
@@ -78,7 +78,7 @@ give the complete path to the Python interpreter.
Remember that you need libusb (1.0 or 0.1) or OpenUSB running on your
system. For Windows users, libusb 0.1 is provided through
-`libusb-win32 <http://libubs-win32.sourceforge.net>`_
+`libusb-win32 <http://libusb-win32.sourceforge.net>`_
package. Check the libusb website for updates
(http://www.libusb.org).
diff --git a/ReleaseNotes.rst b/ReleaseNotes.rst
deleted file mode 100644
index 7387716..0000000
--- a/ReleaseNotes.rst
+++ /dev/null
@@ -1,127 +0,0 @@
-==========
-PyUSB News
-==========
-
-What's new in PyUSB 1.0.0 (beta 2)?
-===================================
-
-- You can now customize the search path for USB libraries (by André Erdmann).
-- API improvements (more on that below).
-- legacy module fully functional.
-- Regressions tests for Python 2.4-3.4.
-
-WARNING: API breakage ahead!!!!!
---------------------------------
-
-- `util.get_string` does not receive the length parameter anymore (by
-- the `find` and `find_descriptor` functions now return an iterator when
- find_all is true.
-- Added the property `extra` for extra descriptors (by Prathmesh Prabhu).
-- New function `util.create_buffer`.
-- Now `read` and `ctrl_transfer` functions allow inplace reads.
-- New method `clear_halt`.
-- The functions `is_kernel_driver_active`, `detach_kernel_driver` and
- `attach_kernel_driver` does not accept an Interface object anymore.
-- `write` and `read` does not receive the interface number anymore.
-- added the properties `vendor`, `product` and `serial_number` to the
- Device class.
-- Support for `str` and `repr` conversions for descriptors (by Walker Inman).
-
-What's new in PyUSB 1.0.0 (beta 1)?
-===================================
-
-- Isochronous transfer for libusb 1.0 (by David Halter).
-- Experimental OpenUSB support.
-- Documentation update.
-- ``PYUSB_DEBUG_LEVEL`` environment variable is now called ``PYUSB_DEBUG``.
-- Legacy module nwo groups according to their *bus*.
-- Version information available for apps (by Chris Clark).
-- Faster read operation (by themperek).
-- Tox support (by ponty).
-- Support for port number info (by Stefano Di Martino).
-- Several bug fixes (please, check the Changelog file).
-
-Known issues
-============
-
-- OpenUSB backend hangs on some control transfers.
-
-TODO
-====
-
-- More tests with legacy module.
-- Isochronous transfers for libusb-win32.
-
-What's new in PyUSB 1.0.0 (alpha 3)?
-====================================
-
-**WARNING**: this release renames the libusb 1.0 and libusb 0.1 backends. If
-your code makes direct access to this backends, you will have to change it.
-
-- Fixed several legacy module bugs (by Tormod Volden).
-- Fixed libusb0 backend for BSDs and Mac OSX.
-- Fixed data loss when less the requested number of bytes were read (by
- Braiden Kindt).
-- Documentation fixes.
-
-What's new in PyUSB 1.0.0 (alpha 2)?
-====================================
-
-- Test firmware now lives in its own respository (https://github.com/walac/bmfw).
-- ``USBError`` now has the property ``backend_error_code`` that tells the
- backend specific error.
-- ``errno`` value in ``USBError`` is translated according to the backend error.
-- Now ``Device`` class has the ``bus`` and ``address`` attributes to
- differentiate identical devices.
-- Optimization when log is disabled (by Emmanuel Blot).
-- Several other minor fixes and improvaments (check ChangeLog file).
-
-Features not implemented
-------------------------
-
-- OpenUSB support.
-- Isochronous transfer.
-
-What's new in PyUSB 1.0.0 (alpha 1)?
-====================================
-
-This release implements more PyUSB 1.0 features towards beta stage. The new
-features implemented include:
-
-- Standard control requests through usb.control module.
-- Request current configuration from device when you do not call
- set_configuration.
-- get_string function in the usb.util module to get string descriptors.
-- Full 0.4 API emulation.
-- Device is not reset anymore in test cases to avoid problems in systems
- where it does not work.
-
-Features not implemented
-------------------------
-
-- OpenUSB support.
-- Isochronous transfer.
-
-What's new in PyUSB 1.0.0 (alpha 0)?
-====================================
-
-This is the first PyUSB 1.0 series public release. This is an alpha release,
-which means that most of the features described in the README file and on the
-website are not yet stable or even implemented.
-
-Features not implemented
-------------------------
-
-- Full support for legacy 0.4 legacy code (although partial support is provided).
-- OpenUSB backend.
-- libusb 1.0 windows backend stability (although it is reasonable usable).
-- Support for several standard control requests (including GET_STRING).
-- Python < 2.6 and Python 3 not yet fully tested.
-
-Known issues
-------------
-
-- ``reset`` method fails under FreeUSB (libusb 1.0 backend).
-- ``reset`` method hangs under Windows (libusb 1.0 backend).
-- Sometimes occurs `read` timeout on Windows (libusb 1.0 backend).
-- Test cases fail to run under cygwin.
diff --git a/usb/__init__.py b/usb/__init__.py
index 432a507..845e0fc 100644
--- a/usb/__init__.py
+++ b/usb/__init__.py
@@ -46,8 +46,8 @@ import os
__author__ = 'Wander Lairson Costa'
# Use Semantic Versioning, http://semver.org/
-version_info = (1, 0, 0, 'rc1')
-__version__ = '%d.%d.%d%s' % version_info
+version_info = (1, 0, 0)
+__version__ = '%d.%d.%d' % version_info
__all__ = ['legacy', 'control', 'core', 'backend', 'util', 'libloader']
diff --git a/usb/backend/__init__.py b/usb/backend/__init__.py
index e4dfae8..3a4d4d7 100644
--- a/usb/backend/__init__.py
+++ b/usb/backend/__init__.py
@@ -39,7 +39,7 @@ PyUSB already provides backends for libusb versions 0.1 and 1.0,
and OpenUSB library. Backends modules included with PyUSB are required to
export the get_backend() function, which returns an instance of a backend
object. You can provide your own customized backend if you
-want to. Bellow you find a skeleton of a backend implementation module:
+want to. Below you find a skeleton of a backend implementation module:
import usb.backend
diff --git a/usb/backend/libusb0.py b/usb/backend/libusb0.py
index e5a4b7c..aee210c 100644
--- a/usb/backend/libusb0.py
+++ b/usb/backend/libusb0.py
@@ -154,11 +154,11 @@ _usb_device._fields_ = [('next', POINTER(_usb_device)),
('children', POINTER(POINTER(_usb_device)))]
_usb_bus._fields_ = [('next', POINTER(_usb_bus)),
- ('prev', POINTER(_usb_bus)),
- ('dirname', c_char * (_PATH_MAX + 1)),
- ('devices', POINTER(_usb_device)),
- ('location', c_uint32),
- ('root_dev', POINTER(_usb_device))]
+ ('prev', POINTER(_usb_bus)),
+ ('dirname', c_char * (_PATH_MAX + 1)),
+ ('devices', POINTER(_usb_device)),
+ ('location', c_uint32),
+ ('root_dev', POINTER(_usb_device))]
_usb_dev_handle = c_void_p
@@ -361,6 +361,12 @@ def _setup_prototypes(lib):
# struct usb_bus *usb_get_busses(void);
lib.usb_get_busses.restype = POINTER(_usb_bus)
+ # linux only
+
+ # int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface);
+ if hasattr(lib, 'usb_detach_kernel_driver_np'):
+ lib.usb_detach_kernel_driver_np.argtypes = [_usb_dev_handle, c_int]
+
# libusb-win32 only
# int usb_isochronous_setup_async(usb_dev_handle *dev,
@@ -457,7 +463,7 @@ class _LibUSB(usb.backend.IBackend):
def get_interface_descriptor(self, dev, intf, alt, config):
cfgdesc = self.get_configuration_descriptor(dev, config)
if intf >= cfgdesc.bNumInterfaces:
- raise IndexError('Invalid interface index ' + str(interface))
+ raise IndexError('Invalid interface index ' + str(intf))
interface = cfgdesc.interface[intf]
if alt >= interface.num_altsetting:
raise IndexError('Invalid alternate setting index ' + str(alt))
@@ -487,10 +493,6 @@ class _LibUSB(usb.backend.IBackend):
_check(_lib.usb_set_configuration(dev_handle, config_value))
@methodtrace(_logger)
- def set_interface_altsetting(self, dev_handle, intf, altsetting):
- _check(_lib.usb_set_altinterface(dev_handle, altsetting))
-
- @methodtrace(_logger)
def get_configuration(self, dev_handle):
bmRequestType = usb.util.build_request_type(
usb.util.CTRL_IN,
@@ -510,6 +512,9 @@ class _LibUSB(usb.backend.IBackend):
assert ret == 1
return buff[0]
+ @methodtrace(_logger)
+ def set_interface_altsetting(self, dev_handle, intf, altsetting):
+ _check(_lib.usb_set_altinterface(dev_handle, altsetting))
@methodtrace(_logger)
def claim_interface(self, dev_handle, intf):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyusb.git
More information about the Python-modules-commits
mailing list