openHMD-simple代码分析(1/2)
以官方的simple例程,来对openHMD进行分析。
int main(int argc, char** argv)
{
//创建ctx,填充设备驱动接口ctx->drivers
//这里填充驱动接口时有个小问题,我已在github上提交,官方已确认修复。
ohmd_context* ctx = ohmd_ctx_create();
//根据HID设备的VID、PID进行枚举操作,判断设备是否存在
int num_devices = ohmd_ctx_probe(ctx);
if(num_devices < 0){
printf("failed to probe devices: %s\n", ohmd_ctx_get_error(ctx));
return -1;
}