7

Can anyone tell me how to program USB devices with Objective-C as an iPhone application?

I want to access USB device contents through iPhone

Abizern
  • 146,289
  • 39
  • 203
  • 257
Paresh Thakor
  • 1,795
  • 2
  • 27
  • 47
  • 1
    You probably won't be able to do that in Objective-C. As far as i know iPhones don't have USB host controllers, which you'll need if you want to connect USB devices to your iPhone.. – svens Nov 05 '09 at 06:36
  • If you want make your device acts like both host and slave it must support usb on the go. In host mode you probably don't need write any code (until device drivers comes with OS). More interesting is slave mode, because You can write "virtual hardware" like mouses, modems etc. There is USB Gadget API for Linux for this. – Maciek Sawicki Nov 05 '09 at 06:44

1 Answers1

15

You can't. While it is possible to build USB based accessories for iPhone if you join the Made for iPhone program using the ExternalAccessory framework, you cannot access arbitrary USB devices. The SDK gives you access to devices that use a custom interface on top of USB, the exact details of which you get after signing up for the program and singing some more NDAs.

Louis Gerbarg
  • 43,356
  • 8
  • 80
  • 90
  • Dude... I want to make an application, which loads all details on iPhone screen, when attached to USB cable... – Paresh Thakor Nov 05 '09 at 12:00
  • 1
    consider that USB port of iPhone is being pushed with lots of data, and i want to just display those data on screen, so, iPhone screen will be like a terminal from MATRIX - the movie – Paresh Thakor Nov 05 '09 at 12:58
  • Read his answer. You don't have low-level access to the USB port on a non-jailbroken iPhone. The only officially supported way of communicating with a USB device is through the ExternalAccessory framework, and only then with a Made for iPod device. – Brad Larson Nov 05 '09 at 14:41
  • 1
    Yes, I understood what you were asking the first time, you can't do it. The iPhone security architecture does not allow applications direct access to the USB port. If you have actually have a product you want to build you can join the Made for iPhone program (as I described above), but you depending on the exact details your USB device will need a new firmware or a redesign. If you just want to ditz around with a USB device you are out of luck. – Louis Gerbarg Nov 05 '09 at 15:10
  • hello, Sorry for the delay but.... I'm trying to make an application on iPhone/Android/Blackberry devices which detects any USB plug action, i.e. if wire is plugged to USB, application must read all data pushed to the device... – Paresh Thakor Nov 11 '09 at 08:03
  • 1
    Restating what you are trying to do won't change the answer. Barring a security hole in the OS or jailbreaking the phone you can't do it, and if you do either of those your app will not be approved for the app store. – Louis Gerbarg Nov 11 '09 at 11:28
  • Thank you very much..! But I just wanna know if you understood my problem and what I'm trying to develop. But no problem, if you get any help or news regarding this topic, please forward me and let me know..! Again Thank You..! – Paresh Thakor Nov 26 '09 at 05:19
  • Apple recommends [redpark](http://redpark.com/) for personal projects that use a hardware connection. (e.g. for people that don't qualify for MFi.) – funroll Dec 04 '13 at 18:33
  • 1
    @Cœur Looks like they updated it not to reference redpark by name: "We recommend that you use a third-party hobbyist solution which will allow you to connect iOS devices to serial devices and to write iOS apps that communicate with these serial devices." (from here: https://mfi.apple.com/MFiWeb/getFAQ.action#2-2) – funroll Mar 22 '18 at 21:04