Difference between revisions of "USB"

From AwkwardTV
Jump to: navigation, search
(How to enable USB)
(added info, corrected)
Line 2: Line 2:
 
===USB port not functional by default===
 
===USB port not functional by default===
  
According to Apple, the USB connector on the Apple TV is reserved for Apple support only. Indeed, it does not work on the stock Apple TV OS. However, given that Command-S will boot it into single user mode it seems unlikely that they've disabled the port via EFI.
+
According to Apple, the USB connector on the Apple TV is reserved for Apple support only. However, given that Command-S will boot it into single user mode it seems unlikely that they've disabled the port at the driver level.
  
===How to enable USB===
+
===USB port visible in the OS===
 +
The system_profiler included with the AppleTV sees the USB, and has a 1.1 and 2.0 driver attached.
 +
USB devices attached to the port are also seen by system_profiler:
 +
 
 +
<pre>
 +
USB:
 +
 
 +
    USB High-Speed Bus:
 +
 
 +
      Host Controller Location: Built In USB
 +
      Host Controller Driver: AppleUSBEHCI
 +
      PCI Device ID: 0x27cc
 +
      PCI Revision ID: 0x0002
 +
      PCI Vendor ID: 0x8086
 +
      Bus Number: 0xfd
 +
 
 +
    USB Bus:
 +
 
 +
      Host Controller Location: Built In USB
 +
      Host Controller Driver: AppleUSBUHCI
 +
      PCI Device ID: 0x27c8
 +
      PCI Revision ID: 0x0002
 +
      PCI Vendor ID: 0x8086
 +
      Bus Number: 0x1d
 +
 
 +
        Bluetooth HCI:
 +
 
 +
          Version: 5.25
 +
          Bus Power (mA): 500
 +
          Speed: Up to 12 Mb/sec
 +
          Product ID: 0x0001
 +
          Vendor ID: 0x0a12
 +
 
 +
        IR Receiver:
 +
 
 +
          Version: 2.42
 +
          Bus Power (mA): 500
 +
          Speed: Up to 1.5 Mb/sec
 +
          Manufacturer: Apple Computer, Inc.
 +
          Product ID: 0x8241
 +
          Vendor ID: 0x05ac  (Apple Computer, Inc.)
 +
</pre>
 +
 
 +
===Mounting filesystems from USB Mass Storage Devices===
 +
Obviously this is the number one thing we'd like to get working with USB. I need to trace how diskarbitrationd works and how new USB storage devices get probed and mounted.
 +
 
 +
===How to enable USB keyboards===
  
 
Initial progress has been made to enable USB. (Initially, some people have tried swapping IOUSB files, but that didn't work, because there is another set of files in mach_kernel.prelink which also need to be changed.)   
 
Initial progress has been made to enable USB. (Initially, some people have tried swapping IOUSB files, but that didn't work, because there is another set of files in mach_kernel.prelink which also need to be changed.)   

Revision as of 16:10, 29 March 2007

<Google>WIKI</Google>

USB port not functional by default

According to Apple, the USB connector on the Apple TV is reserved for Apple support only. However, given that Command-S will boot it into single user mode it seems unlikely that they've disabled the port at the driver level.

USB port visible in the OS

The system_profiler included with the AppleTV sees the USB, and has a 1.1 and 2.0 driver attached. USB devices attached to the port are also seen by system_profiler:

USB:

    USB High-Speed Bus:

      Host Controller Location: Built In USB
      Host Controller Driver: AppleUSBEHCI
      PCI Device ID: 0x27cc
      PCI Revision ID: 0x0002
      PCI Vendor ID: 0x8086
      Bus Number: 0xfd

    USB Bus:

      Host Controller Location: Built In USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x27c8
      PCI Revision ID: 0x0002
      PCI Vendor ID: 0x8086
      Bus Number: 0x1d

        Bluetooth HCI:

          Version: 5.25
          Bus Power (mA): 500
          Speed: Up to 12 Mb/sec
          Product ID: 0x0001
          Vendor ID: 0x0a12

        IR Receiver:

          Version: 2.42
          Bus Power (mA): 500
          Speed: Up to 1.5 Mb/sec
          Manufacturer: Apple Computer, Inc.
          Product ID: 0x8241
          Vendor ID: 0x05ac  (Apple Computer, Inc.)

Mounting filesystems from USB Mass Storage Devices

Obviously this is the number one thing we'd like to get working with USB. I need to trace how diskarbitrationd works and how new USB storage devices get probed and mounted.

How to enable USB keyboards

Initial progress has been made to enable USB. (Initially, some people have tried swapping IOUSB files, but that didn't work, because there is another set of files in mach_kernel.prelink which also need to be changed.)

Kudos to http://0xfeedbeef.com/appletv/ for figuring it out. This procedure gets the keyboard working, but disables the IR remote and causes problems with the recovery procedure. Obviously this brute force technique isn't particularly useful, but is certainly a start for further development.

  • Split mach_kernel.prelink into header and data
dd if=mach_kernel.prelink of=mach_kernel.header bs=384 count=1
dd if=mach_kernel.prelink of=mach_kernel.lzssdata bs=384 skip=1
  • Decompress mach_kernel.lzssdata using decompress_lzss (using Apple's code)
  • Patch the USB vendor/product ID of the IR remote (0xac054182) with the id of my keyboard(0x160c0100)
  • Compress the patched binary with compress_lzss (Apple's code)
  • Patch mach_kernel.header with the updated information (compressed size, adler32) for the patched kernel
  • Rebuild the complete mach_kernel.prelink
cat mach_kernel.header mach_kernel.lzsspatched > mach_kernel.prelink
  • Upload new mach_kernel.prelink and reboot

More information here as it unfolds.

Command-S boots single user mode

However, the USB port is fully functional hardware-wise:

Plug a keyboard in and press Command-S during startup will start up in Single-User mode.

Boot from USB drive

Connect bootable USB drive and press "menu" and "-" on the remote while you restart. Thanks Ozy for finding this out (Video) (YouTube)

Ozy used a cloned internal drive where he changed the boot picture in order to distinguish it from the internal drive. Since the Apple TV OS disables USB during the boot process, it doesn't fully boot. But hey, it's a start, isn't it? Next we'll make a Darwin mini USB drive image...

Restore from USB drive

phoem has instructions for restoring the contents of the internal hard drive and enabling SSH from an external USB drive using an image.