| 118 | } |
| 119 | |
| 120 | void createYEI(VRPNMultiserverData &data, OSVR_PluginRegContext ctx, |
| 121 | const char *params) { |
| 122 | Json::Reader reader; |
| 123 | Json::Value root; |
| 124 | if (!reader.parse(params, root)) { |
| 125 | throw std::runtime_error("Could not parse configuration: " + |
| 126 | reader.getFormattedErrorMessages()); |
| 127 | } |
| 128 | auto port = root.get("port", "").asString(); |
| 129 | #ifdef OSVR_HAVE_USBSERIALENUM |
| 130 | // Have usb serial enum: specifying a port means you just want that one, |
| 131 | // not specifying means you want it to auto-configure all. |
| 132 | if (!port.empty()) { |
| 133 | createYEIImpl(data, ctx, root, port); |
| 134 | } else { |
| 135 | static const uint16_t vID = 0x9AC; |
| 136 | static const uint16_t pID = 0x3F2; |
| 137 | for (auto dev : osvr::usbserial::Enumerator(vID, pID)) { |
| 138 | createYEIImpl(data, ctx, root, dev->getPort()); |
| 139 | } |
| 140 | } |
| 141 | #else // !OSVR_HAVE_USBSERIALENUM |
| 142 | // No usb serial enum: must unconditionally specify a port. |
| 143 | createYEIImpl(data, ctx, root, port); |
| 144 | #endif // OSVR_HAVE_USBSERIALENUM |
| 145 | } |
nothing calls this directly
no test coverage detected