+#ifdef ANDROID
+ srau_init_environment();
+ pv::AndroidLogHandler::install_callbacks();
+ pv::AndroidAssetReader asset_reader;
+#endif
+
+ // Parse arguments
+ while (true) {
+ static const struct option long_options[] = {
+ {"help", no_argument, nullptr, 'h'},
+ {"version", no_argument, nullptr, 'V'},
+ {"loglevel", required_argument, nullptr, 'l'},
+ {"driver", required_argument, nullptr, 'd'},
+ {"input-file", required_argument, nullptr, 'i'},
+ {"input-format", required_argument, nullptr, 'I'},
+ {"clean", no_argument, nullptr, 'c'},
+ {nullptr, 0, nullptr, 0}
+ };
+
+ const int c = getopt_long(argc, argv,
+ "l:Vhc?d:i:I:", long_options, nullptr);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'h':
+ case '?':
+ usage();
+ return 0;
+
+ case 'V':
+ // Print version info
+ fprintf(stdout, "%s %s\n", PV_TITLE, PV_VERSION_STRING);
+ return 0;
+
+ case 'l':
+ {
+ const int loglevel = atoi(optarg);
+ context->set_log_level(sigrok::LogLevel::get(loglevel));
+
+#ifdef ENABLE_DECODE
+ srd_log_loglevel_set(loglevel);
+#endif
+
+ if (loglevel >= 5) {
+ const QSettings settings;
+ qDebug() << "Settings:" << settings.fileName()
+ << "format" << settings.format();
+ }
+ break;
+ }
+
+ case 'd':
+ driver = optarg;
+ break;
+
+ case 'i':
+ open_file = optarg;
+ break;
+
+ case 'I':
+ open_file_format = optarg;
+ break;
+
+ case 'c':
+ restore_sessions = false;
+ break;
+ }