Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pyusb for openSUSE:Factory 
checked in at 2021-12-08 00:00:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyusb (Old)
 and      /work/SRC/openSUSE:Factory/.python-pyusb.new.31177 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pyusb"

Wed Dec  8 00:00:17 2021 rev:4 rq:936361 version:1.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyusb/python-pyusb.changes        
2021-05-10 15:41:54.712961448 +0200
+++ /work/SRC/openSUSE:Factory/.python-pyusb.new.31177/python-pyusb.changes     
2021-12-08 00:00:49.835518018 +0100
@@ -1,0 +2,16 @@
+Tue Dec  7 19:54:08 UTC 2021 - pgaj...@suse.com
+
+- version update to 1.2.1
+  Added:
+  * core: implement Device.__eq__() (#147)
+  Changed:
+  * libusb0: implement is_kernel_driver_active() for FreeBSD and DragonFly BSD 
(#365)
+  * libusb0: implement is_kernel_driver_active() for Mac OS (#374)
+  Fixed:
+  * core: make Device hashable again (PR #376)
+  * setup: prevent installation on unsupported Python versions (PR #364)
+  * control: fix undefined USBError (#372)
+  * tests: fix legacy/hardware tests for Python 3.9 (#373)
+- do not require pytest-runner for build, it is not needed
+
+-------------------------------------------------------------------

Old:
----
  pyusb-1.1.1.tar.gz

New:
----
  pyusb-1.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pyusb.spec ++++++
--- /var/tmp/diff_new_pack.sEic0g/_old  2021-12-08 00:00:50.379516155 +0100
+++ /var/tmp/diff_new_pack.sEic0g/_new  2021-12-08 00:00:50.383516142 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %global skip_python2 1
 Name:           python-pyusb
-Version:        1.1.1
+Version:        1.2.1
 Release:        0
 Summary:        USB access on the Python language
 # URL is incorrect on PyPI, gh#pyusb/pyusb#211
@@ -27,7 +27,7 @@
 Group:          Development/Languages/Python
 URL:            https://github.com/pyusb/pyusb
 Source:         
https://files.pythonhosted.org/packages/source/p/pyusb/pyusb-%{version}.tar.gz
-BuildRequires:  %{python_module pytest-runner}
+BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools_scm}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  dos2unix
@@ -57,7 +57,7 @@
 %check
 # Testing mostly requires a device, which is not mocked or emulated
 # See https://github.com/pyusb/pyusb/issues/235
-%python_exec setup.py pytest --addopts="tests/test_find.py tests/test_util.py 
-k 'not FindDescriptorTest'"
+%pytest tests/test_find.py tests/test_util.py -k 'not FindDescriptorTest'
 
 %files %{python_files}
 %license LICENSE

++++++ pyusb-1.1.1.tar.gz -> pyusb-1.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/.github/workflows/run_tox.yml 
new/pyusb-1.2.1/.github/workflows/run_tox.yml
--- old/pyusb-1.1.1/.github/workflows/run_tox.yml       2020-12-21 
15:46:19.000000000 +0100
+++ new/pyusb-1.2.1/.github/workflows/run_tox.yml       2021-02-03 
20:57:56.000000000 +0100
@@ -26,8 +26,8 @@
       if: matrix.platform == 'windows-latest'
       shell: pwsh
       run: |
-        Invoke-WebRequest -Uri 
https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z 
-OutFile libusb-1.0.23.7z
-        7z e libusb-1.0.23.7z -oC:\Windows\System32 MS64/dll/libusb-1.0.dll
+        Invoke-WebRequest -Uri 
https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.7z 
-OutFile libusb-1.0.24.7z
+        7z e libusb-1.0.24.7z -oC:\Windows\System32 
VS2019/MS64/dll/libusb-1.0.dll
     - id: pyver2toxenv
       run: |
         python -c "import sys; print('::set-output name=toxenv::py' + 
sys.argv[1].replace('.', ''))" ${{ matrix.python-version }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/ChangeLog new/pyusb-1.2.1/ChangeLog
--- old/pyusb-1.1.1/ChangeLog   2021-01-20 07:21:18.000000000 +0100
+++ new/pyusb-1.2.1/ChangeLog   2021-07-09 04:56:50.000000000 +0200
@@ -1,78 +1,14 @@
-Author: Tormod Volden
-    core: raise ValueError if no matching interface is found (#350)
-    
-    Otherwise the type check for claim_interface will fail and the
-    error message is less helpful.
-    
-    Signed-off-by: Tormod Volden <debian.tor...@gmail.com>
-Author: Jonas Malaco
-    tree: update copyright notice
-
-Author: Jonas Malaco
-    interop: automatically UTF-8 encode strings in as_array
-    
-    Restores previous/documented behavior.
-    
-    Closes: #346 ("usb._interop.as_array should accept strings")
-
 Author: Jonas Malaco
-    tox: enable Python 3.9 testing with tox
-
-Author: petemyron
-    docs: README: add mac OS installation instructions (#352)
+    Merge #376: core: make Device hashable again
     
 
-Author: Tim Gates
-    docs: fix simple typo, respectivelly -> respectively (#349)
+Author: Nick Bogdanov
+    Make Device hashable again
     
-    There is a small typo in usb/backend/__init__.py.
-    
-    Should read `respectively` rather than `respectivelly`.
-Author: Jonas Malaco
-    deploy: generate, sign and upload a Python wheel in addition to the sdist
-    
-    Related: #337 ("setup.py failure")
-
-Author: Jonas Malaco
-    interop: fix call to deprecated and now removed array.fromstring
+    Commit 251dbc15df00b5 ("core: implement Device.__eq__") had the side
+    effect of making Device objects unhashable, so they could no longer be
+    included in a set().  This was a regression from v1.1.1.  Add a
+    corresponding __hash__() method so that Device objects are hashable
+    again.
     
-    Closes: #338 ("[_interop.py] Migrate to 3.9 compatibility.")
-
-Author: Jonas Malaco
-    ci: add Python 3.9, drop Python 2.7/3.5
-
-Author: Jonas Malaco
-    libusb1: discard partial prototypes if previous load failed
-    
-    If loading libusb1 failed, perhaps due to a missing symbol, a second
-    call to libusb1.get_backend would reuse partially constructed prototypes
-    and return an unsound _LibUSB instance.[1]
-    
-    To fix this, remove the previous optimization and load/setup the library
-    every time.
-    
-    [1] https://github.com/pyusb/pyusb/issues/333#issuecomment-710688807
-    
-    Related: #333 ("show_devices() segfaults when run twice")
-
-Author: Jonas Malaco
-    Merge #332: support pytest (disables currently unsuable hardware tests)
-    
-    From ap--/pyusb: pytest-compat-simple.
-Author: Andreas Poehlmann
-    tests: minimal changeset for pytest support
-    
-    This commit allows to use pytest for testing.
-    NOTE: It removes parts of the testsuite that require a special USB device.
-
-Author: Jonas Malaco
-    Merge #329: readme: link to FAQ
-    
-
-Author: clach04
-    Link to FAQ
-Author: Jonas Malaco
-    readme: do some minor clean up
-
-Author: Jonas Malaco
-    deploy: don't pin remote to origin or delete dist/
+    Fixes eblot/pyftdi#256
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/PKG-INFO new/pyusb-1.2.1/PKG-INFO
--- old/pyusb-1.1.1/PKG-INFO    2021-01-20 07:21:23.878200500 +0100
+++ new/pyusb-1.2.1/PKG-INFO    2021-07-09 04:56:56.593171600 +0200
@@ -1,17 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: pyusb
-Version: 1.1.1
+Version: 1.2.1
 Summary: Python USB access module
 Home-page: https://pyusb.github.io/pyusb
-Author: Robert Wlodarczyk
-Author-email: rob...@simplicityguy.com
+Author: Jonas Malaco
+Author-email: m...@jonasmalaco.com
 License: UNKNOWN
-Description: 
-        PyUSB offers easy USB devices communication in Python.
-        It should work without additional code in any environment with
-        Python >= 2.4, ctypes and a pre-built USB backend library
-        (currently: libusb 0.1.x, libusb 1.x, or OpenUSB).
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -25,16 +19,16 @@
 Classifier: Operating System :: MacOS :: MacOS X
 Classifier: Operating System :: Microsoft :: Windows :: Windows Vista
 Classifier: Operating System :: Microsoft :: Windows :: Windows 7
+Classifier: Operating System :: Microsoft :: Windows :: Windows 10
 Classifier: Operating System :: POSIX :: BSD :: FreeBSD
 Classifier: Operating System :: POSIX :: BSD :: NetBSD
 Classifier: Operating System :: POSIX :: BSD :: OpenBSD
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Operating System :: POSIX :: SunOS/Solaris
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: IronPython
 Classifier: Programming Language :: Python :: Implementation :: Jython
@@ -43,3 +37,13 @@
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: System :: Hardware :: Hardware Drivers
+Requires-Python: >=3.6.0
+License-File: LICENSE
+
+
+PyUSB offers easy USB devices communication in Python.
+It should work without additional code in any environment with
+Python >= 3.6, ctypes and a pre-built USB backend library
+(currently: libusb 1.x, libusb 0.1.x or OpenUSB).
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/README.rst new/pyusb-1.2.1/README.rst
--- old/pyusb-1.1.1/README.rst  2021-01-20 07:19:29.000000000 +0100
+++ new/pyusb-1.2.1/README.rst  2021-02-03 20:57:56.000000000 +0100
@@ -19,7 +19,7 @@
 <https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst>`_.
 
 PyUSB is being developed and tested on Linux and Windows, but it should work
-fine on any platform running Python >= 2.4, ctypes and at least one of the
+fine on any platform running Python >= 3.6, ctypes and at least one of the
 builtin backends.
 
 PyUSB supports libusb 1.0, libusb 0.1 and OpenUSB, but the user does not need
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/docs/internal/process.md 
new/pyusb-1.2.1/docs/internal/process.md
--- old/pyusb-1.1.1/docs/internal/process.md    1970-01-01 01:00:00.000000000 
+0100
+++ new/pyusb-1.2.1/docs/internal/process.md    2021-06-16 09:25:57.000000000 
+0200
@@ -0,0 +1,29 @@
+# Development process
+
+## Branches and tags
+
+The main branch is `master`, and it tracks the changes that will be included in
+the next release.  This branch is kept functional (barring the occasional bug),
+and its history is never rewritten.  Pull requests and patches should generally
+be developed for it (i.e. using it as base).
+
+Releases are tagged as `v<release>` (e.g. `v1.6.0`).  Updates to past minor
+releases are managed in branches following the naming scheme
+`<major>.<minor>.x-branch` (e.g. `1.5.x-branch`).
+
+Other branches and tags are generally for internal use, and may be deleted or
+rewritten at any time.
+
+## Release cycle and pre-release freeze periods
+
+Besides unscheduled patch releases, a new minor release is expected once every
+6 months.
+
+In the four weeks before a scheduled release, non-trivial changes, like complex
+new features or large refactorings, stop being merged into the main branch.
+This period is referred to as the _pre-release freeze._
+
+Occasionally, scheduled releases may be anticipated (if the activity is low and
+the freeze periods can be retroactively respected), downgraded (if it only
+contains bug fixes and documentation improvements) or skipped (if there are no
+changes).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/docs/tutorial.rst 
new/pyusb-1.2.1/docs/tutorial.rst
--- old/pyusb-1.1.1/docs/tutorial.rst   2020-09-14 18:09:28.000000000 +0200
+++ new/pyusb-1.2.1/docs/tutorial.rst   2021-02-03 20:57:56.000000000 +0100
@@ -19,7 +19,7 @@
     libusb 1.0, libusb 0.1 and OpenUSB.  You can write your own backend if you
     desire to.
 Portability:
-    PyUSB should run on any platform with Python >= 2.4, ctypes_ and at least
+    PyUSB should run on any platform with Python >= 3.6, ctypes_ and at least
     one of the supported builtin backends.
 Easiness:
     Communicating with an USB_ device has never been so easy! USB is a complex
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/pyusb.egg-info/PKG-INFO 
new/pyusb-1.2.1/pyusb.egg-info/PKG-INFO
--- old/pyusb-1.1.1/pyusb.egg-info/PKG-INFO     2021-01-20 07:21:23.000000000 
+0100
+++ new/pyusb-1.2.1/pyusb.egg-info/PKG-INFO     2021-07-09 04:56:56.000000000 
+0200
@@ -1,17 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: pyusb
-Version: 1.1.1
+Version: 1.2.1
 Summary: Python USB access module
 Home-page: https://pyusb.github.io/pyusb
-Author: Robert Wlodarczyk
-Author-email: rob...@simplicityguy.com
+Author: Jonas Malaco
+Author-email: m...@jonasmalaco.com
 License: UNKNOWN
-Description: 
-        PyUSB offers easy USB devices communication in Python.
-        It should work without additional code in any environment with
-        Python >= 2.4, ctypes and a pre-built USB backend library
-        (currently: libusb 0.1.x, libusb 1.x, or OpenUSB).
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -25,16 +19,16 @@
 Classifier: Operating System :: MacOS :: MacOS X
 Classifier: Operating System :: Microsoft :: Windows :: Windows Vista
 Classifier: Operating System :: Microsoft :: Windows :: Windows 7
+Classifier: Operating System :: Microsoft :: Windows :: Windows 10
 Classifier: Operating System :: POSIX :: BSD :: FreeBSD
 Classifier: Operating System :: POSIX :: BSD :: NetBSD
 Classifier: Operating System :: POSIX :: BSD :: OpenBSD
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Operating System :: POSIX :: SunOS/Solaris
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: IronPython
 Classifier: Programming Language :: Python :: Implementation :: Jython
@@ -43,3 +37,13 @@
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: System :: Hardware :: Hardware Drivers
+Requires-Python: >=3.6.0
+License-File: LICENSE
+
+
+PyUSB offers easy USB devices communication in Python.
+It should work without additional code in any environment with
+Python >= 3.6, ctypes and a pre-built USB backend library
+(currently: libusb 1.x, libusb 0.1.x or OpenUSB).
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/pyusb.egg-info/SOURCES.txt 
new/pyusb-1.2.1/pyusb.egg-info/SOURCES.txt
--- old/pyusb-1.1.1/pyusb.egg-info/SOURCES.txt  2021-01-20 07:21:23.000000000 
+0100
+++ new/pyusb-1.2.1/pyusb.egg-info/SOURCES.txt  2021-07-09 04:56:56.000000000 
+0200
@@ -13,6 +13,7 @@
 .github/workflows/run_tox.yml
 docs/faq.rst
 docs/tutorial.rst
+docs/internal/process.md
 etc/pyusb.rules
 pyusb.egg-info/PKG-INFO
 pyusb.egg-info/SOURCES.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/setup.py new/pyusb-1.2.1/setup.py
--- old/pyusb-1.1.1/setup.py    2021-01-20 07:19:29.000000000 +0100
+++ new/pyusb-1.2.1/setup.py    2021-05-14 01:00:41.000000000 +0200
@@ -69,16 +69,16 @@
     use_scm_version=pyusb_scm_version,
     setup_requires=setuptools_scm,
     description='Python USB access module',
-    author='Robert Wlodarczyk',
-    author_email='rob...@simplicityguy.com',
+    author='Jonas Malaco',
+    author_email='m...@jonasmalaco.com',
     url='https://pyusb.github.io/pyusb',
     packages=['usb', 'usb.backend'],
     long_description=
 """
 PyUSB offers easy USB devices communication in Python.
 It should work without additional code in any environment with
-Python >= 2.4, ctypes and a pre-built USB backend library
-(currently: libusb 0.1.x, libusb 1.x, or OpenUSB).
+Python >= 3.6, ctypes and a pre-built USB backend library
+(currently: libusb 1.x, libusb 0.1.x or OpenUSB).
 """,
     classifiers=[
         'Development Status :: 5 - Production/Stable',
@@ -94,16 +94,16 @@
         'Operating System :: MacOS :: MacOS X',
         'Operating System :: Microsoft :: Windows :: Windows Vista',
         'Operating System :: Microsoft :: Windows :: Windows 7',
+        'Operating System :: Microsoft :: Windows :: Windows 10',
         'Operating System :: POSIX :: BSD :: FreeBSD',
         'Operating System :: POSIX :: BSD :: NetBSD',
         'Operating System :: POSIX :: BSD :: OpenBSD',
         'Operating System :: POSIX :: Linux',
         'Operating System :: POSIX :: SunOS/Solaris',
-        'Programming Language :: Python :: 2.4',
-        'Programming Language :: Python :: 2.5',
-        'Programming Language :: Python :: 2.6',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
         # source(CPython,Jython,IronPython,PyPy): "The Long Term" section of
         # http://ojs.pythonpapers.org/index.php/tpp/article/viewFile/23/23
         'Programming Language :: Python :: Implementation :: CPython',
@@ -115,6 +115,7 @@
         'Topic :: Software Development :: Libraries',
         'Topic :: Software Development :: Libraries :: Python Modules',
         'Topic :: System :: Hardware :: Hardware Drivers'
-    ]
+    ],
+    python_requires='>=3.6.0'
 )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/tests/test_control.py 
new/pyusb-1.2.1/tests/test_control.py
--- old/pyusb-1.1.1/tests/test_control.py       2021-01-20 07:19:29.000000000 
+0100
+++ new/pyusb-1.2.1/tests/test_control.py       2021-06-30 07:19:16.000000000 
+0200
@@ -104,7 +104,7 @@
                     self.dev.bDescriptorType,
                     0
                 )
-        self.assertEqual(struct.unpack(dev_fmt, ret.tostring()), dev_descr)
+        self.assertEqual(struct.unpack(dev_fmt, ret.tobytes()), dev_descr)
 
     @methodtrace(utils.logger)
     def test_getset_configuration(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/tests/test_legacy.py 
new/pyusb-1.2.1/tests/test_legacy.py
--- old/pyusb-1.1.1/tests/test_legacy.py        2021-01-20 07:19:29.000000000 
+0100
+++ new/pyusb-1.2.1/tests/test_legacy.py        2021-06-30 07:19:16.000000000 
+0200
@@ -238,7 +238,7 @@
                     0,
                     struct.calcsize(dev_fmt))
 
-        self.assertEqual(struct.unpack(dev_fmt, ret.tostring()), dev_descr)
+        self.assertEqual(struct.unpack(dev_fmt, ret.tobytes()), dev_descr)
 
     def __write_read(self, write_fn, read_fn, ep):
         for data in (utils.get_array_data1(), utils.get_array_data2()):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/usb/_version.py 
new/pyusb-1.2.1/usb/_version.py
--- old/pyusb-1.1.1/usb/_version.py     2021-01-20 07:21:23.000000000 +0100
+++ new/pyusb-1.2.1/usb/_version.py     2021-07-09 04:56:56.000000000 +0200
@@ -1,4 +1,5 @@
 # coding: utf-8
 # file generated by setuptools_scm
 # don't change, don't track in version control
-version = '1.1.1'
+version = '1.2.1'
+version_tuple = (1, 2, 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/usb/backend/libusb0.py 
new/pyusb-1.2.1/usb/backend/libusb0.py
--- old/pyusb-1.1.1/usb/backend/libusb0.py      2021-01-20 07:19:29.000000000 
+0100
+++ new/pyusb-1.2.1/usb/backend/libusb0.py      2021-06-30 07:19:16.000000000 
+0200
@@ -619,28 +619,42 @@
 
     @methodtrace(_logger)
     def is_kernel_driver_active(self, dev_handle, intf):
-        if not hasattr(_lib, 'usb_get_driver_np'):
+        if sys.platform == 'linux':
+            # based on the implementation of libusb_kernel_driver_active()
+            # (see op_kernel_driver_active() in libusb/os/linux_usbfs.c)
+            # and the fact that usb_get_driver_np() is a wrapper for
+            # IOCTL_USBFS_GETDRIVER
+            try:
+                driver_name = self.__get_driver_name(dev_handle, intf)
+                # 'usbfs' is not considered a [foreign] kernel driver because
+                # it is what we use to access the device from userspace
+                return driver_name != b'usbfs'
+            except USBError as err:
+                # ENODATA means that no kernel driver is attached
+                if err.backend_error_code == -errno.ENODATA:
+                    return False
+                raise
+        elif sys.platform == 'darwin':
+            # on mac os/darwin we assume all users are running libusb-compat,
+            # which, in turn, uses libusb_kernel_driver_active()
+            try:
+                driver_name = self.__get_driver_name(dev_handle, intf)
+                return True
+            except USBError as err:
+                # ENODATA means that no kernel driver is attached
+                if err.backend_error_code == -errno.ENODATA:
+                    return False
+                raise
+        elif sys.platform.startswith('freebsd') or 
sys.platform.startswith('dragonfly'):
+            # this is similar to the Linux implementation, but the generic
+            # driver is called 'ugen' and usb_get_driver_np() simply returns an
+            # empty string is no driver is attached (see comments on PR #366)
+            driver_name = self.__get_driver_name(dev_handle, intf)
+            # 'ugen' is not considered a [foreign] kernel driver because
+            # it is what we use to access the device from userspace
+            return driver_name != b'ugen'
+        else:
             raise NotImplementedError(self.is_kernel_driver_active.__name__)
-        from errno import ENODATA
-        buf = usb.util.create_buffer(_USBFS_MAXDRIVERNAME + 1)
-        name, length = buf.buffer_info()
-        length *= buf.itemsize
-        # based on the implementation of libusb_kernel_driver_active
-        # (see libusb/os/linux_usbfs.c @@ op_kernel_driver_active):
-        # usb_get_driver_np fails with ENODATA when no kernel driver is bound,
-        # and if 'usbfs' is bound that means that a userspace program is
-        # controlling the device (e.g. using this very library)
-        try:
-            _check(_lib.usb_get_driver_np(
-                        dev_handle,
-                        intf,
-                        cast(name, c_char_p),
-                        length))
-            return cast(name, c_char_p).value != b'usbfs'
-        except USBError as err:
-            if err.backend_error_code == -ENODATA:
-                return False
-            raise err
 
     @methodtrace(_logger)
     def detach_kernel_driver(self, dev_handle, intf):
@@ -648,6 +662,19 @@
             raise NotImplementedError(self.detach_kernel_driver.__name__)
         _check(_lib.usb_detach_kernel_driver_np(dev_handle, intf))
 
+    def __get_driver_name(self, dev_handle, intf):
+        if not hasattr(_lib, 'usb_get_driver_np'):
+            raise NotImplementedError('usb_get_driver_np')
+        buf = usb.util.create_buffer(_USBFS_MAXDRIVERNAME + 1)
+        name, length = buf.buffer_info()
+        length *= buf.itemsize
+        _check(_lib.usb_get_driver_np(
+                    dev_handle,
+                    intf,
+                    cast(name, c_char_p),
+                    length))
+        return cast(name, c_char_p).value
+
     def __write(self, fn, dev_handle, ep, intf, data, timeout):
         address, length = data.buffer_info()
         length *= data.itemsize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/usb/control.py 
new/pyusb-1.2.1/usb/control.py
--- old/pyusb-1.1.1/usb/control.py      2021-01-20 07:19:29.000000000 +0100
+++ new/pyusb-1.2.1/usb/control.py      2021-06-23 20:33:11.000000000 +0200
@@ -64,6 +64,8 @@
 import usb.util as util
 import usb.core as core
 
+USBError = core.USBError
+
 def _parse_recipient(recipient, direction):
     if recipient is None:
         r = util.CTRL_RECIPIENT_DEVICE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyusb-1.1.1/usb/core.py new/pyusb-1.2.1/usb/core.py
--- old/pyusb-1.1.1/usb/core.py 2021-01-20 07:19:33.000000000 +0100
+++ new/pyusb-1.2.1/usb/core.py 2021-07-09 04:56:23.000000000 +0200
@@ -739,6 +739,16 @@
     will be used instead. This property can be set by the user at anytime.
     """
 
+    def __eq__(self, other):
+        if isinstance(other, self.__class__):
+            return (self.backend, self.bus, self.address) == \
+                   (other.backend, other.bus, other.address)
+        else:
+            return NotImplemented
+
+    def __hash__(self):
+        return hash((self.backend, self.bus, self.address))
+
     def __repr__(self):
         return "<" + self._str() + ">"
 

Reply via email to