void AudioALSA::translate_name(char *output, char *input) { ArrayList<char*> titles; ArrayList<char*> pcm_titles; int mode; if(device->r) mode = MODERECORD; else if(device->w) mode = MODEPLAY; list_devices(&titles, 0, mode); list_devices(&pcm_titles, 1, mode); sprintf(output, "default"); for(int i = 0; i < titles.total; i++) { //printf("AudioALSA::translate_name %s %s\n", titles.values[i], pcm_titles.values[i]); if(!strcasecmp(titles.values[i], input)) { strcpy(output, pcm_titles.values[i]); break; } } titles.remove_all_objects(); pcm_titles.remove_all_objects(); }
/** List available usb devices. */ void list_devices() { bool tmp_ctx = false; if( __ctx == NULL ) { // try creating a temporary context error_t err = init_usb(); if( err != ERROR_NONE ) throw KinDrvException(err, "Failed to initialize temporary libusb context"); else tmp_ctx = true; } // Get devices ssize_t cnt; cnt = libusb_get_device_list(__ctx, &__devices); if( cnt<0 ) { fprintf( stderr, "Get_device_list error: %zi \n", cnt); } else { printf("%zi USB devices detected \n", cnt); list_devices(__devices); // Clear devices list libusb_free_device_list(__devices, /*auto-unref*/ true); } if( tmp_ctx ) close_usb(); }
static void list_actual_devices (void) { GdkDeviceManager *mgr; GList *list, *l, *devices; mgr = gdk_display_get_device_manager (gdk_display_get_default ()); list = gdk_device_manager_list_devices (mgr, GDK_DEVICE_TYPE_SLAVE); devices = NULL; for (l = list; l ; l = l->next) { GsdWacomDevice *device; device = gsd_wacom_device_new (l->data); if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_INVALID) { g_object_unref (device); continue; } devices = g_list_prepend (devices, device); } g_list_free (list); list_devices (devices); }
int main() { struct sOneWireDevice *devices, *device; pthread_t poll_thread; struct timeval tick; unsigned long last_tick; #ifdef DEBUG fprintf(stderr, "Debug mode\r\n"); #endif log_entry("Starting up", LOG_NO_EXIT); KEEP_RUNNING = 1; zExitCode = 0; signal(SIGINT, intHandler); initDB(); initGPIO(); if (pthread_create(&poll_thread, NULL, cPoll, NULL)) { log_entry("Error creating thread", EXIT_FAILURE); } gettimeofday(&tick, NULL); last_tick = tick.tv_sec; devices = list_devices(); while (KEEP_RUNNING == 1) { gettimeofday(&tick, NULL); if ((tick.tv_sec - last_tick) >= LOG_INTERVAL) { last_tick = tick.tv_sec; device = devices; while (device != NULL) { if (updateValue(device) != NULL) log_device(device); device = device->next; } power = 0; elapsedTicks = 0; } sleep(1); } if (pthread_join(poll_thread, NULL)) { log_entry("Error joining thread\n", EXIT_FAILURE); } device = devices; while (device != NULL) { devices = device->next; free(device); device = devices; } restoreGPIO(); log_entry("Cleanup finished, exiting", LOG_NO_EXIT); return (0); }
static void list_fake_devices (void) { GList *devices; devices = gsd_wacom_device_create_fake_cintiq (); list_devices (devices); devices = gsd_wacom_device_create_fake_bt (); list_devices (devices); devices = gsd_wacom_device_create_fake_x201 (); list_devices (devices); devices = gsd_wacom_device_create_fake_intuos4 (); list_devices (devices); }
int main(int argc, char** argv) { CreateAllInterfaces(); signal(SIGTERM, catch_signal); signal(SIGINT, catch_signal); signal(SIGHUP, catch_signal); print_menu(); char last_command = '?'; while (!quit) { char command [200]; std::cin.getline(command, sizeof(command)); #if 0 if (command == NULL) { print_menu(); continue; } #endif collect_messages(); switch((command[0] == 0) ? last_command : command[0]) { case 'l': list_devices(); break; case 's': print_status(); break; case 'c': send_command(command+1); break; case 'q': quit = true; break; case '?': default: print_menu(); break; } assert(command!=NULL); if(command[0] != 0) last_command = command[0]; } CloseAllDevices(); CloseAllInterfaces(); return 0; }
static DBusHandlerResult message_handler(DBusConnection *connection, DBusMessage *message, void *data) { DBusError error; DBusMessage *reply; struct connection_info *info = data; /* ret is the overall D-Bus handler result, whereas err is the internal * X error from our individual functions. */ int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; int err; DebugF("[config/dbus] received a message for %s\n", dbus_message_get_interface(message)); dbus_error_init(&error); reply = dbus_message_new_method_return(message); if (!reply) { ErrorF("[config/dbus] failed to create reply\n"); ret = DBUS_HANDLER_RESULT_NEED_MEMORY; goto err_start; } if (strcmp(dbus_message_get_member(message), "add") == 0) err = add_device(message, reply, &error); else if (strcmp(dbus_message_get_member(message), "remove") == 0) err = remove_device(message, reply, &error); else if (strcmp(dbus_message_get_member(message), "listDevices") == 0) err = list_devices(message, reply, &error); else if (strcmp(dbus_message_get_member(message), "version") == 0) err = get_version(message, reply, &error); else goto err_reply; /* Failure to allocate is a special case. */ if (err == BadAlloc) { ret = DBUS_HANDLER_RESULT_NEED_MEMORY; goto err_reply; } /* While failure here is always an OOM, we don't return that, * since that would result in devices being double-added/removed. */ if (dbus_connection_send(info->connection, reply, NULL)) dbus_connection_flush(info->connection); else ErrorF("[config/dbus] failed to send reply\n"); ret = DBUS_HANDLER_RESULT_HANDLED; err_reply: dbus_message_unref(reply); err_start: dbus_error_free(&error); return ret; }
int usage(char* prg) { printf("USAGE:\n" " %s [server ip] [port] [device-id]\n" "EXAMPLE:\n" " %s 127.0.0.1 12345 1 # play on device 1\n\n", prg, prg); list_devices(); return 0; }
portaudio_backend(void): stream(NULL), blocksize_(0) { int err = Pa_Initialize(); report_error(err, true); list_devices(); #ifdef PA_HAVE_JACK PaJack_SetClientName("SuperNova"); #endif }
std::map< int, std::vector< std::string > > map_devices( std::string p, bool rec ) { std::map< int, std::vector< std::string > > m_dev; // optionally correction of path param if( p.at( p.length()-1 ) != '/' ) { p += '/'; } m_dev.insert( make_pair( (int)FT_DIR, list_devices( p, DT_DIR, rec ) )); m_dev.insert( make_pair( (int)FT_REG, list_devices( p, DT_REG, rec ) )); m_dev.insert( make_pair( (int)FT_BLK, list_devices( p, DT_BLK, rec ) )); m_dev.insert( make_pair( (int)FT_LNK, list_devices( p, DT_LNK, rec ) )); m_dev.insert( make_pair( (int)FT_CHR, list_devices( p, DT_CHR, rec ) )); m_dev.insert( make_pair( (int)FT_SOCK, list_devices( p, DT_SOCK, rec ) )); m_dev.insert( make_pair( (int)FT_FIFO, list_devices( p, DT_FIFO, rec ) )); m_dev.insert( make_pair( (int)FT_UKN, list_devices( p, DT_UNKNOWN, rec ))); return m_dev; }
void common_cmd(int ch, char *optarg) { char *value, *subs; switch (ch) { case OptGetCtrl: subs = optarg; while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { common_usage(); exit(1); } if (strchr(value, '=')) { common_usage(); exit(1); } else { get_ctrls.push_back(value); } } break; case OptSetCtrl: subs = optarg; while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { common_usage(); exit(1); } if (const char *equal = strchr(value, '=')) { set_ctrls[std::string(value, (equal - value))] = equal + 1; } else { fprintf(stderr, "control '%s' without '='\n", value); exit(1); } } break; case OptSubset: if (parse_subset(optarg)) { common_usage(); exit(1); } break; case OptSetPriority: prio = (enum v4l2_priority)strtoul(optarg, 0L, 0); break; case OptListDevices: list_devices(); break; } }
void list_platforms() { const std::vector<cl::platform> &platforms = cl::platform::platforms(); std::cout << "available OpenCL platforms:\n"; for(unsigned i=0; i<platforms.size(); ++i) { std::cout << i << ": " << platforms[i].name() << "\n"; std::cout << "\t" << "vendor: " << platforms[i].vendor() << "\n"; std::cout << "\t" << "version: " << platforms[i].version() << "\n"; std::cout << "\t" << "profile: " << platforms[i].profile() << "\n"; std::cout << "\t" << "extensions: " << platforms[i].extensions() << "\n"; list_devices(platforms[i]); } }
int check_usb_devices(usb_ifc_info *info) { static int nr_usb = 0; if (match_fastboot(info) == 0) nr_usb++; if (nr_usb > 1) { fprintf(stderr, "Error: found more than one devices connected.\n"); list_devices(); fprintf(stderr, "Please specify one by using '-s' option\n\n"); usage(); exit(EXIT_FAILURE); } return -1; }
int main( int argc, char **argv ) { /** * @todo Parse arguments. * @todo Scan directories. * @todo Scan and instanciate devices and driver * */ std::vector< std::string > v; v = list_devices(std::string( argc==2?argv[1]:"/dev" ), FT_CHR, true); for( std::vector< std::string >::iterator jt = v.begin(); jt != v.end(); jt++ ) { std::cout << *jt << std::endl; } return EXIT_SUCCESS; }
int main(int argc, char **argv) { int c; opterr = 0; if (argc == 1) { // No arguments usage(argv); } while ((c = getopt(argc, argv, "hl")) != -1) { switch (c) { case 'l': list_devices(); return (0); case 'h': usage(argv); } } }
int usbip_list(int argc, char *argv[]) { static const struct option opts[] = { { "parsable", no_argument, NULL, 'p' }, { "remote", required_argument, NULL, 'r' }, { "local", no_argument, NULL, 'l' }, { NULL, 0, NULL, 0 } }; bool parsable = false; int opt; int ret = -1; if (usbip_names_init(USBIDS_FILE)) err("failed to open %s", USBIDS_FILE); for (;;) { opt = getopt_long(argc, argv, "pr:l", opts, NULL); if (opt == -1) break; switch (opt) { case 'p': parsable = true; break; case 'r': ret = list_exported_devices(optarg); goto out; case 'l': ret = list_devices(parsable); goto out; default: goto err_out; } } err_out: usbip_list_usage(); out: usbip_names_free(); return ret; }
/* * Status command from Director */ static void output_status(JCR *jcr, STATUS_PKT *sp) { POOL_MEM msg(PM_MESSAGE); int len; list_status_header(sp); /* * List running jobs */ list_running_jobs(sp); /* * List jobs stuck in reservation system */ list_jobs_waiting_on_reservation(sp); /* * List terminated jobs */ list_terminated_jobs(sp); /* * List devices */ list_devices(jcr, sp); len = Mmsg(msg, _("Used Volume status:\n")); if (!sp->api) sendit(msg, len, sp); list_volumes(sendit, (void *)sp); if (!sp->api) sendit("====\n\n", 6, sp); list_spool_stats(sendit, (void *)sp); if (!sp->api) sendit("====\n\n", 6, sp); }
std::vector< std::string > list_devices( std::string p, unsigned char t, bool rec ) { std::vector< std::string > v_dev; DIR *dir; struct dirent *dir_ent; // optionally correction of path param if( p.at( p.length()-1 ) != '/' ) { p += '/'; } if( (dir = opendir( p.c_str() )) ) { while( (dir_ent = readdir( dir )) ) { if( (strcmp( dir_ent->d_name, "." ) == 0) || (strcmp( dir_ent->d_name, ".." ) == 0) ) { continue; /* ignore + jump to next */ } else { std::string tmp_str = p; tmp_str += dir_ent->d_name; if( dir_ent->d_type == t ) { v_dev.push_back( std::string( tmp_str ) ); } if( (dir_ent->d_type == DT_DIR) && rec ) { std::vector< std::string > tmp_v; v_dev.push_back( std::string( tmp_str ) ); tmp_v = list_devices( tmp_str, t, rec ); v_dev.insert( v_dev.end(), tmp_v.begin(), tmp_v.end() ); } else { continue; /* ignore + jump to next */ } } // end pathcheck if } // end while loop closedir( dir ); } else { /* nothing to do */ } return v_dev; }
int main(int argc, char *argv[]) { int i; const char *name; if (argc <= 1) { return list_devices(); } else { for (i = 1; i < argc; i++) { name = argv[i]; if (name[0] == '+') { start_device(name + 1); } else if (name[0] == '-') { stop_device(name + 1); } else { printf("USAGE: %s [+|-]input_device_name\n", argv[0]); } } } return 0; }
int main(int argc, char **argv) { int wants_wipe = 0; int wants_reboot = 0; int wants_reboot_bootloader = 0; void *data; unsigned sz; unsigned page_size = 2048; int status; skip(1); if (argc == 0) { usage(); return 1; } if (!strcmp(*argv, "devices")) { list_devices(); return 0; } if (!strcmp(*argv, "help")) { usage(); return 0; } serial = getenv("ANDROID_SERIAL"); while (argc > 0) { if(!strcmp(*argv, "-w")) { wants_wipe = 1; skip(1); } else if(!strcmp(*argv, "-b")) { require(2); base_addr = strtoul(argv[1], 0, 16); skip(2); } else if(!strcmp(*argv, "-n")) { require(2); page_size = (unsigned)strtoul(argv[1], NULL, 0); if (!page_size) die("invalid page size"); skip(2); } else if(!strcmp(*argv, "-s")) { require(2); serial = argv[1]; skip(2); } else if(!strcmp(*argv, "-p")) { require(2); product = argv[1]; skip(2); } else if(!strcmp(*argv, "-c")) { require(2); cmdline = argv[1]; skip(2); } else if(!strcmp(*argv, "-i")) { char *endptr = NULL; unsigned long val; require(2); val = strtoul(argv[1], &endptr, 0); if (!endptr || *endptr != '\0' || (val & ~0xffff)) die("invalid vendor id '%s'", argv[1]); vendor_id = (unsigned short)val; skip(2); } else if(!strcmp(*argv, "getvar")) { require(2); fb_queue_display(argv[1], argv[1]); skip(2); } else if(!strcmp(*argv, "erase")) { require(2); fb_queue_erase(argv[1]); skip(2); } else if(!strcmp(*argv, "signature")) { require(2); data = load_file(argv[1], &sz); if (data == 0) die("could not load '%s'", argv[1]); if (sz != 256) die("signature must be 256 bytes"); fb_queue_download("signature", data, sz); fb_queue_command("signature", "installing signature"); skip(2); } else if(!strcmp(*argv, "reboot")) { wants_reboot = 1; skip(1); } else if(!strcmp(*argv, "reboot-bootloader")) { wants_reboot_bootloader = 1; skip(1); } else if (!strcmp(*argv, "continue")) { fb_queue_command("continue", "resuming boot"); skip(1); } else if(!strcmp(*argv, "boot")) { char *kname = 0; char *rname = 0; skip(1); if (argc > 0) { kname = argv[0]; skip(1); } if (argc > 0) { rname = argv[0]; skip(1); } data = load_bootable_image(page_size, kname, rname, &sz, cmdline); if (data == 0) return 1; fb_queue_download("boot.img", data, sz); fb_queue_command("boot", "booting"); } else if(!strcmp(*argv, "flash")) { char *pname = argv[1]; char *fname = 0; require(2); if (argc > 2) { fname = argv[2]; skip(3); } else { fname = find_item(pname, product); skip(2); } if (fname == 0) die("cannot determine image filename for '%s'", pname); data = load_file(fname, &sz); if (data == 0) die("cannot load '%s'\n", fname); fb_queue_flash(pname, data, sz); } else if(!strcmp(*argv, "flash:raw")) { char *pname = argv[1]; char *kname = argv[2]; char *rname = 0; require(3); if(argc > 3) { rname = argv[3]; skip(4); } else { skip(3); } data = load_bootable_image(page_size, kname, rname, &sz, cmdline); if (data == 0) die("cannot load bootable image"); fb_queue_flash(pname, data, sz); } else if(!strcmp(*argv, "flashall")) { skip(1); do_flashall(); wants_reboot = 1; } else if(!strcmp(*argv, "update")) { if (argc > 1) { do_update(argv[1]); skip(2); } else { do_update("update.zip"); skip(1); } wants_reboot = 1; } else if(!strcmp(*argv, "oem")) { argc = do_oem_command(argc, argv); } else { usage(); return 1; } } if (wants_wipe) { fb_queue_erase("userdata"); fb_queue_erase("cache"); } if (wants_reboot) { fb_queue_reboot(); } else if (wants_reboot_bootloader) { fb_queue_command("reboot-bootloader", "rebooting into bootloader"); } usb = open_device(); status = fb_execute_queue(usb); return (status) ? 1 : 0; }
int main (int argc, char **argv) { unsigned short int range = 0; unsigned short int centerforce = 0; unsigned short int gain = 0; int do_validate_wheel = 0; int do_native = 0; int do_range = 0; int do_autocenter = 0; int do_alt_autocenter = 0; int do_gain = 0; int do_list = 0; int rampspeed = -1; int do_help = 0; int do_reset = 0; char device_file_name[128]; char shortname[255]; memset(device_file_name, 0, sizeof(device_file_name)); verbose_flag = 0; static struct option long_options[] = { {"verbose", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {"list", no_argument, 0, 'l'}, {"wheel", required_argument, 0, 'w'}, {"nativemode", no_argument, 0, 'n'}, {"range", required_argument, 0, 'r'}, {"altautocenter", required_argument, 0, 'b'}, {"autocenter", required_argument, 0, 'a'}, {"rampspeed", required_argument, 0, 's'}, {"gain", required_argument, 0, 'g'}, {"device", required_argument, 0, 'd'}, {"reset", no_argument, 0, 'x'}, {0, 0, 0, 0 } }; while (optind < argc) { int index = -1; int result = getopt_long (argc, argv, "vhlw:nr:a:g:d:s:b:x", long_options, &index); if (result == -1) break; /* end of list */ switch (result) { case 'v': verbose_flag++; break; case 'n': do_native = 1; break; case 'r': range = atoi(optarg); do_range = 1; break; case 'a': centerforce = atoi(optarg); do_autocenter = 1; do_alt_autocenter = 0; break; case 'b': centerforce = atoi(optarg); do_autocenter = 0; do_alt_autocenter = 1; break; case 's': rampspeed = atoi(optarg); break; case 'g': gain = atoi(optarg); do_gain = 1; break; case 'd': strncpy(device_file_name, optarg, 128); break; case 'l': do_list = 1; break; case 'w': strncpy(shortname, optarg, 255); do_validate_wheel = 1; break; case 'x': do_reset = 1; break; case '?': default: do_help = 1; break; } } if (argc > 1) { usb_init(); if (verbose_flag > 1) usb_set_debug(3); int wait_for_udev = 0; const wheelstruct* wheel = NULL; if (do_help) { help(); } else if (do_list) { // list all devices, ignore other options... list_devices(); } else { if (do_validate_wheel) { int numWheels = sizeof(wheels)/sizeof(wheelstruct); int i = 0; for (i=0; i < numWheels; i++) { if (strncasecmp(wheels[i].shortname, shortname, 255) == 0) { // found matching wheel wheel = &(wheels[i]); break; } } if (!wheel) { printf("Wheel \"%s\" not supported. Did you spell the shortname correctly?\n", shortname); } } if (do_reset) { if (!wheel) { printf("Please provide --wheel parameter!\n"); } else { reset_wheel(wheel); wait_for_udev = 1; } } if (do_native) { if (!wheel) { printf("Please provide --wheel parameter!\n"); } else { set_native_mode(wheel); wait_for_udev = 1; } } if (do_range) { if (!wheel) { printf("Please provide --wheel parameter!\n"); } else { set_range(wheel, clamprange(wheel, range)); wait_for_udev = 1; } } if (do_autocenter) { if (!wheel) { printf("Please provide --wheel parameter!\n"); } else { if (centerforce == 0) { set_autocenter(wheel, centerforce, 0); wait_for_udev = 1; } else if (rampspeed == -1) { printf("Please provide '--rampspeed' parameter\n"); } else { set_autocenter(wheel, centerforce, rampspeed); wait_for_udev = 1; } } } if (do_alt_autocenter) { if (strlen(device_file_name)) { alt_set_autocenter(centerforce, device_file_name, wait_for_udev); wait_for_udev = 0; } else { printf("Please provide the according event interface for your wheel using '--device' parameter (E.g. '--device /dev/input/event0')\n"); } } if (do_gain) { if (strlen(device_file_name)) { set_gain(gain, device_file_name, wait_for_udev); wait_for_udev = 0; } else { printf("Please provide the according event interface for your wheel using '--device' parameter (E.g. '--device /dev/input/event0')\n"); } } } // libusb_exit(NULL); < Not provided by libusb-0.1 } else { // display usage information if no arguments given help(); } exit(0); }
int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { int i; /* Looping var */ int copies; /* Number of copies */ int port; /* Port number */ char uri[1024], /* URI */ *sep, /* Pointer to separator */ *password; /* Password */ const char *username, /* Username */ *server, /* Server name */ *printer; /* Printer name */ const char *workgroup; /* Workgroup */ FILE *fp; /* File to print */ int status=0; /* Status of LPD job */ struct cli_state *cli; /* SMB interface */ char null_str[1]; int tries = 0; const char *dev_uri; null_str[0] = '\0'; /* we expect the URI in argv[0]. Detect the case where it is in argv[1] and cope */ if (argc > 2 && strncmp(argv[0],"smb://", 6) && !strncmp(argv[1],"smb://", 6)) { argv++; argc--; } if (argc == 1) { /* * NEW! In CUPS 1.1 the backends are run with no arguments to list the * available devices. These can be devices served by this backend * or any other backends (i.e. you can have an SNMP backend that * is only used to enumerate the available network printers... :) */ list_devices(); return (0); } if (argc < 6 || argc > 7) { fprintf(stderr, "Usage: %s [DEVICE_URI] job-id user title copies options [file]\n", argv[0]); fputs(" The DEVICE_URI environment variable can also contain the\n", stderr); fputs(" destination printer:\n", stderr); fputs("\n", stderr); fputs(" smb://[username:password@][workgroup/]server[:port]/printer\n", stderr); return (1); } /* * If we have 7 arguments, print the file named on the command-line. * Otherwise, print data from stdin... */ if (argc == 6) { /* * Print from Copy stdin to a temporary file... */ fp = stdin; copies = 1; } else if ((fp = fopen(argv[6], "rb")) == NULL) { perror("ERROR: Unable to open print file"); return (1); } else copies = atoi(argv[4]); /* * Find the URI... */ dev_uri = getenv("DEVICE_URI"); if (dev_uri) strncpy(uri, dev_uri, sizeof(uri) - 1); else if (strncmp(argv[0], "smb://", 6) == 0) strncpy(uri, argv[0], sizeof(uri) - 1); else { fputs("ERROR: No device URI found in DEVICE_URI environment variable or argv[0] !\n", stderr); return (1); } uri[sizeof(uri) - 1] = '\0'; /* * Extract the destination from the URI... */ if ((sep = strrchr_m(uri, '@')) != NULL) { username = uri + 6; *sep++ = '\0'; server = sep; /* * Extract password as needed... */ if ((password = strchr_m(username, ':')) != NULL) *password++ = '\0'; else password = null_str; } else { username = null_str; password = null_str; server = uri + 6; } if ((sep = strchr_m(server, '/')) == NULL) { fputs("ERROR: Bad URI - need printer name!\n", stderr); return (1); } *sep++ = '\0'; printer = sep; if ((sep = strchr_m(printer, '/')) != NULL) { /* * Convert to smb://[username:password@]workgroup/server/printer... */ *sep++ = '\0'; workgroup = server; server = printer; printer = sep; } else workgroup = NULL; if ((sep = strrchr_m(server, ':')) != NULL) { *sep++ = '\0'; port=atoi(sep); } else port=0; /* * Setup the SAMBA server state... */ setup_logging("smbspool", True); in_client = True; /* Make sure that we tell lp_load we are */ load_case_tables(); if (!lp_load(dyn_CONFIGFILE, True, False, False, True)) { fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); return (1); } if (workgroup == NULL) workgroup = lp_workgroup(); load_interfaces(); do { if ((cli = smb_connect(workgroup, server, port, printer, username, password, argv[2])) == NULL) { if (getenv("CLASS") == NULL) { fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...\n"); sleep (60); /* should just waiting and retrying fix authentication ??? */ tries++; } else { fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...\n"); return (1); } } } while ((cli == NULL) && (tries < MAX_RETRY_CONNECT)); if (cli == NULL) { fprintf(stderr, "ERROR: Unable to connect to CIFS host after (tried %d times)\n", tries); return (1); } /* * Now that we are connected to the server, ignore SIGTERM so that we * can finish out any page data the driver sends (e.g. to eject the * current page... Only ignore SIGTERM if we are printing data from * stdin (otherwise you can't cancel raw jobs...) */ if (argc < 7) CatchSignal(SIGTERM, SIG_IGN); /* * Queue the job... */ for (i = 0; i < copies; i ++) if ((status = smb_print(cli, argv[3] /* title */, fp)) != 0) break; cli_shutdown(cli); /* * Return the queue status... */ return (status); }
int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments (6 or 7) */ char *argv[]) /* I - Command-line arguments */ { char method[255], /* Method in URI */ hostname[1024], /* Hostname */ username[255], /* Username info (not used) */ resource[1024], /* Resource info (device and options) */ *options; /* Pointer to options */ int port; /* Port number (not used) */ int fp; /* Print file */ int copies; /* Number of copies to print */ int status; /* Exit status */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ /* * Make sure status messages are not buffered... */ setbuf(stderr, NULL); /* * Ignore SIGPIPE signals... */ #ifdef HAVE_SIGSET sigset(SIGPIPE, SIG_IGN); #elif defined(HAVE_SIGACTION) memset(&action, 0, sizeof(action)); action.sa_handler = SIG_IGN; sigaction(SIGPIPE, &action, NULL); #else signal(SIGPIPE, SIG_IGN); #endif /* HAVE_SIGSET */ /* * Check command-line... */ if (argc == 1) { list_devices(); return (CUPS_BACKEND_OK); } else if (argc < 6 || argc > 7) { _cupsLangPrintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), argv[0]); return (CUPS_BACKEND_FAILED); } /* * If we have 7 arguments, print the file named on the command-line. * Otherwise, send stdin instead... */ if (argc == 6) { fp = 0; copies = 1; } else { /* * Try to open the print file... */ if ((fp = open(argv[6], O_RDONLY)) < 0) { perror("ERROR: unable to open print file"); return (CUPS_BACKEND_FAILED); } copies = atoi(argv[4]); } /* * Extract the device name and options from the URI... */ httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv), method, sizeof(method), username, sizeof(username), hostname, sizeof(hostname), &port, resource, sizeof(resource)); /* * See if there are any options... */ if ((options = strchr(resource, '?')) != NULL) { /* * Yup, terminate the device name string and move to the first * character of the options... */ *options++ = '\0'; } /* * Finally, send the print file... */ status = print_device(resource, fp, copies); /* * Close input file and return... */ if (fp != 0) close(fp); return (status); }
int main(int argc, const char * argv[]) { int list = 0; int i; const char * port = "4575"; const char * device = NULL; for (i=1; i<=argc; i++) { if (!argv[i]) continue; if ((strcmp(argv[i],"-h")==0)||(strcmp(argv[i],"--help")==0)||(strcmp(argv[i],"-?")==0)) usage(); if (strncmp(argv[i],"-p=",3)==0) { port = argv[i]+3; continue; } if (strncmp(argv[i],"--port=",7)==0) { port = argv[i]+7; continue; } if (strcmp(argv[i],"-v")==0) { verbose = 1; continue; } if (strcmp(argv[i],"-l")==0) { list = 1; continue; } if (strcmp(argv[i],"--list")==0) { list = 1; continue; } if (strncmp(argv[i],"--dev=",6)==0) { device = argv[i]+6; continue; } printf("Unknown option: %s\n",argv[i]); usage(); } if (init_audio()!=0) return 1; if ((dev=device_for_string(device))==-1) { fprintf(stderr,"Unknown device \"%s\"\n",device?device:""); cleanup_audio(); return 1; } else { fprintf(stderr,"Using device \"%s\"\n",Pa_GetDeviceInfo(dev)->name); } if (list) { list_devices(); cleanup_audio(); return 0; } if (start_listening(port)!=0) { cleanup_audio(); return 1; } cleanup_audio(); return 0; }
static int init(int rate, int channels, int format, int flags) { float position[3] = {0, 0, 0}; float direction[6] = {0, 0, 1, 0, -1, 0}; float sppos[MAX_CHANS][3] = { {-1, 0, 0.5}, {1, 0, 0.5}, {-1, 0, -1}, {1, 0, -1}, {0, 0, 1}, {0, 0, 0.1}, {-1, 0, 0}, {1, 0, 0}, }; ALCdevice *dev = NULL; ALCcontext *ctx = NULL; ALCint freq = 0; ALCint attribs[] = {ALC_FREQUENCY, rate, 0, 0}; int i; char *device = NULL; const opt_t subopts[] = { {"device", OPT_ARG_MSTRZ, &device, NULL}, {NULL} }; global_ao->no_persistent_volume = true; if (subopt_parse(ao_subdevice, subopts) != 0) { print_help(); return 0; } if (device && strcmp(device, "help") == 0) { list_devices(); goto err_out; } if (channels > MAX_CHANS) { mp_msg(MSGT_AO, MSGL_FATAL, "[OpenAL] Invalid number of channels: %i\n", channels); goto err_out; } dev = alcOpenDevice(device); if (!dev) { mp_msg(MSGT_AO, MSGL_FATAL, "[OpenAL] could not open device\n"); goto err_out; } ctx = alcCreateContext(dev, attribs); alcMakeContextCurrent(ctx); alListenerfv(AL_POSITION, position); alListenerfv(AL_ORIENTATION, direction); alGenSources(channels, sources); for (i = 0; i < channels; i++) { cur_buf[i] = 0; unqueue_buf[i] = 0; alGenBuffers(NUM_BUF, buffers[i]); alSourcefv(sources[i], AL_POSITION, sppos[i]); alSource3f(sources[i], AL_VELOCITY, 0, 0, 0); } if (channels == 1) alSource3f(sources[0], AL_POSITION, 0, 0, 1); ao_data.channels = channels; alcGetIntegerv(dev, ALC_FREQUENCY, 1, &freq); if (alcGetError(dev) == ALC_NO_ERROR && freq) rate = freq; ao_data.samplerate = rate; ao_data.format = AF_FORMAT_S16_NE; ao_data.bps = channels * rate * 2; ao_data.buffersize = CHUNK_SIZE * NUM_BUF; ao_data.outburst = channels * CHUNK_SIZE; tmpbuf = malloc(CHUNK_SIZE); free(device); return 1; err_out: free(device); return 0; }
int main(int argc, char **argv) { int wants_reboot = 0; int wants_reboot_bootloader = 0; void *data; unsigned sz; int status; skip(1); if (argc == 0) { usage(); return 1; } #if HAVE_COMPATIBILITY if (argc == 1 && (!strcmp(*argv, "-o") || !strcmp(*argv, "--old"))) { usage(); return 1; } #endif if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) { usage(); return 0; } else if (!strcmp(*argv, "-v") || !strcmp(*argv, "--version")) { fprintf(stdout, PACKAGE_STRING "\n"); return 0; } while (argc > 0) { if(!access(*argv, R_OK)) { /* all-in-one file */ do_flashall(*argv); wants_reboot = 1; skip(1); } else if(!strcmp(*argv, "-s") || !strcmp(*argv, "--serial")) { require(2); serial = argv[1]; skip(2); } else if(!strcmp(*argv, "-i") || !strcmp(*argv, "--id")) { char *endptr = NULL; unsigned long val; require(2); val = strtoul(argv[1], &endptr, 0); if (!endptr || *endptr != '\0' || (val & ~0xffff)) die("invalid vendor id '%s'", argv[1]); vendor_id = (unsigned short)val; skip(2); } else if(!strcmp(*argv, "getvar")) { /* when argc == 1, just list all available variables */ if (argc == 1) { fb_queue_display("",""); skip(1); } else { require(2); fb_queue_display(argv[1], argv[1]); skip(2); } } else if(!strcmp(*argv, "erase")) { if (argc == 1) { fb_queue_erase(""); skip(1); } else { require(2); fb_queue_erase(argv[1]); skip(2); } } else if(!strcmp(*argv, "reboot")) { wants_reboot = 1; skip(1); } else if(!strcmp(*argv, "reboot-bootloader")) { wants_reboot_bootloader = 1; skip(1); } else if(!strcmp(*argv, "flash")) { if (argc == 1) { fb_queue_stream_flash("", NULL, 0); skip(1); } else { char *pname = argv[1]; char *fname = 0; require(3); fname = argv[2]; skip(3); data = load_file(fname, &sz); if (data == 0) { int fd = open(fname, O_RDONLY); if (fd == -1) die("cannot open %s for read: %m\n", fname); sz = lseek(fd, 0, SEEK_END); data = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0); if (data == MAP_FAILED) die("cannot map '%s': %s\n", fname, strerror(errno)); } fb_queue_stream_flash(pname, data, sz); } } else if(!strcmp(*argv, "flashall")) { require(2); do_flashall(argv[1]); skip(2); wants_reboot = 1; } else if(!strcmp(*argv, "oem")) { argc = do_oem_command(argc, argv); if (argc) return argc; } else if (!strcmp(*argv, "devices")) { list_devices(); return 0; #if HAVE_COMPATIBILITY } else if (!strcmp(*argv, "-o") || !strcmp(*argv, "--old")) { old_preos = 1; skip(1); #endif } else { usage(); return 1; } } if (wants_reboot) { fb_queue_command("reboot", "rebooting"); } else if (wants_reboot_bootloader) { fb_queue_command("reboot-bootloader", "rebooting into bootloader"); } usb = open_device(); status = fb_execute_queue(usb); return (status) ? 1 : 0; }
bool GetInfo_SCSI(QListView *lBox) { return list_devices(lBox, (char *)"PdDvLn like '*/scsi/*'"); }
int main(int argc, char **argv) { int wants_wipe = 0; int wants_reboot = 0; int wants_reboot_bootloader = 0; int erase_first = 1; void *data; unsigned sz; int status; int c; int longindex; const struct option longopts[] = { {"base", required_argument, 0, 'b'}, {"kernel_offset", required_argument, 0, 'k'}, {"page_size", required_argument, 0, 'n'}, {"ramdisk_offset", required_argument, 0, 'r'}, {"tags_offset", required_argument, 0, 't'}, {"help", no_argument, 0, 'h'}, {"unbuffered", no_argument, 0, 0}, {"version", no_argument, 0, 0}, {0, 0, 0, 0} }; serial = getenv("ANDROID_SERIAL"); while (1) { c = getopt_long(argc, argv, "wub:k:n:r:t:s:S:lp:c:i:m:h", longopts, &longindex); if (c < 0) { break; } /* Alphabetical cases */ switch (c) { case 'b': base_addr = strtoul(optarg, 0, 16); break; case 'c': cmdline = optarg; break; case 'h': usage(); return 1; case 'i': { char *endptr = NULL; unsigned long val; val = strtoul(optarg, &endptr, 0); if (!endptr || *endptr != '\0' || (val & ~0xffff)) die("invalid vendor id '%s'", optarg); vendor_id = (unsigned short)val; break; } case 'k': kernel_offset = strtoul(optarg, 0, 16); break; case 'l': long_listing = 1; break; case 'n': page_size = (unsigned)strtoul(optarg, NULL, 0); if (!page_size) die("invalid page size"); break; case 'p': product = optarg; break; case 'r': ramdisk_offset = strtoul(optarg, 0, 16); break; case 't': tags_offset = strtoul(optarg, 0, 16); break; case 's': serial = optarg; break; case 'S': sparse_limit = parse_num(optarg); if (sparse_limit < 0) { die("invalid sparse limit"); } break; case 'u': erase_first = 0; break; case 'w': wants_wipe = 1; break; case '?': return 1; case 0: if (strcmp("unbuffered", longopts[longindex].name) == 0) { setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); } else if (strcmp("version", longopts[longindex].name) == 0) { fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION); return 0; } break; default: abort(); } } argc -= optind; argv += optind; if (argc == 0 && !wants_wipe) { usage(); return 1; } if (argc > 0 && !strcmp(*argv, "devices")) { skip(1); list_devices(); return 0; } if (argc > 0 && !strcmp(*argv, "help")) { usage(); return 0; } usb_handle* usb = open_device(); while (argc > 0) { if(!strcmp(*argv, "getvar")) { require(2); fb_queue_display(argv[1], argv[1]); skip(2); } else if(!strcmp(*argv, "erase")) { require(2); if (fb_format_supported(usb, argv[1], NULL)) { fprintf(stderr, "******** Did you mean to fastboot format this partition?\n"); } fb_queue_erase(argv[1]); skip(2); } else if(!strncmp(*argv, "format", strlen("format"))) { char *overrides; char *type_override = NULL; char *size_override = NULL; require(2); /* * Parsing for: "format[:[type][:[size]]]" * Some valid things: * - select ontly the size, and leave default fs type: * format::0x4000000 userdata * - default fs type and size: * format userdata * format:: userdata */ overrides = strchr(*argv, ':'); if (overrides) { overrides++; size_override = strchr(overrides, ':'); if (size_override) { size_override[0] = '\0'; size_override++; } type_override = overrides; } if (type_override && !type_override[0]) type_override = NULL; if (size_override && !size_override[0]) size_override = NULL; if (erase_first && needs_erase(usb, argv[1])) { fb_queue_erase(argv[1]); } fb_perform_format(usb, argv[1], 0, type_override, size_override); skip(2); } else if(!strcmp(*argv, "signature")) { require(2); data = load_file(argv[1], &sz); if (data == 0) die("could not load '%s': %s", argv[1], strerror(errno)); if (sz != 256) die("signature must be 256 bytes"); fb_queue_download("signature", data, sz); fb_queue_command("signature", "installing signature"); skip(2); } else if(!strcmp(*argv, "reboot")) { wants_reboot = 1; skip(1); if (argc > 0) { if (!strcmp(*argv, "bootloader")) { wants_reboot = 0; wants_reboot_bootloader = 1; skip(1); } } require(0); } else if(!strcmp(*argv, "reboot-bootloader")) { wants_reboot_bootloader = 1; skip(1); } else if (!strcmp(*argv, "continue")) { fb_queue_command("continue", "resuming boot"); skip(1); } else if(!strcmp(*argv, "boot")) { char *kname = 0; char *rname = 0; skip(1); if (argc > 0) { kname = argv[0]; skip(1); } if (argc > 0) { rname = argv[0]; skip(1); } data = load_bootable_image(kname, rname, &sz, cmdline); if (data == 0) return 1; fb_queue_download("boot.img", data, sz); fb_queue_command("boot", "booting"); } else if(!strcmp(*argv, "flash")) { char *pname = argv[1]; char *fname = 0; require(2); if (argc > 2) { fname = argv[2]; skip(3); } else { fname = find_item(pname, product); skip(2); } if (fname == 0) die("cannot determine image filename for '%s'", pname); if (erase_first && needs_erase(usb, pname)) { fb_queue_erase(pname); } do_flash(usb, pname, fname); } else if(!strcmp(*argv, "flash:raw")) { char *pname = argv[1]; char *kname = argv[2]; char *rname = 0; require(3); if(argc > 3) { rname = argv[3]; skip(4); } else { skip(3); } data = load_bootable_image(kname, rname, &sz, cmdline); if (data == 0) die("cannot load bootable image"); fb_queue_flash(pname, data, sz); } else if(!strcmp(*argv, "flashall")) { skip(1); do_flashall(usb, erase_first); wants_reboot = 1; } else if(!strcmp(*argv, "update")) { if (argc > 1) { do_update(usb, argv[1], erase_first); skip(2); } else { do_update(usb, "update.zip", erase_first); skip(1); } wants_reboot = 1; } else if(!strcmp(*argv, "oem")) { argc = do_oem_command(argc, argv); } else if(!strcmp(*argv, "flashing") && argc == 2) { if(!strcmp(*(argv+1), "unlock") || !strcmp(*(argv+1), "lock") || !strcmp(*(argv+1), "unlock_critical") || !strcmp(*(argv+1), "lock_critical") || !strcmp(*(argv+1), "get_unlock_ability")) { argc = do_oem_command(argc, argv); } else { usage(); return 1; } } else { usage(); return 1; } } if (wants_wipe) { fb_queue_erase("userdata"); fb_perform_format(usb, "userdata", 1, NULL, NULL); fb_queue_erase("cache"); fb_perform_format(usb, "cache", 1, NULL, NULL); } if (wants_reboot) { fb_queue_reboot(); fb_queue_wait_for_disconnect(); } else if (wants_reboot_bootloader) { fb_queue_command("reboot-bootloader", "rebooting into bootloader"); fb_queue_wait_for_disconnect(); } if (fb_queue_is_empty()) return 0; status = fb_execute_queue(usb); return (status) ? 1 : 0; }
int main (int argc, char **argv) { CHandle handle = 0; CResult res = C_SUCCESS; // Parse the command line if(cmdline_parser(argc, argv, &args_info) != 0) exit(1); // Display help if no arguments were specified if(argc == 1) { cmdline_parser_print_help(); exit(0); } res = c_init(); if(res) goto done; // Open the device if (!args_info.list_given && (!args_info.import_given || args_info.device_given)) { handle = c_open_device(args_info.device_arg); if(!handle) { print_error("Unable to open device", -1); res = C_INVALID_DEVICE; goto done; } } // List devices if(args_info.list_given) { res = list_devices(); goto done; } // Import dynamic controls from XML file else if(args_info.import_given) { res = add_control_mappings(handle, args_info.import_arg); goto done; } // Import dynamic controls from XML files at default location if(args_info.addctrl_given) { // list all xml files at default data/vid dir int nf=0; char vid[5]; char pid[5]; short pid_set = 0; if(fnmatch("[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]", args_info.addctrl_arg, 0)) { if(fnmatch("[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]", args_info.addctrl_arg, 0)) { printf("%s invalid: set at least a valid vid value, :pid is optional\n", args_info.addctrl_arg); goto done; } else { /*extract vid and reset pid*/ int c = 0; for (c = 0; c < 4; c++) { vid[c] = args_info.addctrl_arg[c]; pid[c] = 0; } vid[4] = '\0'; pid[4] = '\0'; } } else { /*extract vid and pid*/ int c = 0; for (c = 0; c < 4; c++) { vid[c] = args_info.addctrl_arg[c]; pid[c] = args_info.addctrl_arg[c+5]; } vid[4] = '\0'; pid[4] = '\0'; pid_set = 1; /*flag pid.xml check*/ //printf("vid:%s pid:%s\n", vid, pid); } /* get xml file list from DATA_DIR/vid/ */ char **xml_files = get_filename (DATA_DIR, vid); /*check for pid.xml*/ char fname[9]; strcpy(fname, pid); strcat(fname,".xml"); if(pid_set) { pid_set = 0; /*reset*/ nf=0; while (xml_files[nf] != NULL) { if ( strcasecmp(fname, xml_files[nf]) == 0) pid_set = 1; /*file exists so flag it*/ nf++; } } /*parse xml files*/ nf = 0; while (xml_files[nf] != NULL) { /* if pid was set and pid.xml exists parse it*/ if(pid_set) { if ((strcasecmp(fname, xml_files[nf]) == 0)) { printf ( "Parsing: %s \n", xml_files[nf]); res = add_control_mappings(handle, xml_files[nf]); } } else /* parse all xml files inside vid dir */ { printf ( "Parsing: %s \n", xml_files[nf]); res = add_control_mappings(handle, xml_files[nf]); } free(xml_files[nf]); xml_files[nf]=NULL; nf++; } free(xml_files); goto done; } // List frame formats if(args_info.formats_given) { printf("Listing available frame formats for device %s:\n", args_info.device_arg); res = list_frame_formats(handle); } // List controls else if(args_info.clist_given) { printf("Listing available controls for device %s:\n", args_info.device_arg); res = list_controls(handle); } // Retrieve control value else if(args_info.get_given) { CControlValue value; // Resolve the control Id CControlId controlId = get_control_id(handle, args_info.get_arg); if(!controlId) { res = 1; print_handle_error(handle, "Unknown control specified", -1); goto done; } // Retrieve the control value res = c_get_control(handle, controlId, &value); if(res) { print_handle_error(handle, "Unable to retrieve control value", res); goto done; } printf("%d\n", value.value); } // Retrieve raw control value else if(args_info.get_raw_given) { //scan input uint16_t unit_id; unsigned char selector; sscanf(args_info.get_raw_arg, "%hu:%hhu", &unit_id, &selector); CControlValue value; value.type = CC_TYPE_RAW; // the entity is only used for the generating a control name //TODO: pass the guid through cmdline (optional) unsigned char entity[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; res = c_read_xu_control(handle, entity, unit_id, selector, &value); if(res) { print_handle_error(handle, "Unable to retrieve control value", res); goto done; } //print the raw value uint8_t * val = value.raw.data; int i=0; printf("query current value of: (LE)0x"); for(i=0; i<value.raw.size; i++) { printf("%.2x", val[i]); } printf(" (BE)0x"); for(i=value.raw.size-1; i >=0; i--) { printf("%.2x", val[i]); } printf("\n"); //free the raw value alocation if(value.raw.data) free(value.raw.data); } else if(args_info.set_given) { CControlValue value; // Parse the control value if(args_info.inputs_num < 1) { res = 3; print_error("No control value specified", -1); goto done; } if(parse_control_value(args_info.inputs[0], &value)) { res = 2; print_error("Invalid control value specified", -1); goto done; } // Resolve the control Id CControlId controlId = get_control_id(handle, args_info.set_arg); if(!controlId) { res = 1; print_handle_error(handle, "Unknown control specified", -1); goto done; } // Set the new control value res = c_set_control(handle, controlId, &value); if(res) { print_handle_error(handle, "Unable to set new control value", res); goto done; } } // Set the raw control value else if(args_info.set_raw_given) { CControlValue value; // Parse the control value if(args_info.inputs_num < 1) { res = 3; print_error("No raw control value specified", -1); goto done; } uint16_t unit_id; unsigned char selector; sscanf(args_info.set_raw_arg, "%hu:%hhu", &unit_id, &selector); parse_raw_control_value (args_info.inputs[0], &value); // the entity is only used for the generating a control name //TODO: pass the guid through cmdline (optional) unsigned char entity[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; res = c_write_xu_control(handle, entity, unit_id, selector, &value); if(res) { print_handle_error(handle, "Unable to set the control value", res); goto done; } //print the raw value le and be format uint8_t * val = value.raw.data; int i=0; printf("set value of : (LE)0x"); for(i=0; i<value.raw.size; i++) { printf("%.2x", val[i]); } printf(" (BE)0x"); for(i=value.raw.size-1; i >=0; i--) { printf("%.2x", val[i]); } printf("\n"); //free the raw value alocation if(value.raw.data) free(value.raw.data); } else if(args_info.save_ctrl_given) { res = save_controls( handle, args_info.save_ctrl_arg); } else if(args_info.load_ctrl_given) { res = load_controls( handle, args_info.load_ctrl_arg); } // Clean up done: if(handle) c_close_device(handle); c_cleanup(); cmdline_parser_free(&args_info); return res; }
bool GetInfo_PCI(QTreeWidget* tree) { return list_devices(tree, (char *)"PdDvLn like '*/pci/*'"); }