Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UVC] Get hub hardware port with device before UVC_OPEN (IEC-94) #19

Closed
lijunru-hub opened this issue Feb 28, 2024 · 3 comments · Fixed by #24
Closed

[UVC] Get hub hardware port with device before UVC_OPEN (IEC-94) #19

lijunru-hub opened this issue Feb 28, 2024 · 3 comments · Fixed by #24

Comments

@lijunru-hub
Copy link
Contributor

lijunru-hub commented Feb 28, 2024

On the IDF branch hotfix/usb_hub_uninstall, a new field for the hardware port of the hub has been added. However, currently, this information can only be retrieved within UVC_OPEN. It is desired to add an API to retrieve device information before UVC_OPEN.

eg:

  esp_err_t libuvc_get_device_info(uvc_device_t *dev, usb_device_info_t *dev_info)
  {
      uvc_error_t ret;
      struct libusb_device_handle *usb_devh;
  
      ret = libusb_open(dev->usb_dev, &usb_devh);
      UVC_DEBUG("libusb_open() = %d", ret);
      if (ret != UVC_SUCCESS) {
          return ESP_FAIL;
      }
  
      uvc_camera_t *camera = (uvc_camera_t *)(usb_devh);
      RETURN_ON_ERROR( usb_host_device_info(camera->handle, dev_info) );
  
      libusb_close(usb_devh);
      return ESP_OK;
  } 
tore-espressif added a commit that referenced this issue Mar 7, 2024
This allows users to get detailed information about
underlying USB device.

Closes #19
@tore-espressif
Copy link
Collaborator

@lijunru-hub Sorry for the late reply.

Draft implementation is here a639a34

Compared to your proposal, it is a little different: It accepts a uvc_device_handle_t , so the UVC device must be already opened. Does this solve your problem?

@lijunru-hub
Copy link
Contributor Author

lijunru-hub commented Mar 8, 2024

I think before uvc_open to get the hardware's info is better. Like use the uvc_device_t handle

@github-actions github-actions bot changed the title [UVC] Get hub hardware port with device before UVC_OPEN [UVC] Get hub hardware port with device before UVC_OPEN (IEC-94) Mar 8, 2024
tore-espressif added a commit that referenced this issue Mar 8, 2024
This allows users to get detailed information about
underlying USB device.

Closes #19
@tore-espressif
Copy link
Collaborator

I think before uvc_open to get the hardware's info is better. Like use the uvc_device_t handle

Thank you for the feedback, I understand now. Implemented according to your suggestion in 83cf701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants