Brandon-T / iOUSB

MIT License
36 stars 5 forks source link

iPhoneOS 13 / iOS 13 #3

Closed brandonros closed 4 years ago

brandonros commented 4 years ago
[-46691881.-546876] [00000303] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources

image

Brandon-T commented 4 years ago

@brandonros Are you running this on a jailbroken device? I will investigate this issue and report back.

brandonros commented 4 years ago

I’m not. I’m experimenting if IOKit USB support is possible on iOS/iPhoneOS without jailbreak. Do you think that’s a dumb idea? My device is listed, I just can’t tell for sure if a user client is auto-spawend by the kernel that we can connect to.

brandonros commented 4 years ago

Any update? Do you specifically know what changes/gets reconfigured/gets unlocked when a phone is jailbroken versus vanilla that allows IOService connections/clients for USB?

Brandon-T commented 4 years ago

@brandonros I am able to use this on my iPhone on iOS 13.2.2. When NOT jailbroken, it has limited access to the USB port. When jailbroken (I used checkra1n), it has full access to the port and can read and write.

brandonros commented 4 years ago

@brandonros I am able to use this on my iPhone on iOS 13.2.2. When NOT jailbroken, it has limited access to the USB port. When jailbroken (I used checkra1n), it has full access to the port and can read and write.

limited as in “able to transfer data between the phone and the device” or just read that the device is connected?

Brandon-T commented 4 years ago

@brandonros I am able to use this on my iPhone on iOS 13.2.2. When NOT jailbroken, it has limited access to the USB port. When jailbroken (I used checkra1n), it has full access to the port and can read and write.

limited as in “able to transfer data between the phone and the device” or just read that the device is connected?

When not jailbroken, I am able to read SOME things from the port. When jailbroken and outside the sandbox, I am able to read and write to any device (Nintendo Switch included).

When jailbroken (r/w access): IMG_4569

Brandon-T commented 4 years ago

@brandonros

When not jailbroken I get:

image

It seems to be just that the iOS app is sandboxed is all. I'm not 100% sure but I'm fairly certain it's because of sandboxing as that's currently the only difference. I wasn't able to find any entitlements that allow it normally on an iPhone but I know Apple's photos app has special entitlements that allow it to access the USB port and read/write to it.

brandonros commented 4 years ago

How do you sandbox / not sandbox the app? Is it sandboxed when you run it from XCode but not sandboxed when built for release?

Brandon-T commented 4 years ago

How do you sandbox / not sandbox the app? Is it sandboxed when you run it from XCode but not sandboxed when built for release?

You need these entitlements: com.apple.security.app-sandbox

If you run it from Xcode, it is installed as a normal application. If the application is installed via a .deb or manually installed to /Applications on the iPhone, it will have be out of the sandbox.

The code for that is in main.mm: https://github.com/Brandon-T/iOUSB/blob/master/iOSNXLauncher/iOSNXLauncher/main.mm#L51

and the entitlements are: com.apple.private.security.no-container. Can also just use the one I mentioned previously.

I have also been trying to find ways to access the USB port with full access without a jailbreak. So far, no luck. I can only access it fully with a jailbreak. I'll continue to search but it's definitely not easy lol.

I have come across a couple other entitlements such as: com.apple.security.device.usb but I haven't tried it yet and getting Xcode to accept it is a task in and of itself.

brandonros commented 4 years ago

Sorry to drag this out and thank you for being super helpful.

You are saying, as long as I do this:

image

I won't get out of resources when trying to interact with a USB device on a non-jailbroken iPhone?

Brandon-T commented 4 years ago

No. Whatever you do, you WILL get that error on a non-jailbroken device. I have not been able to find a way to get full access on a non-jailbroken device.

The instructions I gave is for when you are jailbroken. I have tried many times unsuccessfully to get full-access on non-jailbroken device. I will continue to look into it but I'm not sure if my peering will come up with anything clever.

brandonros commented 4 years ago

Ok. I'll close the issue. Thanks for your help. I wanted to make sure I was not crazy because I ran into the same problems. I thought with the iPhoneOS 13 support for USB HID devices maybe the device could be spoofed as a HID device and then controlTransfer / transferIn / transferOut could be called against it but I don't think that is realistic.

brandonros commented 4 years ago

Also, nice name.

brandonros commented 3 years ago

Can you think of any way to connect a USB device through RJ45 (Ethernet, which we know works with iPhones pretty well) without something like a Raspberry Pi in between?

brandonros commented 1 year ago

@Brandon-T

https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_driverkit_communicates-with-drivers

says it is supported iOS 16.0, does that change things here?

Brandon-T commented 1 year ago

@Brandon-T

https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_driverkit_communicates-with-drivers

says it is supported iOS 16.0, does that change things here?

Hey it does, but IIRC, it is for the M1 devices only. So M1 iPad only is what they said in WWDC, but not sure now because docs look different so maybe they changed it? I'll check anyway.

https://developer.apple.com/documentation/driverkit

The base DriverKit framework is available in macOS for Apple silicon and Intel-based Mac computers, and in iPadOS for devices with an M1 processor. The availability of family frameworks like USBDriverKit and AudioDriverKit varies by platform.

It does say the USBDriverKit varies by platform, so I can check if it works in my current iPad AND iPhone.

brandonros commented 1 year ago
case developerDriverkitFamilySerial = "com.apple.developer.driverkit.family.serial"
            case developerDriverkitTransportPci = "com.apple.developer.driverkit.transport.pci"
            case developerDriverkitTransportUsb = "com.apple.developer.driverkit.transport.usb"

these are kind of interesting to me

Merati22 commented 1 month ago

Hello @brandonros and @Brandon-T 👋🏼,

I’ve recently encountered the same issue. I want to use a USB Type-C connection to communicate with my iPhone, but I’m unsure if it’s possible. Have you discovered any new information about this?