print_device(device *me, void *ignore_or_null) { printf_filtered("%s\n", device_path(me)); print_properties(me); device_interrupt_traverse(me, print_interrupts, NULL); }
void Configurable::delegate_print_properties(std::vector<std::string> &chain) { if(chain.size() == 0) { // We are the chosen ones print_properties(); } else { // Do we have a subcontext of the right name? const std::string context(chain.back()); std::map<const std::string, Configurable *>::iterator found; found = active_sub_contexts.find(context); if(found != active_sub_contexts.end()) { chain.pop_back(); found->second->delegate_print_properties(chain); } else { std::cerr << "Error: '" << name << "' does not have context '" << context << "'" << std::endl; } } }
int main(int argc, char *argv[]) { UcaPluginManager *manager; UcaCamera *camera; gchar *name; GError *error = NULL; #if !(GLIB_CHECK_VERSION (2, 36, 0)) g_type_init(); #endif manager = uca_plugin_manager_new (); if (argc < 2) { name = g_strdup ("Basic camera"); camera = g_object_new (UCA_TYPE_CAMERA, NULL); } else { name = argv[1]; camera = uca_plugin_manager_get_camera (manager, name, &error, NULL); } if (camera == NULL) { g_print("Error during initialization: %s\n", error->message); print_usage(); return 1; } g_print (html_header, name); g_print ("<div id=\"header\"><h1 class=\"title\">Property documentation of %s</h1>", name); print_properties (camera); g_print ("%s\n", html_footer); g_object_unref (camera); g_object_unref (manager); }
static void print_device (struct hw *me, void *data) { struct printer *p = data; p->print (p->file, "%s\n", hw_path (me)); print_properties (me, p); hw_port_traverse (me, print_interrupts, data); }
static void print_info (GstDiscovererInfo * info, GError * err) { GstDiscovererResult result = gst_discoverer_info_get_result (info); GstDiscovererStreamInfo *sinfo; g_print ("Done discovering %s\n", gst_discoverer_info_get_uri (info)); switch (result) { case GST_DISCOVERER_OK: { break; } case GST_DISCOVERER_URI_INVALID: { g_print ("URI is not valid\n"); break; } case GST_DISCOVERER_ERROR: { g_print ("An error was encountered while discovering the file\n"); g_print (" %s\n", err->message); break; } case GST_DISCOVERER_TIMEOUT: { g_print ("Analyzing URI timed out\n"); break; } case GST_DISCOVERER_BUSY: { g_print ("Discoverer was busy\n"); break; } case GST_DISCOVERER_MISSING_PLUGINS: { g_print ("Missing plugins\n"); if (verbose) { gchar *tmp = gst_structure_to_string (gst_discoverer_info_get_misc (info)); g_print (" (%s)\n", tmp); g_free (tmp); } break; } } if ((sinfo = gst_discoverer_info_get_stream_info (info))) { g_print ("\nTopology:\n"); print_topology (sinfo, 1); g_print ("\nProperties:\n"); print_properties (info, 1); gst_discoverer_stream_info_unref (sinfo); } g_print ("\n"); }
void print_plane(Plane& p, int ind) { printf("%sPlane Id %d %d,%d -> %dx%d formats:", width(ind, "").c_str(), p.id(), p.crtc_x(), p.crtc_y(), p.x(), p.y()); for (auto f : p.get_formats()) printf(" %s", PixelFormatToFourCC(f).c_str()); printf("\n"); if (opts.print_props) print_properties(p, ind+2); }
void print_encoder(Encoder& e, int ind) { printf("%sEncoder Id %d type %s\n", width(ind, "").c_str(), e.id(), e.get_encoder_type().c_str()); if (opts.print_props) print_properties(e, ind+2); if (opts.recurse) for (auto cc : e.get_possible_crtcs()) print_crtc(*cc, ind + 2); }
/** * print information about a source */ void sourcelist_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata) { printf("func = %s , LINE = %d eol = %d \n",__func__,__LINE__,eol); if (eol > 0) { printf("**No more sources\n"); no_more_sources_or_sinks++; if (no_more_sources_or_sinks == 2) exit(0); return; } printf("Source: name %s, description %s\n", i->name, i->description); print_properties(i->proplist); }
/** * print information about a sink */ void sinklist_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata) { printf("func = %s , LINE = %d eol = %d \n",__func__,__LINE__,eol); // If eol is set to a positive number, you're at the end of the list if (eol > 0) { printf("**No more sinks\n"); no_more_sources_or_sinks++; if (no_more_sources_or_sinks == 2) exit(0); return; } printf("Sink: name %s, description %s\n", i->name, i->description); print_properties(i->proplist); }
static void print_containers(const GPtrArray *containers) { if(containers != NULL) { unsigned int i; g_print(" containers:\n"); for(i = 0; i < containers->len; i++) { Container *container = g_ptr_array_index(containers, i); g_print(" %s:\n", container->name); print_properties(container->properties); g_print("\n"); } } }
void print_crtc(Crtc& cc, int ind) { printf("%sCRTC Id %d BufferId %d %dx%d at %dx%d gamma_size %d\n", width(ind, "").c_str(), cc.id(), cc.buffer_id(), cc.width(), cc.height(), cc.x(), cc.y(), cc.gamma_size()); printf("%s Mode ", width(ind, "").c_str()); print_mode(cc.mode(), 0); if (opts.print_props) print_properties(cc, ind+2); if (opts.recurse) for (auto p : cc.get_possible_planes()) print_plane(*p, ind + 2); }
void print_target_array(const GPtrArray *target_array) { unsigned int i; for(i = 0; i < target_array->len; i++) { Target *target = g_ptr_array_index(target_array, i); g_print("Target:\n"); print_properties(target->properties); print_containers(target->containers); print_reserved_properties(target); g_print("\n"); } }
void print_connector(Connector& c, int ind) { printf("%sConnector %s Id %d %sconnected", width(ind, "").c_str(), c.fullname().c_str(), c.id(), c.connected() ? "" : "dis"); if (c.subpixel() != 0) printf(" Subpixel: %s", c.subpixel_str().c_str()); printf("\n"); if (opts.print_props) print_properties(c, ind+2); if (opts.recurse) for (auto enc : c.get_encoders()) print_encoder(*enc, ind + 2); if (opts.print_modes) { auto modes = c.get_modes(); printf("%sModes, %u in total:\n", width(ind + 2, "").c_str(), (unsigned) modes.size()); for (auto mode : modes) print_mode(mode, ind + 3); } }
/** * Handle characteristics discovered. * * The GattClient invoke this function when a characteristic has been * discovered. * * @see GattClient::launchServiceDiscovery */ void when_characteristic_discovered(const DiscoveredCharacteristic *discovered_characteristic) { // print characteristics properties printf("\tCharacteristic discovered: uuid = "); print_uuid(discovered_characteristic->getUUID()); printf(", properties = "); print_properties(discovered_characteristic->getProperties()); printf( ", decl handle = %u, value handle = %u, last handle = %u.\r\n", discovered_characteristic->getDeclHandle(), discovered_characteristic->getValueHandle(), discovered_characteristic->getLastHandle() ); // add the characteristic into the list of discovered characteristics bool success = add_characteristic(discovered_characteristic); if (!success) { printf("Error: memory allocation failure while adding the discovered characteristic.\r\n"); _client->terminateServiceDiscovery(); stop(); return; } }
int main(int argc, char **argv ) { if (argc ==3) { int bus = atol(argv[1]); int puck = atol(argv[2]); if ((puck < 1) || (puck > 14)) { printf("Error: puck id %d not in the range 1-14\n",puck); usage(argv[0]); exit(1); } printf("Property values for puck %d:\n", puck); CANbus *canbus = new CANbus(bus,0,true,false,false,true); if (canbus->open() == OW_FAILURE) { printf("Unable to open CANbus device\n"); return 1; } int result=print_properties(puck,canbus); delete canbus; return result; } else { usage(argv[0]); exit(1); } }
int main(void) { EdcHost *host; g_type_init(); host = edc_host_new(); g_signal_connect(host, "notify::address", G_CALLBACK(property_notified), NULL); g_signal_connect(host, "notify::port", G_CALLBACK(property_notified), NULL); g_object_set (host, "name", "hello", "address", "192.168.0.1", "port", 8087, NULL); edc_host_set_name(host, "world"); edc_host_set_address(host, "192.168.0.22"); func(host); print_properties(G_OBJECT(host)); g_object_unref(host); return 0; }
/* This implements the `svn_opt_subcommand_t' interface. */ svn_error_t * svn_cl__propget(apr_getopt_t *os, void *baton, apr_pool_t *pool) { svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; const char *pname, *pname_utf8; apr_array_header_t *args, *targets; svn_stream_t *out; if (opt_state->verbose && (opt_state->revprop || opt_state->strict || opt_state->xml)) return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL, _("--verbose cannot be used with --revprop or " "--strict or --xml")); /* PNAME is first argument (and PNAME_UTF8 will be a UTF-8 version thereof) */ SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool)); pname = APR_ARRAY_IDX(args, 0, const char *); SVN_ERR(svn_utf_cstring_to_utf8(&pname_utf8, pname, pool)); if (! svn_prop_name_is_valid(pname_utf8)) return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL, _("'%s' is not a valid Subversion property name"), pname_utf8); SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os, opt_state->targets, ctx, FALSE, pool)); /* Add "." if user passed 0 file arguments */ svn_opt_push_implicit_dot_target(targets, pool); /* Open a stream to stdout. */ SVN_ERR(svn_stream_for_stdout(&out, pool)); if (opt_state->revprop) /* operate on a revprop */ { svn_revnum_t rev; const char *URL; svn_string_t *propval; SVN_ERR(svn_cl__revprop_prepare(&opt_state->start_revision, targets, &URL, ctx, pool)); /* Let libsvn_client do the real work. */ SVN_ERR(svn_client_revprop_get(pname_utf8, &propval, URL, &(opt_state->start_revision), &rev, ctx, pool)); if (propval != NULL) { if (opt_state->xml) { svn_stringbuf_t *sb = NULL; char *revstr = apr_psprintf(pool, "%ld", rev); SVN_ERR(svn_cl__xml_print_header("properties", pool)); svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "revprops", "rev", revstr, NULL); svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, pool); svn_xml_make_close_tag(&sb, pool, "revprops"); SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout)); SVN_ERR(svn_cl__xml_print_footer("properties", pool)); } else { svn_string_t *printable_val = propval; /* If this is a special Subversion property, it is stored as UTF8 and LF, so convert to the native locale and eol-style. */ if (svn_prop_needs_translation(pname_utf8)) SVN_ERR(svn_subst_detranslate_string(&printable_val, propval, TRUE, pool)); SVN_ERR(stream_write(out, printable_val->data, printable_val->len)); if (! opt_state->strict) SVN_ERR(stream_write(out, APR_EOL_STR, strlen(APR_EOL_STR))); } } } else /* operate on a normal, versioned property (not a revprop) */ { apr_pool_t *subpool = svn_pool_create(pool); int i; if (opt_state->xml) SVN_ERR(svn_cl__xml_print_header("properties", subpool)); if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_empty; /* Strict mode only makes sense for a single target. So make sure we have only a single target, and that we're not being asked to recurse on that target. */ if (opt_state->strict && ((targets->nelts > 1) || (opt_state->depth != svn_depth_empty))) return svn_error_create (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, _("Strict output of property values only available for single-" "target, non-recursive propget operations")); for (i = 0; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); apr_hash_t *props; svn_boolean_t print_filenames; svn_boolean_t omit_newline; svn_boolean_t like_proplist; const char *truepath; svn_opt_revision_t peg_revision; svn_pool_clear(subpool); SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton)); /* Check for a peg revision. */ SVN_ERR(svn_opt_parse_path(&peg_revision, &truepath, target, subpool)); if (!svn_path_is_url(truepath)) SVN_ERR(svn_dirent_get_absolute(&truepath, truepath, subpool)); SVN_ERR(svn_client_propget4(&props, pname_utf8, truepath, &peg_revision, &(opt_state->start_revision), NULL, opt_state->depth, opt_state->changelists, ctx, subpool, subpool)); /* Any time there is more than one thing to print, or where the path associated with a printed thing is not obvious, we'll print filenames. That is, unless we've been told not to do so with the --strict option. */ print_filenames = ((opt_state->depth > svn_depth_empty || targets->nelts > 1 || apr_hash_count(props) > 1 || opt_state->verbose) && (! opt_state->strict)); omit_newline = opt_state->strict; like_proplist = opt_state->verbose && !opt_state->strict; if (opt_state->xml) SVN_ERR(print_properties_xml(pname_utf8, props, subpool)); else SVN_ERR(print_properties(out, svn_path_is_url(target), pname_utf8, props, print_filenames, omit_newline, like_proplist, subpool)); } if (opt_state->xml) SVN_ERR(svn_cl__xml_print_footer("properties", subpool)); svn_pool_destroy(subpool); } return SVN_NO_ERROR; }
/* dumps the current system state to stdout */ static void dumpstate() { time_t now = time(NULL); char build[PROPERTY_VALUE_MAX], fingerprint[PROPERTY_VALUE_MAX]; char radio[PROPERTY_VALUE_MAX], bootloader[PROPERTY_VALUE_MAX]; char network[PROPERTY_VALUE_MAX], date[80]; char build_type[PROPERTY_VALUE_MAX]; property_get("ro.build.display.id", build, "(unknown)"); property_get("ro.build.fingerprint", fingerprint, "(unknown)"); property_get("ro.build.type", build_type, "(unknown)"); property_get("ro.baseband", radio, "(unknown)"); property_get("ro.bootloader", bootloader, "(unknown)"); property_get("gsm.operator.alpha", network, "(unknown)"); strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&now)); printf("========================================================\n"); printf("== dumpstate: %s\n", date); printf("========================================================\n"); printf("\n"); printf("Build: %s\n", build); printf("Build fingerprint: '%s'\n", fingerprint); /* format is important for other tools */ printf("Bootloader: %s\n", bootloader); printf("Radio: %s\n", radio); printf("Network: %s\n", network); printf("Kernel: "); dump_file(NULL, "/proc/version"); printf("Command line: %s\n", strtok(cmdline_buf, "\n")); printf("\n"); run_command("UPTIME", 10, "uptime", NULL); dump_file("MEMORY INFO", "/proc/meminfo"); run_command("CPU INFO", 10, "top", "-n", "1", "-d", "1", "-m", "30", "-t", NULL); run_command("PROCRANK", 20, "procrank", NULL); dump_file("VIRTUAL MEMORY STATS", "/proc/vmstat"); dump_file("VMALLOC INFO", "/proc/vmallocinfo"); dump_file("SLAB INFO", "/proc/slabinfo"); dump_file("ZONEINFO", "/proc/zoneinfo"); dump_file("PAGETYPEINFO", "/proc/pagetypeinfo"); dump_file("BUDDYINFO", "/proc/buddyinfo"); dump_file("FRAGMENTATION INFO", "/d/extfrag/unusable_index"); dump_file("KERNEL WAKELOCKS", "/proc/wakelocks"); dump_file("KERNEL WAKE SOURCES", "/d/wakeup_sources"); dump_file("KERNEL CPUFREQ", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state"); dump_file("KERNEL SYNC", "/d/sync"); run_command("PROCESSES", 10, "ps", "-P", NULL); run_command("PROCESSES AND THREADS", 10, "ps", "-t", "-p", "-P", NULL); run_command("LIBRANK", 10, "librank", NULL); do_dmesg(); run_command("LIST OF OPEN FILES", 10, SU_PATH, "root", "lsof", NULL); for_each_pid(do_showmap, "SMAPS OF ALL PROCESSES"); for_each_pid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS"); // dump_file("EVENT LOG TAGS", "/etc/event-log-tags"); run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL); run_command("EVENT LOG", 20, "logcat", "-b", "events", "-v", "threadtime", "-d", "*:v", NULL); run_command("RADIO LOG", 20, "logcat", "-b", "radio", "-v", "threadtime", "-d", "*:v", NULL); /* show the traces we collected in main(), if that was done */ if (dump_traces_path != NULL) { dump_file("VM TRACES JUST NOW", dump_traces_path); } /* only show ANR traces if they're less than 15 minutes old */ struct stat st; char anr_traces_path[PATH_MAX]; property_get("dalvik.vm.stack-trace-file", anr_traces_path, ""); if (!anr_traces_path[0]) { printf("*** NO VM TRACES FILE DEFINED (dalvik.vm.stack-trace-file)\n\n"); } else if (stat(anr_traces_path, &st)) { printf("*** NO ANR VM TRACES FILE (%s): %s\n\n", anr_traces_path, strerror(errno)); } else { dump_file("VM TRACES AT LAST ANR", anr_traces_path); } /* slow traces for slow operations */ if (anr_traces_path[0] != 0) { int tail = strlen(anr_traces_path)-1; while (tail > 0 && anr_traces_path[tail] != '/') { tail--; } int i = 0; while (1) { sprintf(anr_traces_path+tail+1, "slow%02d.txt", i); if (stat(anr_traces_path, &st)) { // No traces file at this index, done with the files. break; } dump_file("VM TRACES WHEN SLOW", anr_traces_path); i++; } } dump_file("NETWORK DEV INFO", "/proc/net/dev"); dump_file("QTAGUID NETWORK INTERFACES INFO", "/proc/net/xt_qtaguid/iface_stat_all"); dump_file("QTAGUID NETWORK INTERFACES INFO (xt)", "/proc/net/xt_qtaguid/iface_stat_fmt"); dump_file("QTAGUID CTRL INFO", "/proc/net/xt_qtaguid/ctrl"); dump_file("QTAGUID STATS INFO", "/proc/net/xt_qtaguid/stats"); dump_file("NETWORK ROUTES", "/proc/net/route"); dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route"); /* TODO: Make last_kmsg CAP_SYSLOG protected. b/5555691 */ dump_file("LAST KMSG", "/proc/last_kmsg"); dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console"); dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads"); if (screenshot_path[0]) { ALOGI("taking screenshot\n"); run_command(NULL, 5, SU_PATH, "root", "screenshot", screenshot_path, NULL); ALOGI("wrote screenshot: %s\n", screenshot_path); } run_command("SYSTEM SETTINGS", 20, SU_PATH, "root", "sqlite3", "/data/data/com.android.providers.settings/databases/settings.db", "pragma user_version; select * from system; select * from secure; select * from global;", NULL); /* The following have a tendency to get wedged when wifi drivers/fw goes belly-up. */ run_command("NETWORK INTERFACES", 10, SU_PATH, "root", "netcfg", NULL); run_command("IP RULES", 10, "ip", "rule", "show", NULL); run_command("IP RULES v6", 10, "ip", "-6", "rule", "show", NULL); run_command("ROUTE TABLE 60", 10, "ip", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61", 10, "ip", "route", "show", "table", "61", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "61", NULL); dump_file("ARP CACHE", "/proc/net/arp"); run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL); run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL); run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-nvx", NULL); /* no ip6 nat */ run_command("IPTABLE RAW", 10, SU_PATH, "root", "iptables", "-t", "raw", "-L", "-nvx", NULL); run_command("IP6TABLE RAW", 10, SU_PATH, "root", "ip6tables", "-t", "raw", "-L", "-nvx", NULL); run_command("WIFI NETWORKS", 20, SU_PATH, "root", "wpa_cli", "list_networks", NULL); #ifdef FWDUMP_bcmdhd run_command("DUMP WIFI INTERNAL COUNTERS", 20, SU_PATH, "root", "wlutil", "counters", NULL); #endif dump_file("INTERRUPTS (1)", "/proc/interrupts"); property_get("dhcp.wlan0.gateway", network, ""); if (network[0]) run_command("PING GATEWAY", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); property_get("dhcp.wlan0.dns1", network, ""); if (network[0]) run_command("PING DNS1", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); property_get("dhcp.wlan0.dns2", network, ""); if (network[0]) run_command("PING DNS2", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); #ifdef FWDUMP_bcmdhd run_command("DUMP WIFI STATUS", 20, SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL); run_command("DUMP WIFI INTERNAL COUNTERS", 20, SU_PATH, "root", "wlutil", "counters", NULL); #endif dump_file("INTERRUPTS (2)", "/proc/interrupts"); print_properties(); run_command("VOLD DUMP", 10, "vdc", "dump", NULL); run_command("SECURE CONTAINERS", 10, "vdc", "asec", "list", NULL); run_command("FILESYSTEMS & FREE SPACE", 10, SU_PATH, "root", "df", NULL); run_command("PACKAGE SETTINGS", 20, SU_PATH, "root", "cat", "/data/system/packages.xml", NULL); dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt"); run_command("LAST RADIO LOG", 10, "parse_radio_log", "/proc/last_radio_log", NULL); printf("------ BACKLIGHTS ------\n"); printf("LCD brightness="); dump_file(NULL, "/sys/class/leds/lcd-backlight/brightness"); printf("Button brightness="); dump_file(NULL, "/sys/class/leds/button-backlight/brightness"); printf("Keyboard brightness="); dump_file(NULL, "/sys/class/leds/keyboard-backlight/brightness"); printf("ALS mode="); dump_file(NULL, "/sys/class/leds/lcd-backlight/als"); printf("LCD driver registers:\n"); dump_file(NULL, "/sys/class/leds/lcd-backlight/registers"); printf("\n"); /* Binder state is expensive to look at as it uses a lot of memory. */ dump_file("BINDER FAILED TRANSACTION LOG", "/sys/kernel/debug/binder/failed_transaction_log"); dump_file("BINDER TRANSACTION LOG", "/sys/kernel/debug/binder/transaction_log"); dump_file("BINDER TRANSACTIONS", "/sys/kernel/debug/binder/transactions"); dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats"); dump_file("BINDER STATE", "/sys/kernel/debug/binder/state"); #ifdef BOARD_HAS_DUMPSTATE printf("========================================================\n"); printf("== Board\n"); printf("========================================================\n"); dumpstate_board(); printf("\n"); #endif /* Migrate the ril_dumpstate to a dumpstate_board()? */ char ril_dumpstate_timeout[PROPERTY_VALUE_MAX] = {0}; property_get("ril.dumpstate.timeout", ril_dumpstate_timeout, "30"); if (strnlen(ril_dumpstate_timeout, PROPERTY_VALUE_MAX - 1) > 0) { if (0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1)) { // su does not exist on user builds, so try running without it. // This way any implementations of vril-dump that do not require // root can run on user builds. run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout), "vril-dump", NULL); } else { run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout), SU_PATH, "root", "vril-dump", NULL); } } printf("========================================================\n"); printf("== Android Framework Services\n"); printf("========================================================\n"); /* the full dumpsys is starting to take a long time, so we need to increase its timeout. we really need to do the timeouts in dumpsys itself... */ run_command("DUMPSYS", 60, "dumpsys", NULL); printf("========================================================\n"); printf("== Running Application Activities\n"); printf("========================================================\n"); run_command("APP ACTIVITIES", 30, "dumpsys", "activity", "all", NULL); printf("========================================================\n"); printf("== Running Application Services\n"); printf("========================================================\n"); run_command("APP SERVICES", 30, "dumpsys", "activity", "service", "all", NULL); printf("========================================================\n"); printf("== Running Application Providers\n"); printf("========================================================\n"); run_command("APP SERVICES", 30, "dumpsys", "activity", "provider", "all", NULL); printf("========================================================\n"); printf("== dumpstate: done\n"); printf("========================================================\n"); }
/* dumps the current system state to stdout */ static void dumpstate(int full) { if (full) { PRINT("========================================================"); PRINT("== dumpstate"); PRINT("========================================================"); PRINT("------ MEMORY INFO ------"); DUMP("/proc/meminfo"); PRINT("------ CPU INFO ------"); EXEC7("top", "-n", "1", "-d", "1", "-m", "30", "-t"); PRINT("------ PROCRANK ------"); EXEC_XBIN("procrank"); PRINT("------ VIRTUAL MEMORY STATS ------"); DUMP("/proc/vmstat"); PRINT("------ SLAB INFO ------"); DUMP("/proc/slabinfo"); PRINT("------ ZONEINFO ------"); DUMP("/proc/zoneinfo"); PRINT("------ SYSTEM LOG ------"); EXEC4("logcat", "-v", "time", "-d", "*:v"); PRINT("------ VM TRACES ------"); DUMP("/data/anr/traces.txt"); PRINT("------ EVENT LOG TAGS ------"); DUMP("/etc/event-log-tags"); PRINT("------ EVENT LOG ------"); EXEC6("logcat", "-b", "events", "-v", "time", "-d", "*:v"); PRINT("------ RADIO LOG ------"); EXEC6("logcat", "-b", "radio", "-v", "time", "-d", "*:v"); PRINT("------ NETWORK STATE ------"); PRINT("Interfaces:"); EXEC("netcfg"); PRINT(""); PRINT("Routes:"); DUMP("/proc/net/route"); PRINT("------ SYSTEM PROPERTIES ------"); print_properties(); PRINT("------ KERNEL LOG ------"); EXEC("dmesg"); PRINT("------ KERNEL WAKELOCKS ------"); DUMP("/proc/wakelocks"); PRINT(""); PRINT("------ PROCESSES ------"); EXEC("ps"); PRINT("------ PROCESSES AND THREADS ------"); EXEC2("ps", "-t", "-p"); PRINT("------ LIBRANK ------"); EXEC_XBIN("librank"); PRINT("------ BINDER FAILED TRANSACTION LOG ------"); DUMP("/proc/binder/failed_transaction_log"); PRINT(""); PRINT("------ BINDER TRANSACTION LOG ------"); DUMP("/proc/binder/transaction_log"); PRINT(""); PRINT("------ BINDER TRANSACTIONS ------"); DUMP("/proc/binder/transactions"); PRINT(""); PRINT("------ BINDER STATS ------"); DUMP("/proc/binder/stats"); PRINT(""); PRINT("------ BINDER PROCESS STATE: $i ------"); DUMP_FILES("/proc/binder/proc"); PRINT("------ FILESYSTEMS ------"); EXEC("df"); PRINT("------ PACKAGE SETTINGS ------"); DUMP("/data/system/packages.xml"); PRINT("------ PACKAGE UID ERRORS ------"); DUMP("/data/system/uiderrors.txt"); PRINT("------ LAST KERNEL LOG ------"); DUMP("/proc/last_kmsg"); } PRINT("========================================================"); PRINT("== build.prop"); PRINT("========================================================"); /* the crash server parses key-value pairs between the VERSION INFO and * END lines so we can aggregate crash reports based on this data. */ PRINT("------ VERSION INFO ------"); print_date("currenttime=", &now); DUMP_PROMPT("kernel.version=", "/proc/version"); DUMP_PROMPT("kernel.cmdline=", "/proc/cmdline"); DUMP("/system/build.prop"); PROPERTY("gsm.version.ril-impl"); PROPERTY("gsm.version.baseband"); PROPERTY("gsm.imei"); PROPERTY("gsm.sim.operator.numeric"); PROPERTY("gsm.operator.alpha"); PRINT("------ END ------"); if (full) { PRINT("========================================================"); PRINT("== dumpsys"); PRINT("========================================================"); /* the full dumpsys is starting to take a long time, so we need to increase its timeout. we really need to do the timeouts in dumpsys itself... */ EXEC_TIMEOUT("dumpsys", 60); } }
static void print_info (GstDiscovererInfo * info, GError * err) { GstDiscovererResult result; GstDiscovererStreamInfo *sinfo; if (!info) { g_print ("Could not discover URI\n"); g_print (" %s\n", err->message); return; } result = gst_discoverer_info_get_result (info); g_print ("Done discovering %s\n", gst_discoverer_info_get_uri (info)); switch (result) { case GST_DISCOVERER_OK: { break; } case GST_DISCOVERER_URI_INVALID: { g_print ("URI is not valid\n"); break; } case GST_DISCOVERER_ERROR: { g_print ("An error was encountered while discovering the file\n"); g_print (" %s\n", err->message); break; } case GST_DISCOVERER_TIMEOUT: { g_print ("Analyzing URI timed out\n"); break; } case GST_DISCOVERER_BUSY: { g_print ("Discoverer was busy\n"); break; } case GST_DISCOVERER_MISSING_PLUGINS: { g_print ("Missing plugins\n"); if (verbose) { gint i = 0; const gchar **installer_details = gst_discoverer_info_get_missing_elements_installer_details (info); while (installer_details[i]) { g_print (" (%s)\n", installer_details[i]); i++; } } break; } } if ((sinfo = gst_discoverer_info_get_stream_info (info))) { g_print ("\nTopology:\n"); print_topology (sinfo, 1); g_print ("\nProperties:\n"); print_properties (info, 1); gst_discoverer_stream_info_unref (sinfo); } g_print ("\n"); }