Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

Do not attempt to detach a kernel driver under FreeBSD #67

Description

@dl8dtl

Under FreeBSD, the original code throws an exception:

Could not detach kernel driver from interface(0): [Errno None] b'Unknown error'

Kernel driver detaching is not implemented (and not necessary) under FreeBSD.

The following patch solved it for me:

--- usbtmc/usbtmc.py.orig       2017-01-18 05:35:14 UTC
+++ usbtmc/usbtmc.py
@@ -841,7 +841,7 @@
             raise NotImplementedError()
 
     def _release_kernel_driver(self, interface_number):
-        if os.name == 'posix':
+        if os.name == 'posix' and os.uname()[0] != 'FreeBSD':
             if self.device.is_kernel_driver_active(interface_number):
                 self.reattach.append(interface_number)
                 try:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions