mfgtools icon indicating copy to clipboard operation
mfgtools copied to clipboard

Failure claim interface with MacOS Big Sur

Open almatthew opened this issue 4 years ago • 10 comments

I'm unable to flash an i.mx6 device using uuu version uuu_1.4.43 in MacOS Big Sur. Specifically, I get the error:

20:34    1/ 2 [Failure claim interface               ] ... 

Digging a bit more in dmesg, I find:

[  977.389928]: 000977.389927 uuu@: AppleUSBHostUserClient::openGated: could not open provider Freescale Flash. provider already opened for exclusive access by a kernel client

Looking at ioreg, I find:

| +-o AppleUSB20HubPort@14340000  <class IORegistryEntry:IOService:AppleUSBHostPort:AppleUSBHubPort:AppleUSB20HubPort, id 0x100000ad2, registered, matched, active, busy 0 (31 m$
  |   +-o SE Blank ARIK@14340000  <class IORegistryEntry:IOService:IOUSBNub:IOUSBDevice, id 0x100000b1a, registered, matched, active, busy 0 (31 ms), retain 32>
  |     | {
  |     |   "sessionID" = 44121558910
  |     |   "USBSpeed" = 3
  |     |   "IOServiceLegacyMatchingRegistryID" = 4294970140
  |     |   "idProduct" = 84
  |     |   "iManufacturer" = 1
  |     |   "bDeviceClass" = 0
  |     |   "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"DriverPowerState"=0,"ChildrenPowerState"=1,"CurrentPowerS$
  |     |   "bcdDevice" = 1
  |     |   "bMaxPacketSize0" = 64
  |     |   "iProduct" = 2
  |     |   "iSerialNumber" = 0
  |     |   "bNumConfigurations" = 1
  |     |   "USB Product Name" = "SE Blank ARIK"
  |     |   "USB Address" = 2
  |     |   "locationID" = 338952192
  |     |   "bDeviceSubClass" = 0
  |     |   "bcdUSB" = 512
  |     |   "Built-In" = No
  |     |   "non-removable" = "no"
  |     |   "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
  |     |   "kUSBCurrentConfiguration" = 1
  |     |   "bDeviceProtocol" = 0
  |     |   "USBPortType" = 0
  |     |   "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
  |     |   "USB Vendor Name" = "Freescale SemiConductor Inc "
  |     |   "Device Speed" = 2
  |     |   "idVendor" = 5538
  |     |   "kUSBProductString" = "SE Blank ARIK"
  |     |   "IOGeneralInterest" = "IOCommand is not serializable"
  |     |   "kUSBAddress" = 2
  |     |   "kUSBVendorString" = "Freescale SemiConductor Inc "
  |     |   "IOClassNameOverride" = "IOUSBDevice"
  |     | }
  |     | 
  |     +-o AppleUSBHostLegacyClient  <class IORegistryEntry:IOService:AppleUSBHostLegacyClient, id 0x100000b1d, !registered, !matched, active, busy 0, retain 8>
  |     +-o AppleUSBHostCompositeDevice  <class IORegistryEntry:IOService:AppleUSBHostCompositeDevice, id 0x100000b25, !registered, !matched, active, busy 0, retain 4>
  |     +-o Freescale Flash@0  <class IORegistryEntry:IOService:IOUSBNub:IOUSBInterface, id 0x100000b27, registered, matched, active, busy 0 (23 ms), retain 12>
  |     | +-o AppleUserUSBHostHIDDevice  <class IORegistryEntry:IOService:IOHIDDevice:AppleUserHIDDevice, id 0x100000b29, registered, matched, active, busy 0 (3 ms), retain 13>
  |     |   +-o IOHIDInterface  <class IORegistryEntry:IOService:IOHIDInterface, id 0x100000b4a, registered, matched, active, busy 0 (2 ms), retain 9>
  |     +-o Google Chrome  <class IORegistryEntry:IOService:IOUserClient:IOUSBDeviceUserClient:IOUSBDeviceUserClientV2:IOUSBInterfaceUserClient:IOUSBInterfaceUserClientV2:IOUSBIn$

This same devices flashes just fine in Linux. This appears to be due to some driver conflict in MacOS, but it is not clear to me how to further debug this. Any support is greatly appreciated.

almatthew avatar Dec 27 '20 23:12 almatthew

Nikolas Grottendieck [email protected] push mac os support. I have not MAC. Nikolas tested at Catalina.

It because that can't remove mac OS HID driver for IMX devices.

nxpfrankli avatar Dec 28 '20 02:12 nxpfrankli

HID driver for IMX devices.

Is there a way to manually remove/disable the macOS HID driver for IMX devices?

almatthew avatar Dec 28 '20 18:12 almatthew

So far, I have not find a way to do that because need apply key to do that.

nxpfrankli avatar Dec 29 '20 00:12 nxpfrankli

The project we were using this for was put on hold in fall last year which is why I no longer have access to the environment.

However, I think that either restarting or logging out/in again may resolve the issue. I do remember, though, that we experienced issues seemingly unrelated to the hardware/software combination (±1 MacBook Pro HW version and/or macOS version) that we were never able to entirely resolve/reliably reproduce.

Okeanos avatar Jan 18 '21 17:01 Okeanos

Hi,

I'm facing the same issue on macOS Catalina with libuuu_1.4.43-7-g48764e8. Sometimes it works, but most often it does not...

Using dmesg, when running uuu utility I have:

000757.802629 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB3.1 Hub. provider already opened for exclusive access by a kernel client
000757.802969 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB2.1 Hub. provider already opened for exclusive access by a kernel client
000757.803294 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 3.1 Hub. provider already opened for exclusive access by a kernel client
000757.803412 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.803475 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.803524 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.803571 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.803617 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804019 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804075 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804124 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804171 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804217 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804308 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804354 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804467 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804527 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804577 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804677 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804726 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804785 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804830 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804875 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.804967 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805012 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805057 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805141 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805185 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805275 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805320 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805365 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805410 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805455 uuu@: AppleUSBHostUserClient::start: missing entitlement com.apple.ibridge.control
000757.805765 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 2.0 Hub. provider already opened for exclusive access by a kernel client
000757.806006 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 2.0 Hub. provider already opened for exclusive access by a kernel client
000757.806478 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 10/100/1000 LAN. provider already opened for exclusive access by a kernel client
000757.806794 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 3.1 Hub. provider already opened for exclusive access by a kernel client
000757.807074 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 2.0 Hub. provider already opened for exclusive access by a kernel client
000757.807803 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 2.0 Hub. provider already opened for exclusive access by a kernel client
000757.808017 uuu@: AppleUSBHostUserClient::openGated: could not open provider USB 3.1 Hub. provider already opened for exclusive access by a kernel client
AppleUserUSBHostHIDDevice:0x100000a6b message: 0xe0000101 from: 0x100000a65 0

000758.017069 uuu@: AppleUSBHostUserClient::openGated: could not open provider Freescale Flash. provider already opened for exclusive access by a kernel client

When I plug the i.MX6ULL to macOS USB port, I have:

Notice - new kext com.apple.driver.usb.AppleUSBHostPlatformProperties, v1.2 matches prelinked kext but can't determine if executables are the same (no UUIDs).
considerRebuildOfPrelinkedKernel prebuild rebuild has expired

AppleUserUSBHostHIDDevice:0x100000ba1 start (state:0x0)

[IOUserUSBHostHIDDevice.cpp:466][0x100000ba1] Open interface: 0x100000b9b
[IOUserUSBHostHIDDevice.cpp:606][0x100000ba1] HID descriptor interface:0 index:0 length:76 76 76
AppleUserUSBHostHIDDevice:0x100000ba1 start (state:0x4)

AppleUserUSBHostHIDDevice:0x100000ba1 start

[ElementContainer] Element value capacity 512

[ElementContainer] Report count: 5

[ElementContainer] Report ID: 0 input:0 output:0 feature:0

[ElementContainer] Report ID: 1 input:8 output:136 feature:8

[ElementContainer] Report ID: 2 input:8 output:8200 feature:8

[ElementContainer] Report ID: 3 input:40 output:8 feature:8

[ElementContainer] Report ID: 4 input:520 output:8 feature:8

[IOUserUSBHostHIDDevice.cpp:310][0x100000ba1] inPipe:1  inputReportSize:65 inMaxPacketSize:64 inBufferSize:128
[IOUserUSBHostHIDDevice.cpp:335][0x100000ba1] outPipe:0  outMaxPacketSize:0
[AppleUserUSBHostHIDDevice.cpp:114][0x100000ba1] Start ret: 0x0
DK: AppleUserUSBHostHIDDevice-0x100000ba1::start(Freescale Flash-0x100000b9b) ok
AppleUserUSBHostHIDDevice:0x100000ba1 creating interfaces

When I unplug the i.MX6ULL from USB port, I have:

[IOUserUSBHostHIDDevice.cpp:752][0x100000a6b] CompleteInReport:0xe00002ed
[IOUserUSBHostHIDDevice.cpp:670][0x100000a6b] Schedule retry reason:0xe00002ed count:9 deadline:50ms
[IOUserUSBHostHIDDevice.cpp:410][0x100000a6b] Close interface: 0x100000a65 0x0
[AppleUserUSBHostHIDDevice.cpp:125][0x100000a6b] Stop: 0x0
DK: AppleUserUSBHostHIDDevice-0x100000a6b:force close (Freescale Flash-0x100000a65)
AppleUserUSBHostHIDDevice:0x100000a6b message: 0xe0000010 from: 0x100000a65 0

AppleUserUSBHostHIDDevice:0x100000a6b stop

AppleUserUSBHostHIDDevice:0x100000a6b handleStop src: 0 srfc: 0 srtc: 0 srt: 0 grc: 0 grfc: 0 grtc: 0 grt: 0 irc: 0 irt: 0

And the error is:

❯ uuu -v -V flash-imx6ull.auto
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.4.43-7-g48764e8

Build in config:
        Pctl     Chip            Vid     Pid     BcdVersion
        ==================================================
        SDPS:    MX8QXP          0x1fc9  0x012f  [0x0002..0xffff]
        SDPS:    MX8QM           0x1fc9  0x0129  [0x0002..0xffff]
        SDPS:    MX8DXL          0x1fc9  0x0147
        SDPS:    MX28            0x15a2  0x004f
        SDPS:    MX815           0x1fc9  0x013e
        SDPS:    MX865           0x1fc9  0x0146
        SDP:     MX7D            0x15a2  0x0076
        SDP:     MX6Q            0x15a2  0x0054
        SDP:     MX6D            0x15a2  0x0061
        SDP:     MX6SL           0x15a2  0x0063
        SDP:     MX6SX           0x15a2  0x0071
        SDP:     MX6UL           0x15a2  0x007d
        SDP:     MX6ULL          0x15a2  0x0080
        SDP:     MX6SLL          0x1fc9  0x0128
        SDP:     MX7ULP          0x1fc9  0x0126
        SDP:     MXRT106X        0x1fc9  0x0135
        SDP:     MX8MM           0x1fc9  0x0134
        SDP:     MX8MQ           0x1fc9  0x012b
        SDPU:    SPL             0x0525  0xb4a4  [0x0000..0x04ff]
        SDPV:    SPL1            0x0525  0xb4a4  [0x0500..0x9998]
        SDPU:    SPL             0x0525  0xb4a4  [0x9999..0x9999]
        SDPU:    SPL             0x3016  0x1001  [0x0000..0x04ff]
        SDPV:    SPL1            0x3016  0x1001  [0x0500..0x9998]
        FBK:                     0x066f  0x9afe
        FBK:                     0x066f  0x9bff
        FB:                      0x0525  0xa4a5
        FB:                      0x18d1  0x0d02
        FB:                      0x3016  0x0001
Wait for Known USB Device Appear...
New USB Device Attached at 20:2
20:2>Start Cmd:SDP: boot -f vsom-6ull-fb.bin
libusb: error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access
20:2>Fail Failure claim interface(0.003s)

roddehugo avatar Feb 17 '21 14:02 roddehugo

I had same issue, maybe this is related to https://github.com/libusb/libusb/issues/519 ?

stu85010 avatar May 28 '21 08:05 stu85010

FYI, I gave up running the utility under macOS and now rely on a Vagrant machine:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "debian/buster64"
  config.vm.hostname = "buster64.box"
  config.vm.network "private_network", type: "dhcp"

  config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.customize [
      "modifyvm", :id,
      "--name", "mfgtools",
      "--cpus", 1,
      "--memory", "512",
      "--usb", "on",
      "--usbehci", "on",
    ]
    vb.customize [
        'usbfilter',
        'add', '0',
        '--target', :id,
        '--name', 'SE Blank 6ULL',
        '--vendorid', '15a2',
        '--productid', '0080',
    ]
    vb.customize [
        'usbfilter',
        'add', '1',
        '--target', :id,
        '--name', 'USB Gadget',
        '--vendorid', '0525',
        '--productid', 'a4a5',
    ]
  end

  config.vm.provision "shell", env: {"VERSION" => "1.4.72"}, inline: <<-SHELL
    apt-get update
    apt-get upgrade -y
    apt-get install -y \
        build-essential cmake pkg-config \
        libbz2-dev libssl-dev libusb-1.0-0-dev libzip-dev
    wget -q -O /usr/local/bin/uuu \
        https://github.com/NXPmicro/mfgtools/releases/download/uuu_${VERSION}/uuu
    chmod +x /usr/local/bin/uuu
    uuu -udev >> /etc/udev/rules.d/99-uuu.rules
    udevadm control --reload-rules
  SHELL
end

And then, from within the same directory as Vagrantfile:

vagrant ssh -c 'uuu /vagrant/your-uuu-script.uuu'

roddehugo avatar May 28 '21 09:05 roddehugo

Thanks, at least it is one worked solution.

nxpfrankli avatar May 28 '21 15:05 nxpfrankli

It seems it was mitigated in upstream libusb: https://github.com/libusb/libusb/pull/911.

I've installed the latest unreleased version of libusb and uuu works well for me:

brew install --head libusb
brew unlink libusb
brew link --head libusb

dzhlobo avatar Aug 14 '21 13:08 dzhlobo

The libusb update fixes the "failure claim interface" issue for me in MacOS Mojave, but in Catalina I always get Bulk(W):LIBUSB_ERROR_TIMEOUT. Using a VM always fails

timredfern avatar Nov 06 '21 09:11 timredfern