File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -278,11 +278,21 @@ int enumerate_and_add_hid_devices(ClassConfiguration& it)
278278 do
279279 {
280280 Logger (TLogLevel::logDEBUG) << " add new panel device. vid =" << it.vid << " pid = " << it.pid << std::endl;
281+ hid_device* hid_dev = hid_open_path (dev_info->path );
282+ if (hid_dev == NULL )
283+ {
284+ Logger (TLogLevel::logERROR) << " error opening hid device with vid=" << it.vid << " pid=" << it.pid << std::endl;
285+ continue ;
286+ }
287+
288+ if (hid_set_nonblocking (hid_dev, 1 ) != 0 )
289+ {
290+ Logger (TLogLevel::logERROR) << " error hid_set_nonblocking with vid=" << it.vid << " pid=" << it.pid << std::endl;
291+ continue ;
292+ }
293+
281294 device = new T (it);
282295 devices.push_back (device);
283-
284- hid_device* hid_dev = hid_open_path (dev_info->path );
285- hid_set_nonblocking (hid_dev, 1 );
286296 ((T*)device)->connect (hid_dev);
287297 device->start ();
288298 device->thread_handle = new std::thread (&T::thread_func, (T*)device);
You can’t perform that action at this time.
0 commit comments