chihiro.cpp: description of 2 commands sent via usb to the an2131qc chip, based on disassembly of its firmware (nw)

They are used to read the i2c eeproms connected to the chip.
This commit is contained in:
yz70s 2016-06-13 20:46:10 +02:00
parent 17bab2614e
commit e62c3ef137

View File

@ -729,24 +729,30 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa
{
if (endpoint != 0)
return -1;
printf("Control request: %x %x %x %x %x %x %x\n\r", endpoint, endpoints[endpoint].controldirection, setup->bmRequestType, setup->bRequest, setup->wValue, setup->wIndex, setup->wLength);
printf("Control request to an2131qc: %x %x %x %x %x %x %x\n\r", endpoint, endpoints[endpoint].controldirection, setup->bmRequestType, setup->bRequest, setup->wValue, setup->wIndex, setup->wLength);
// default valuse for data stage
for (int n = 0; n < setup->wLength; n++)
endpoints[endpoint].buffer[n] = 0x50 ^ n;
endpoints[endpoint].buffer[1] = 0x4b; // bits 4-1 special value, must be 10 xor 15
// bRequest is a command value
if (setup->bRequest == 0x16)
{
// this command is used to read data from the first i2c serial eeprom connected to the chip
// setup->wValue = start address to read from
// setup->wIndex = number of bytes to read
// data will be transferred to the host using endpoint 1 (IN)
endpoints[1].remain = setup->wIndex & 255;
endpoints[1].position = region + setup->wValue; // usually wValue is 0x1f00
}
if (setup->bRequest == 0x17)
{
maximum_send = setup->wIndex;
if (maximum_send > 0x40)
maximum_send = 0x40;
endpoints[2].remain = maximum_send;
// this command is used to read data from the second i2c serial eeprom connected to the chip
// setup->wValue = start address to read from
// setup->wIndex = number of bytes to read
// data will be transferred to the host using endpoint 2 (IN)
endpoints[2].remain = setup->wIndex & 255;
endpoints[2].position = region + 0x2000 + setup->wValue;
}
if ((setup->bRequest == 0x16) && (setup->wValue == 0x1f00))
{
// should be for an2131sc
endpoints[1].remain = setup->wIndex;
endpoints[1].position = region + 0x1f00;
}
if (setup->bRequest == 0x19) // 19 used to receive packet, 20 to send ?
{
// amount to transfer
@ -833,6 +839,7 @@ int ohci_hlean2131sc_device::handle_nonstandard_request(int endpoint, USBSetupPa
{
if (endpoint != 0)
return -1;
printf("Control request to an2131sc: %x %x %x %x %x %x %x\n\r", endpoint, endpoints[endpoint].controldirection, setup->bmRequestType, setup->bRequest, setup->wValue, setup->wIndex, setup->wLength);
for (int n = 0; n < setup->wLength; n++)
endpoints[endpoint].buffer[n] = 0xa0 ^ n;
endpoints[endpoint].position = endpoints[endpoint].buffer;