-
Notifications
You must be signed in to change notification settings - Fork 21
Discovery aids for Gate in USB EP #96
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
base: v3_develop
Are you sure you want to change the base?
Conversation
src/pc/protocols/usb_host_ep.cpp
Outdated
| #include <fcntl.h> | ||
| #endif | ||
|
|
||
| #include <stdint.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #include <stdint.h> | |
| #include <cstdint> |
src/pc/PlatformDeviceControl.c
Outdated
| #endif | ||
|
|
||
| if (usbEpInitialize() != 0) { | ||
| xlinkSetProtocolInitialized(X_LINK_USB_EP, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
src/pc/protocols/usb_host_ep.cpp
Outdated
| return error; | ||
| } | ||
|
|
||
| // Try claiming interface 0 to test if it's in use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to go directly to INTERFACE_XLINK & INTERFACE_GATE by interface index, instead of searching for it
src/pc/protocols/usb_host_ep.cpp
Outdated
|
|
||
|
|
||
| int usbEpPlatformGateRead(void *data, int size) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has to be mutex'd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each R/W opening & closing USB device - lets leave it for now, for initial DAI impl.
But, we might want to move that DeviceGate session has a "opened device" as well
src/pc/protocols/usb_host.cpp
Outdated
| char *serialStr = (char*)malloc(serialStrLen + 1); | ||
| memcpy(serialStr, (const char*)&respBuffer[0], serialStrLen); | ||
| serialStr[serialStrLen] = '\0'; | ||
| serial = serialStr; | ||
| free(serialStr); | ||
| outSerial = serial; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| char *serialStr = (char*)malloc(serialStrLen + 1); | |
| memcpy(serialStr, (const char*)&respBuffer[0], serialStrLen); | |
| serialStr[serialStrLen] = '\0'; | |
| serial = serialStr; | |
| free(serialStr); | |
| outSerial = serial; | |
| serial.resize(serialStrLen); | |
| for(int i = 0; i < serialStrLen; i++){ | |
| serial[i] = ... | |
| } |
| } | ||
| return getLocalShdmemDevices(in_deviceRequirements, out_foundDevices, sizeFoundDevices, out_amountOfFoundDevices); | ||
| #endif | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary whitespace diff
src/pc/PlatformDeviceSearch.c
Outdated
| } | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary whitespace diff
src/pc/protocols/usb_host.cpp
Outdated
| { | ||
| mvLog(MVLOG_DEBUG, "cannot open device: %s\n", xlink_libusb_strerror(res)); | ||
| return (libusb_error) res; | ||
| return (libusb_error) res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary whitespace diff
src/pc/protocols/usb_host.cpp
Outdated
| int rc = 0; | ||
|
|
||
| /* Get our device */ | ||
| libusb_device_handle *gate_dev_handle = libusb_open_device_with_vid_pid(context, 0x05C6, 0x4321); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use: usbPlatformConnect, usbPlatformClose
(if not at all possible, then usbLinkOpen or refLibusbDeviceByName)
src/pc/protocols/usb_host.cpp
Outdated
| return rc; | ||
| } | ||
|
|
||
| int usbPlatformGateRead(void *data, int size, int timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int usbPlatformGateRead(void *data, int size, int timeout) | |
| int usbPlatformGateRead(name or deviceInfo, void *data, int size, int timeout) |
src/pc/PlatformDeviceControl.c
Outdated
| case X_LINK_USB_VSC: | ||
| case X_LINK_USB_CDC: | ||
| return usbPlatformClose(deviceHandle->xLinkFD); | ||
| case X_LINK_USB_EP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| case X_LINK_USB_EP: | |
| case X_LINK_USB_EP: |
| memset(out_foundDevices[numDevicesFound].mxid, 0, sizeof(out_foundDevices[numDevicesFound].mxid)); | ||
| strncpy(out_foundDevices[numDevicesFound].mxid, mxId.c_str(), sizeof(out_foundDevices[numDevicesFound].mxid)); | ||
| numDevicesFound++; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace
cmake/XLinkDependencies.cmake
Outdated
| add_subdirectory("${XLINK_LIBUSB_LOCAL}" "${CMAKE_CURRENT_BINARY_DIR}/libusb" EXCLUDE_FROM_ALL) | ||
| elseif(XLINK_LIBUSB_SYSTEM) | ||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(LIBUSB REQUIRED libusb-1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace - use spaces: 4 on vscode
themarpe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added my comments that have to be addressed
Purpose
This patch gets the state and the platform from gate dynamically.
Specification
Inside the USB EP device discovery functions, once the device is found a request is sent to Gate to get discovery information, and that is used to determine the device state and platform
Dependencies & Potential Impact
This must be paired with the Gate update to make it function correctly.
Deployment Plan
First, the Gate patch must be released to allow for this to work and to allow for testing.
Testing & Validation
For correct testing, first DepthAI Gate must be merged