| 254 | { |
| 255 | public: |
| 256 | Init () |
| 257 | { |
| 258 | libusb_version const &ver_obj = *libusb_get_version (); |
| 259 | uint64_t usb_version = 0; |
| 260 | for (uint64_t ver_part : {ver_obj.major, ver_obj.minor, ver_obj.micro, ver_obj.nano}) |
| 261 | { |
| 262 | usb_version = (usb_version << 16) | ver_part; |
| 263 | } |
| 264 | |
| 265 | // libusb_set_option was officially introduced in 1.0.22 |
| 266 | if (usb_version >= 0x0001000000160000) |
| 267 | { |
| 268 | jnienv_set = false; |
| 269 | // on android, this disables device scan during usb_init, which lets it succeed |
| 270 | libusb_set_option (nullptr, LIBUSB_OPTION_WEAK_AUTHORITY, nullptr); |
| 271 | } |
| 272 | else |
| 273 | { |
| 274 | // libusb is too old to pass options in |
| 275 | jnienv_set = true; |
| 276 | } |
| 277 | } |
| 278 | bool jnienv_set; |
| 279 | } static init; |
| 280 |
nothing calls this directly
no outgoing calls
no test coverage detected