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

Receive disconnect notification but not "connected" #10

Open
nicholasamorim opened this issue Aug 31, 2018 · 9 comments
Open

Receive disconnect notification but not "connected" #10

nicholasamorim opened this issue Aug 31, 2018 · 9 comments

Comments

@nicholasamorim
Copy link

nicholasamorim commented Aug 31, 2018

Hi, can you think of any reason why I can receive the disconnection notification but not the connected notification?

There's no errors whatsoever, I simply don't get the connected notification. I've tried a few different usb devices and all the same.

Using Swift 4 in High Sierra.

@nicholasamorim
Copy link
Author

I've dug into the code and noticed the problem lies in here:

// USB device object is no longer needed.
IOObjectRelease(usbDevice)

// Dereference pointer for the plug-in interface
if (kr != kIOReturnSuccess) {
    continue
}

It hits that continue and never posts the notification.
If I comment that continue out, to see what happens, this happens:

Unable to get Plug-In Interface

@nicholasamorim
Copy link
Author

So, upon further investigation, it stops working on 10.13 deployment target.

Works fine if I use older versions, though.

@fdidron
Copy link

fdidron commented Sep 27, 2019

@nicholasamorim Reviving an old thread, but did you find a fix for this ?

@fdidron
Copy link

fdidron commented Sep 27, 2019

@nicholasamorim Nevermind i found the answer after some serious head scratching. On Xcode 11, I had to tick the USB option on in the Project file > Targets > {APP NAME} > Sigining & Capabilities > App Sandbox

@sbilstein
Copy link

@fdidron it took you a year to respond to the first poster and now a year later, I am thanking you for your comment :)

@txbrown
Copy link

txbrown commented Nov 9, 2020

@nicholasamorim Nevermind i found the answer after some serious head scratching. On Xcode 11, I had to tick the USB option on in the Project file > Targets > {APP NAME} > Sigining & Capabilities > App Sandbox

This should be added somewhere in the docs!

@txbrown
Copy link

txbrown commented Nov 9, 2020

@fdidron so many thanks!

@fdidron
Copy link

fdidron commented Dec 10, 2020

@sbilstein @txbrown monthes later I'm back at it and I'm running into the following issue on a M1 Mac. As soon as I add the App Sandbox entitlement to my application and run it, it crashes

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x192b73110) in libsystem_secinit.dylib`_libsecinit_appsandbox.cold.5:

@txbrown
Copy link

txbrown commented Jan 11, 2021

@fdidron hey sorry for the much late reply. I realised for me was easier to wrap libusb in a swift module and use that. took me way less time than fighting to understand this library without docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants