Monado OpenXR Runtime
Loading...
Searching...
No Matches
esp570.c File Reference

Implementation of esp570 sensor initialization. More...

#include "util/u_logging.h"
#include "uvc/uvc_interface.h"
#include "esp570.h"
#include <string.h>
#include <errno.h>
Include dependency graph for esp570.c:

Macros

#define ESP570_EXTENSION_UNIT   4
 
#define ESP570_SELECTOR_I2C   2
 
#define ESP570_SELECTOR_UNKNOWN_3   3
 
#define ESP570_SELECTOR_EEPROM   5
 

Functions

static int uvc_xu_set_get_cur (libusb_device_handle *devh, int selector, uint8_t *buf, uint8_t len)
 Calls SET_CUR and then GET_CUR on a given selector of the eSP570 UVC extension unit.
 
int esp570_eeprom_read (libusb_device_handle *devh, uint16_t addr, uint8_t *data, uint8_t len)
 Reads a buffer from the Microchip 24AA128 EEPROM.
 
int esp570_i2c_read (libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t *val)
 Performs a 16-bit read operation on the I2C bus.
 
int esp570_i2c_write (libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t val)
 Performs a 16-bit write operation on the I2C bus.
 
int esp570_setup_unknown_3 (libusb_device_handle *devh)
 Calls SET_CUR and GET_CUR on the extension unit's selector 3 with values captured from the Oculus Windows drivers to setup the device.
 

Detailed Description

Function Documentation

◆ esp570_eeprom_read()

int esp570_eeprom_read ( libusb_device_handle *  devh,
uint16_t  addr,
uint8_t *  buf,
uint8_t  len 
)

Reads a buffer from the Microchip 24AA128 EEPROM.

Parameters
[in]devhlibusb device handle
[in]addrAddress to read from
[out]bufBuffer to read into
[in]lenNumber of bytes to read (max 32)
Returns
0 on success, negative error code on failure

References U_LOG_E, and uvc_xu_set_get_cur().

◆ esp570_i2c_read()

int esp570_i2c_read ( libusb_device_handle *  devh,
uint8_t  addr,
uint8_t  reg,
uint16_t *  val 
)

Performs a 16-bit read operation on the I2C bus.

Parameters
[in]devhlibusb device handle
[in]addrI2C address
[in]regRegister to read from
[out]valValue read
Returns
0 on success, negative error code on failure

References U_LOG_W, and uvc_xu_set_get_cur().

◆ esp570_i2c_write()

int esp570_i2c_write ( libusb_device_handle *  devh,
uint8_t  addr,
uint8_t  reg,
uint16_t  val 
)

Performs a 16-bit write operation on the I2C bus.

Parameters
[in]devhlibusb device handle
[in]addrI2C address
[in]regRegister to write to
[in]valValue to write
Returns
0 on success, negative error code on failure

References U_LOG_W, and uvc_xu_set_get_cur().

◆ esp570_setup_unknown_3()

int esp570_setup_unknown_3 ( libusb_device_handle *  devh)

Calls SET_CUR and GET_CUR on the extension unit's selector 3 with values captured from the Oculus Windows drivers to setup the device.

I have no idea what these mean.

Parameters
[in]devhlibusb device handle
Returns
0 on success, negative error code on failure

References U_LOG_W, and uvc_xu_set_get_cur().

◆ uvc_xu_set_get_cur()

static int uvc_xu_set_get_cur ( libusb_device_handle *  devh,
int  selector,
uint8_t *  buf,
uint8_t  len 
)
static

Calls SET_CUR and then GET_CUR on a given selector of the eSP570 UVC extension unit.

Parameters
[in]devhlibusb device handle
[in]selectorSelector to call on
[in]bufBuffer to send with SET_CUR, and receive with GET_CUR
[in]lenLength of the buffer
Returns
0 on success, negative error code on failure

References U_LOG_E.

Referenced by esp570_eeprom_read(), esp570_i2c_read(), esp570_i2c_write(), and esp570_setup_unknown_3().