ps4eye/ps4eye — pull request #3 by bigboss-ps3dev (2014-02-24 00:53:28+00:00)
Title: update ps4eye_reg.h with info about how things are done

I am working on osx driver right now, base for control transfer is done, i have some other changes to commit but i need to test them before.

i have ready functions to read and write registers in single mode and multi mode
/*
* Read a register from one of the chips managed by ov580
* It is read in 2 phases, first we send reg to read and subaddr with brequest 0xa5
* then in second phase with brequest 0xa6 we received value from register
* reg 16 bit register to read
* subaddr 8 bit subaddress chip select
* usb control transfer user data format 64 bytes
* OUT format
* byte 0 it seem to depend to subbaddr value
* byte 1-7 00
* byte 8 reg low byte
* byte 9 reg high byte
* byte 10 00 (here we received the value in second phase read
* byte 11 subaddr
* IN format like OUT format but include:
* byte 10 value readed from reg
*/

uint8_t PS4EYECam::register_read(uint16_t reg,uint8_t subaddr)

/*
* Write a register from one of the chips managed by ov580
* We send reg to write, value and subaddr with brequest 0xa4
* then in second phase with brequest 0xa6 we received value from register
* reg 16 bit register to write
* val 8 bit value to write
* subaddr 8 bit subaddress chip select
* usb control transfer user data format 64 bytes
* OUT format
* byte 0 it seem to depend to subbaddr value
* byte 1-7 00
* byte 8 reg low byte
* byte 9 reg high byte
* byte 10 val
* byte 11 subaddr
*/

void PS4EYECam::register_write(uint16_t reg, uint8_t val,uint8_t subaddr)

void PS4EYECam::multi_register_read(const uint16_t (*data), uint8_t subaddr)

Sample code reading in single/multi mode:
sensor_id_h=register_read(OV9713_CHIP_ID_HI, 0x1);
sensor_id_l=register_read(OV9713_CHIP_ID_LO, 0x1);
sensor_id=sensor_id_h<<8|sensor_id_l;
debug("sensor id 0x%04x \n",sensor_id);
multi_register_read(sensor1_reg_read,0x01);

Output from osx console:
Found idvendor: 0x05a9 idproduct 0x058a
PS4EYECam created
read sensor_id from sensor1
read register 0x300a value 0x97
read register 0x300b value 0x13
sensor id 0x9713
size data 2
read register 0x300a value 0x97
register 0x300a: 0x97
read register 0x300b value 0x13
register 0x300b: 0x13

Check the format included in .h(follow usb capture after upload firmware) to see how set/get is done

I will open a folder osx/src to add my stuff on it to make easy to merge with you.

firmware will be more difficult to reverse, it has code for embed microcontroller i see also register set list part inside.

more to come :P