iSight

The iSight in the MacBook has to be initialised with firmware.

For reference, in the AppleUSBVideoSupport binaries, the firmware starts at

sha1sum offset
86430c04f9b67c5c3d84409138a7679827025ec2 5172
a14c159b176d27a6e98dcb5dea5d78b81e15ad41 5884

The firmware blob is structured like this:

__be16 data_length;
__be16 value;
__u8   data[data_length];

This type of record repeats until data_length is 0x8001, which means you've reached the end.

Now, to initialise the device with this firmware, do the following (I'm writing it in terms of libusb's usb_control_msg):

  1. usb_control_msg(dev, 0x40, 0xA0, 0xe600, 0, "1", 1, ...)
  2. for each firmware record, traverse the data as follows:
    1. initialise value to the record's value variable
    2. split the data up into 50 byte pieces (the last one may be shorter) and upload each piece using usb_control_msg(dev, 0x40, 0xA0, value, 0, chunk, chunklen, ...), increasing the value variable by 50 after each chunk. chunklen is obviously 50 for all but (possibly) the last block
  3. finish off with usb_control_msg(dev, 0x40, 0xA0, 0xe600, 0, "0", 1, ...)

If any of the calls fail, that's an error.

At this point, the device disconnects from and reconnects to the USB bus.

Ronald Bultje has written code to load the firmware.