Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidapi does not recognize a device on a Mac M2 under Sonoma 14.7.2, but on Linux and Windows in Parallels #715

Closed
felias-fogg opened this issue Jan 22, 2025 · 10 comments
Labels
device-specific Issues/PRs related to a specific device macOS Related to macOS backend

Comments

@felias-fogg
Copy link

Hi,

I try to work with an Atmel-ICE device (hardware debugger), and it is not recognized on my M2 Mac under Sonoma 14.7.2. Running hidapitester and hidapi_enum.py gives very fishy results:


> hidapi_enum.py
------------------------------------------------------------
path:                "DevSrvsID:4295190229"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          65280
usage:               11
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190229"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          65280
usage:               20
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4294969535"
vendor_id:           0x0000
product_id:          0x0000
serial_number:       ""
release_number:      0x0000
manufacturer_string: "Apple"
product_string:      ""
usage_page:          65292
usage:               5
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190243"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          65280
usage:               3
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295232238"
vendor_id:           0x05ac
product_id:          0x0221
serial_number:       ""
release_number:      0x0071
manufacturer_string: "Apple, Inc"
product_string:      "Apple Keyboard"
usage_page:          1
usage:               6
interface_number:    0

------------------------------------------------------------
path:                "DevSrvsID:4295190237"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          1
usage:               2
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190237"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          1
usage:               1
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190237"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          13
usage:               5
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190237"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0000
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          65280
usage:               12
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4294969376"
vendor_id:           0x0000
product_id:          0x0000
serial_number:       ""
release_number:      0x0000
manufacturer_string: "APPL"
product_string:      "BTM"
usage_page:          65280
usage:               72
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295190222"
vendor_id:           0x004c
product_id:          0x0269
serial_number:       "4c-57-ca-eb-ff-c5"
release_number:      0x0311
manufacturer_string: "Apple Inc."
product_string:      "Magic Mouse"
usage_page:          0
usage:               1
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4294969534"
vendor_id:           0x0000
product_id:          0x0000
serial_number:       ""
release_number:      0x0000
manufacturer_string: "Apple"
product_string:      ""
usage_page:          65280
usage:               255
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295221964"
vendor_id:           0x056d
product_id:          0x4065
serial_number:       ""
release_number:      0x8000
manufacturer_string: "EIZO corporation"
product_string:      "EIZO USB HID Monitor"
usage_page:          128
usage:               1
interface_number:    0

------------------------------------------------------------
path:                "DevSrvsID:4294968858"
vendor_id:           0x0000
product_id:          0x0000
serial_number:       ""
release_number:      0x0000
manufacturer_string: "Apple"
product_string:      "Headset"
usage_page:          12
usage:               1
interface_number:    -1

------------------------------------------------------------
path:                "DevSrvsID:4295232242"
vendor_id:           0x05ac
product_id:          0x0221
serial_number:       ""
release_number:      0x0071
manufacturer_string: "Apple, Inc"
product_string:      "Apple Keyboard"
usage_page:          12
usage:               1
interface_number:    1

------------------------------------------------------------
path:                "DevSrvsID:4294971079"
vendor_id:           0x046d
product_id:          0x085e
serial_number:       "D1C08FAB"
release_number:      0x0317
manufacturer_string: ""
product_string:      "Logitech BRIO"
usage_page:          12
usage:               1
interface_number:    5

------------------------------------------------------------
path:                "DevSrvsID:4294969531"
vendor_id:           0x0000
product_id:          0x0000
serial_number:       ""
release_number:      0x0000
manufacturer_string: "Apple"
product_string:      ""
usage_page:          65292
usage:               1
interface_number:    -1

So, no ATMEL-ICE, but a lot of devices with a VIDPID of 0:0. BTW, the correct entry (recorded under Ubuntu 24.04 (ARM64) run in the Paralleles Emulator) looks like that:

path:                "1-1:1.0"
vendor_id:           0x03eb
product_id:          0x2141
serial_number:       "J42700018184"
release_number:      0x0101
manufacturer_string: "Atmel Corp."
product_string:      "Atmel-ICE CMSIS-DAP"
usage_page:          0
usage:               0
interface_number:    0

Also under Windows11(ARM), and on my Intel-Mac, everything works. So, I am at loss here.

Cheers,
Bernhard

@Youw
Copy link
Member

Youw commented Jan 23, 2025

but a lot of devices with a VIDPID of 0:0. BTW

The manufacturer is Apple, and the bus is probably not USB, so that's expected on macOS.

(recorded under Ubuntu 24.04 (ARM64) run in the Paralleles Emulator)

Is it run on that mac machine?

Maybe you've passed the USB device into you VM env and the host USB/HID driver gets disabled?

What is the output of ioreg -p IOUSB or ioreg -p IOUSB -w0 -l on your mac?

@Youw Youw added macOS Related to macOS backend device-specific Issues/PRs related to a specific device labels Jan 23, 2025
@felias-fogg
Copy link
Author

Hi,

(recorded under Ubuntu 24.04 (ARM64) run in the Paralleles Emulator)

Is it run on that mac machine?

Yes. Same machine.

Maybe you've passed the USB device into you VM env and the host USB/HID driver gets disabled?

Oops. Nah, I disabled the USB access before, of course. What is more, a lot of programs can access the Atmel-ICE, e.g., avrdude and MPLABX.

What is the output of ioreg -p IOUSB or ioreg -p IOUSB -w0 -l on your mac?

Here we go (and the Atmel-ICE is enumerated):

   |
   |
  +-o AppleEmbeddedUSBXHCIASMedia3142@08000000  <class AppleEmbeddedUSBXHCIASMedia3142, id 0x1000008fb, registered, matched, active, busy 0 (4001 ms), retain 146>
    | {
    |   "IOClass" = "AppleEmbeddedUSBXHCIASMedia3142"
    |   "kUSBSleepPortCurrentLimit" = 2100
    |   "UsbHostControllerSoftRetryPolicy" = 0
    |   "IOPersonalityPublisher" = "com.apple.driver.usb.AppleEmbeddedUSBXHCIPCI"
    |   "IOMatchedAtBoot" = Yes
    |   "IOPowerManagement" = {"ChildrenPowerState"=3,"DevicePowerState"=2,"CurrentPowerState"=3,"CapabilityFlags"=32768,"MaxPowerState"=3,"DriverPowerState"=0}
    |   "IOProviderClass" = "IOPCIDevice"
    |   "kUSBWakePowerSupply" = 3100
    |   "IOProbeScore" = 10000
    |   "IOUserClientClass" = "AppleASMedia3142USBXHCIUserClient"
    |   "locationID" = 134217728
    |   "UsbRTD3Supported" = Yes
    |   "kUSBWakePortCurrentLimit" = 2100
    |   "IONameMatch" = "usb-xhci,ASM3142"
    |   "CFBundleIdentifierKernel" = "com.apple.driver.usb.AppleEmbeddedUSBXHCIPCI"
    |   "kUSBSleepPowerSupply" = 3100
    |   "IOMatchCategory" = "IODefaultMatchCategory"
    |   "CFBundleIdentifier" = "com.apple.driver.usb.AppleEmbeddedUSBXHCIPCI"
    |   "Revision" = <0103>
    |   "IONameMatched" = "usb-xhci,ASM3142"
    |   "UsbHostControllerUSB4LPMPolicy" = 1
    |   "UsbHostControllerTierLimit" = 6
    |   "UsbBusCurrentPoolID" = 4294969595
    |   "controller-statistics" = {"kControllerStatIOCount"=120703,"kControllerStatPowerStateTime"={"kPowerStateOff"="768ms (0%)","kPowerStateSleep"="39061981ms (11%)","kPowerStateOn"="287372591ms (88%)","kPowerStateSuspended"="3460ms (0%)"},"kControllerStatSpuriousInterruptCount"=0}
    |   "kUSBSleepSupported" = Yes
    | }
    | 
    +-o Keyboard Hub@08300000  <class IOUSBHostDevice, id 0x100040ad6, registered, matched, active, busy 0 (84 ms), retain 231>
    | | {
    | |   "kUSBSerialNumberString" = "000000000000"
    | |   "bDeviceClass" = 9
    | |   "bDeviceSubClass" = 0
    | |   "iSerialNumber" = 3
    | |   "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
    | |   "iProduct" = 2
    | |   "USB Serial Number" = "000000000000"
    | |   "USB Vendor Name" = "Apple, Inc."
    | |   "USBSpeed" = 3
    | |   "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"DriverPowerState"=0,"ChildrenPowerState"=2,"CurrentPowerState"=2}
    | |   "bNumConfigurations" = 1
    | |   "kUSBProductString" = "Keyboard Hub"
    | |   "kUSBConfigurationCurrentOverride" = 500
    | |   "kUSBVendorString" = "Apple, Inc."
    | |   "USB Product Name" = "Keyboard Hub"
    | |   "iManufacturer" = 1
    | |   "idVendor" = 1452
    | |   "Device Speed" = 2
    | |   "kUSBCurrentConfiguration" = 1
    | |   "idProduct" = 4102
    | |   "bcdDevice" = 38421
    | |   "UsbDeviceSignature" = <ac0506101596303030303030303030303030090001090000>
    | |   "kUSBContainerID" = "87427563-98aa-4741-bc56-c0adb3e32632"
    | |   "sessionID" = 5213839951327
    | |   "USB Address" = 3
    | |   "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
    | |   "kUSBWakePortCurrentLimit" = 500
    | |   "UsbExclusiveOwner" = "AppleUSB20KeyboardHub"
    | |   "USBPortType" = 0
    | |   "bDeviceProtocol" = 1
    | |   "locationID" = 137363456
    | |   "kUSBAddress" = 3
    | |   "bcdUSB" = 512
    | |   "kUSBSleepPortCurrentLimit" = 500
    | |   "bMaxPacketSize0" = 64
    | |   "IOGeneralInterest" = "IOCommand is not serializable"
    | |   "kUSBHubPortSequenceDelay" = 350
    | | }
    | | 
    | +-o Apple Keyboard@08320000  <class IOUSBHostDevice, id 0x100040ae5, registered, matched, active, busy 0 (61 ms), retain 233>
    |     {
    |       "sessionID" = 5213872723347
    |       "USBSpeed" = 2
    |       "idProduct" = 545
    |       "iManufacturer" = 1
    |       "bDeviceClass" = 0
    |       "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"DriverPowerState"=0,"ChildrenPowerState"=2,"CurrentPowerState"=2}
    |       "bcdDevice" = 113
    |       "bMaxPacketSize0" = 8
    |       "iProduct" = 2
    |       "iSerialNumber" = 0
    |       "bNumConfigurations" = 1
    |       "kUSBContainerID" = "87427563-98aa-4741-bc56-c0adb3e32632"
    |       "UsbDeviceSignature" = <ac0521027100000000030101030000>
    |       "locationID" = 137494528
    |       "bDeviceSubClass" = 0
    |       "bcdUSB" = 512
    |       "USB Product Name" = "Apple Keyboard"
    |       "USB Address" = 4
    |       "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
    |       "kUSBCurrentConfiguration" = 1
    |       "bDeviceProtocol" = 0
    |       "USBPortType" = 1
    |       "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
    |       "USB Vendor Name" = "Apple, Inc"
    |       "Device Speed" = 0
    |       "idVendor" = 1452
    |       "kUSBProductString" = "Apple Keyboard"
    |       "IOGeneralInterest" = "IOCommand is not serializable"
    |       "kUSBAddress" = 4
    |       "kUSBVendorString" = "Apple, Inc"
    |     }
    |     
    +-o Atmel-ICE CMSIS-DAP@08400000  <class IOUSBHostDevice, id 0x1000573f6, registered, matched, active, busy 0 (41 ms), retain 42>
        {
          "sessionID" = 7812476325903
          "USBSpeed" = 3
          "idProduct" = 8513
          "iManufacturer" = 1
          "bDeviceClass" = 239
          "IOPowerManagement" = {"PowerOverrideOn"=Yes,"DevicePowerState"=2,"CurrentPowerState"=2,"CapabilityFlags"=32768,"MaxPowerState"=2,"DriverPowerState"=0}
          "bcdDevice" = 257
          "bMaxPacketSize0" = 64
          "iProduct" = 2
          "iSerialNumber" = 3
          "bNumConfigurations" = 1
          "UsbDeviceSignature" = <eb03412101014a3432373030303138313834ef0201030000ffffff>
          "USB Product Name" = "Atmel-ICE CMSIS-DAP"
          "locationID" = 138412032
          "bDeviceSubClass" = 2
          "bcdUSB" = 512
          "kUSBSerialNumberString" = "J42700018184"
          "USB Address" = 12
          "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
          "kUSBCurrentConfiguration" = 1
          "bDeviceProtocol" = 1
          "USBPortType" = 0
          "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
          "USB Vendor Name" = "Atmel Corp."
          "Device Speed" = 2
          "idVendor" = 1003
          "kUSBProductString" = "Atmel-ICE CMSIS-DAP"
          "USB Serial Number" = "J42700018184"
          "IOGeneralInterest" = "IOCommand is not serializable"
          "kUSBAddress" = 12
          "kUSBVendorString" = "Atmel Corp."
        }


@felias-fogg
Copy link
Author

felias-fogg commented Jan 24, 2025

I guess, this is a Mac problem and not a problem of the library. The Mac tool hidutil gives the same buggy output as hidapitest and misses to list Atmel-ICE. Looking at what libraries hidutil uses, libhidapi is not among them.

@mcuee
Copy link
Member

mcuee commented Jan 24, 2025

Hmm, this is very strange. Do you have other Macs to check whether this is specific to macOS 14 or Apple Silicon CPU.

Atmel ICE is supported by avrdude under Linux/Windows/macOS/FreeBSD/etc, using hidapi. There is a bug with TPI parts but I have not heard issues like what you have mentioned here.

Unfortunately I do not have Atmel ICE myself to check on my Mac Mini M1 (running macOS 15.2 now).

Reference:

@mcuee
Copy link
Member

mcuee commented Jan 24, 2025

BTW, is it possible for you to upgrade your macOS version to the latest 15.2 verion and try again?

Apple is not really that good in terms of legacy USB device support compared to Windows and Linux and often there are breaking changes from time to time. But often the bug got fixed in later release.

@felias-fogg
Copy link
Author

I upgraded on my Intel Mac from Ventura to Sonoma, and the Atmel-ICE is still listed when using hidapitester or hidutil. So, it does not seem to be an OS problem.

I'll try upgrading to 15.2. on my ARM Mac hoping that the problem vanishes.

@felias-fogg
Copy link
Author

Hi,

The upgrade to 15.2 on my ARM Mac did not help.

@felias-fogg
Copy link
Author

It is a mystery to me, why the enumeration of hid devices leaves out the Atmel-ICE only on ARM Macs. However, I guess, I found a way around it (using what avrdude apparently does). If the hidapi enumeration fails, it goes through all USB devices and looks for the right VID:PID pair.

@felias-fogg
Copy link
Author

Turned out that it was just an issue of an old extension that grabbed the device.

@Youw
Copy link
Member

Youw commented Jan 29, 2025

Turned out that it was just an issue of an old extension that grabbed the device.

Sounds about right. Thank's for letting us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device-specific Issues/PRs related to a specific device macOS Related to macOS backend
Projects
None yet
Development

No branches or pull requests

3 participants