A perfect companion to the Apple TV is the sleek MacBook Air USB
SuperDrive:

http://store.apple.com/us/product/MB397G/A

The only problem is the drive only works on MacBook Airs. When you
plug the drive into the Apple TV, it's recognized by Linux, but you
can't use it because it won't power up. Well, "A Random Hacker" has
figured out a nifty ioctl() command that powers up the drive! See
comments in the article. I also looked into reprogramming the firmware
on the drive's ATA-USB bridge. But the device's EEPROM is write-
protected. You would need to open the drive and make a mod to
unprotect it.

http://www.wired.com/gadgetlab/2008/06/hacker-fixes-ma/

Below is the code with the missing header files, modified to take the
drive name as a command-line parameter. Just build the attached code
and run it and/or add it to your startup. Couldn't be simpler.

/*
*
* A Random Hacker - MacBook Air SuperDrive enabler
* No guarantee
* The MBA SuperDrive needs 1100mA supply from the host USB Port
* No promises if you ignore this.
*
* This is a first attempt - I don’t think the enabler packet is
optimal
* It could probably be improved - but hey I just wanted to prove a
point.
*
* BTW - the firmware on the ATA->USB bridge board can be rewritten
* You would then be able to have this fix applied permanently.
* Hint - vend_ax , also Cy4611B is useful here ( processCBW )
*
* This code is for Linux - I’m sure the same could be performed under
windows
* gcc -o mba_powerup mba_powerup.c
*/
#include <fcntl.h>
#include <sys/ioctl.h>
#include <scsi/sg.h>
#include <stdio.h>
#include <string.h>
void mba_powerup (const char *device)
{
    int fd;
    sg_io_hdr_t IO_hdr;
// The magic incantation
    unsigned char magic[] = {0xea,0x00,0x00,0x00,0x00,0x00,0x01};
    unsigned char sbuf[32];
    unsigned char dxfp[32];

    fd = open(device, O_RDWR|O_NONBLOCK);
    if (fd < 0) {
        fprintf(stderr, "Error opening device \"%s\".\n", device);
        return;
    }
    else {
        memset(&IO_hdr, 0, sizeof(sg_io_hdr_t));
        IO_hdr.interface_id = 'S';
        IO_hdr.cmd_len = sizeof(magic);
        IO_hdr.mx_sb_len = sizeof(sbuf);
        IO_hdr.dxfer_direction = SG_DXFER_TO_DEV;
        IO_hdr.dxfer_len = sizeof(dxfp);
        IO_hdr.dxferp = dxfp;
        IO_hdr.cmdp = magic;
        IO_hdr.sbp = sbuf;
        IO_hdr.timeout = 1000;
        if ( ioctl(fd, SG_IO, &IO_hdr)< 0) {
            fprintf(stderr, "Error powering MBA SuperDrive.\n");
            return;
        }
        close(fd);
    }
}

// Usage: "mba_powerup /dev/dvd" (obviously change this to the
appropriate device for your system)
int main(int argc,char **argv)
{
    mba_powerup(argv[1]);
    return 0;
}


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
For more options, visit this group at
http://groups.google.com/group/atv-bootloader?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to