Search code examples
iphoneexternal-accessorymfi

Is it possible to detect non-MFI accessories on the iPhone?


I realize it is impossible to actually utilize any external accessories that are not MFI certified with the iPhone. Is there any way to simply detect a connection? All I would like to do is acquire the serial number from a USB drive.

So far I've tried the following

- (void)pollAccessories {
    statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nPolling Accessories..."];

    NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];

    for (EAAccessory *obj in accessories){
        statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nLocated Accessory"];
        if(obj.connected)
            statusText.text = [NSString stringWithFormat:@"%@%@", statusText.text, @"\r\nConnected\r\n"];
    }
}

Seems to work in the simulator (I'm getting two accessories that are "connected"). Ran it on my phone connecting to a PC and my PS3 with no joy. Unfortunately I don't have the appropriate dongle on hand to test a proper usb drive.

UPDATE 4/27/11:

I managed to test my code on an iHome radio. It does detect the connection, so the code is working. I've ordered a USB dongle to see if I can detect a thumb drive.


Solution

  • I got my hands on a USB dongle and sadly the OS provides no indication of a connection to a non-MFI device. This is not possible without some sort of intermediary dongle that is MFI certified.