CameraServer: Add VID/PID support for Linux USB devices (#1960)

This commit is contained in:
Peter Johnson
2019-10-20 14:12:00 -07:00
committed by GitHub
parent 3fc89c84d6
commit c59f9cea5f
6 changed files with 90 additions and 33 deletions

View File

@@ -21,6 +21,8 @@ static void ConvertToC(CS_UsbCameraInfo* out, const UsbCameraInfo& in) {
out->otherPathsCount = in.otherPaths.size();
for (size_t i = 0; i < in.otherPaths.size(); ++i)
out->otherPaths[i] = cs::ConvertToC(in.otherPaths[i]);
out->vendorId = in.vendorId;
out->productId = in.productId;
}
static void FreeUsbCameraInfo(CS_UsbCameraInfo* info) {

View File

@@ -194,13 +194,14 @@ static inline bool CheckStatus(JNIEnv* env, CS_Status status) {
static jobject MakeJObject(JNIEnv* env, const cs::UsbCameraInfo& info) {
static jmethodID constructor = env->GetMethodID(
usbCameraInfoCls, "<init>",
"(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V");
"(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;II)V");
JLocal<jstring> path(env, MakeJString(env, info.path));
JLocal<jstring> name(env, MakeJString(env, info.name));
JLocal<jobjectArray> otherPaths(env, MakeJStringArray(env, info.otherPaths));
return env->NewObject(usbCameraInfoCls, constructor,
static_cast<jint>(info.dev), path.obj(), name.obj(),
otherPaths.obj());
otherPaths.obj(), static_cast<jint>(info.vendorId),
static_cast<jint>(info.productId));
}
static jobject MakeJObject(JNIEnv* env, const cs::VideoMode& videoMode) {