+ input_ = format_->create_input(options_);
+
+ if (!input_)
+ throw QString("Failed to create input");
+
+ // open() should add the input device to the session but
+ // we can't open the device without sending some data first
+ f = new ifstream(file_name_, ios::binary);
+
+ char buffer[BufferSize];
+ f->read(buffer, BufferSize);
+ const streamsize size = f->gcount();
+ if (size == 0)
+ return;
+
+ input_->send(buffer, size);
+
+ try {
+ device_ = input_->device();
+ } catch (sigrok::Error&) {
+ return;
+ }
+
+ session_->add_device(device_);