The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/prober: Port to u_logging.

authored by

Lubosz Sarnecki and committed by
Jakob Bornecrantz
a8b01a89 55d6d573

+152 -178
+24 -25
src/xrt/state_trackers/prober/p_dump.c
··· 75 75 return; 76 76 } 77 77 78 - printf("\t% 3i: 0x%04x:0x%04x\n", id, pdev->base.vendor_id, 79 - pdev->base.product_id); 80 - printf("\t\tptr: %p\n", (void *)pdev); 81 - printf("\t\tusb_dev_class: %02x\n", pdev->base.usb_dev_class); 78 + U_LOG_I("\t% 3i: 0x%04x:0x%04x", id, pdev->base.vendor_id, 79 + pdev->base.product_id); 80 + U_LOG_I("\t\tptr: %p", (void *)pdev); 81 + U_LOG_I("\t\tusb_dev_class: %02x", pdev->base.usb_dev_class); 82 82 83 83 84 84 if (pdev->usb.serial != NULL || pdev->usb.product != NULL || 85 85 pdev->usb.manufacturer != NULL) { 86 - printf("\t\tusb.product: %s\n", pdev->usb.product); 87 - printf("\t\tusb.manufacturer: %s\n", pdev->usb.manufacturer); 88 - printf("\t\tusb.serial: %s\n", pdev->usb.serial); 86 + U_LOG_I("\t\tusb.product: %s", pdev->usb.product); 87 + U_LOG_I("\t\tusb.manufacturer: %s", pdev->usb.manufacturer); 88 + U_LOG_I("\t\tusb.serial: %s", pdev->usb.serial); 89 89 } 90 90 91 91 if (pdev->usb.bus != 0 || pdev->usb.addr != 0) { 92 - printf("\t\tusb.bus: %i\n", pdev->usb.bus); 93 - printf("\t\tusb.addr: %i\n", pdev->usb.addr); 92 + U_LOG_I("\t\tusb.bus: %i", pdev->usb.bus); 93 + U_LOG_I("\t\tusb.addr: %i", pdev->usb.addr); 94 94 } 95 95 96 96 if (pdev->bluetooth.id != 0) { 97 - printf("\t\tbluetooth.id: %012" PRIx64 "\n", 98 - pdev->bluetooth.id); 97 + U_LOG_I("\t\tbluetooth.id: %012" PRIx64 "", 98 + pdev->bluetooth.id); 99 99 } 100 100 101 101 int num = pdev->usb.num_ports; 102 102 if (print_ports(tmp, ARRAY_SIZE(tmp), pdev->usb.ports, num)) { 103 - printf("\t\tport%s %s\n", num > 1 ? "s:" : ": ", 104 - tmp); 103 + U_LOG_I("\t\tport%s %s", num > 1 ? "s:" : ": ", tmp); 105 104 } 106 105 107 106 #ifdef XRT_HAVE_LIBUSB 108 107 if (pdev->usb.dev != NULL) { 109 - printf("\t\tlibusb: %p\n", (void *)pdev->usb.dev); 108 + U_LOG_I("\t\tlibusb: %p", (void *)pdev->usb.dev); 110 109 } 111 110 #endif 112 111 ··· 115 114 if (uvc_dev != NULL) { 116 115 struct uvc_device_descriptor *desc; 117 116 118 - printf("\t\tlibuvc: %p\n", (void *)uvc_dev); 117 + U_LOG_I("\t\tlibuvc: %p", (void *)uvc_dev); 119 118 120 119 uvc_get_device_descriptor(uvc_dev, &desc); 121 120 122 121 if (desc->product != NULL) { 123 122 124 - printf("\t\tproduct: '%s'\n", desc->product); 123 + U_LOG_I("\t\tproduct: '%s'", desc->product); 125 124 } 126 125 if (desc->manufacturer != NULL) { 127 126 128 - printf("\t\tmanufacturer: '%s'\n", 129 - desc->manufacturer); 127 + U_LOG_I("\t\tmanufacturer: '%s'", 128 + desc->manufacturer); 130 129 } 131 130 if (desc->serialNumber != NULL) { 132 131 133 - printf("\t\tserial: '%s'\n", 134 - desc->serialNumber); 132 + U_LOG_I("\t\tserial: '%s'", 133 + desc->serialNumber); 135 134 } 136 135 137 136 uvc_free_device_descriptor(desc); ··· 143 142 for (size_t j = 0; j < pdev->num_v4ls; j++) { 144 143 struct prober_v4l *v4l = &pdev->v4ls[j]; 145 144 146 - printf("\t\tv4l.iface: %i\n", (int)v4l->usb_iface); 147 - printf("\t\tv4l.index: %i\n", (int)v4l->v4l_index); 148 - printf("\t\tv4l.path: '%s'\n", v4l->path); 145 + U_LOG_I("\t\tv4l.iface: %i", (int)v4l->usb_iface); 146 + U_LOG_I("\t\tv4l.index: %i", (int)v4l->v4l_index); 147 + U_LOG_I("\t\tv4l.path: '%s'", v4l->path); 149 148 } 150 149 #endif 151 150 ··· 153 152 for (size_t j = 0; j < pdev->num_hidraws; j++) { 154 153 struct prober_hidraw *hidraw = &pdev->hidraws[j]; 155 154 156 - printf("\t\thidraw.iface: %i\n", (int)hidraw->interface); 157 - printf("\t\thidraw.path: '%s'\n", hidraw->path); 155 + U_LOG_I("\t\thidraw.iface: %i", (int)hidraw->interface); 156 + U_LOG_I("\t\thidraw.path: '%s'", hidraw->path); 158 157 } 159 158 #endif 160 159 }
+21 -24
src/xrt/state_trackers/prober/p_json.c
··· 54 54 ssize_t ret = 55 55 u_file_get_path_in_config_dir("config_v0.json", tmp, sizeof(tmp)); 56 56 if (ret <= 0) { 57 - fprintf(stderr, 58 - "ERROR:Could not load or create config file no $HOME " 59 - "or $XDG_CONFIG_HOME env variables defined\n"); 57 + U_LOG_E( 58 + "Could not load or create config file no $HOME " 59 + "or $XDG_CONFIG_HOME env variables defined"); 60 60 return; 61 61 } 62 62 ··· 70 70 char *str = read_content(file); 71 71 fclose(file); 72 72 if (str == NULL) { 73 - fprintf(stderr, "ERROR: Could not read the contents of '%s'!\n", 74 - tmp); 73 + U_LOG_E("Could not read the contents of '%s'!", tmp); 75 74 return; 76 75 } 77 76 ··· 83 82 84 83 p->json.root = cJSON_Parse(str); 85 84 if (p->json.root == NULL) { 86 - fprintf(stderr, "Failed to parse JSON in '%s':\n%s\n#######\n", 87 - tmp, str); 88 - fprintf(stderr, "'%s'\n", cJSON_GetErrorPtr()); 85 + U_LOG_E("Failed to parse JSON in '%s':\n%s\n#######", tmp, str); 86 + U_LOG_E("'%s'", cJSON_GetErrorPtr()); 89 87 } 90 88 91 89 free(str); ··· 100 98 { 101 99 cJSON *item = cJSON_GetObjectItemCaseSensitive(json, name); 102 100 if (item == NULL) { 103 - fprintf(stderr, "Failed to find node '%s'!\n", name); 101 + U_LOG_E("Failed to find node '%s'!", name); 104 102 } 105 103 return item; 106 104 } ··· 114 112 } 115 113 116 114 if (!u_json_get_bool(item, out_bool)) { 117 - fprintf(stderr, "Failed to parse '%s'!\n", name); 115 + U_LOG_E("Failed to parse '%s'!", name); 118 116 return false; 119 117 } 120 118 ··· 130 128 } 131 129 132 130 if (!u_json_get_int(item, out_int)) { 133 - fprintf(stderr, "Failed to parse '%s'!\n", name); 131 + U_LOG_E("Failed to parse '%s'!", name); 134 132 return false; 135 133 } 136 134 ··· 146 144 } 147 145 148 146 if (!u_json_get_string_into_array(item, array, array_size)) { 149 - fprintf(stderr, "Failed to parse '%s'!\n", name); 147 + U_LOG_E("Failed to parse '%s'!", name); 150 148 return false; 151 149 } 152 150 ··· 158 156 { 159 157 if (p->json.root == NULL) { 160 158 if (p->json.file_loaded) { 161 - fprintf(stderr, "JSON not parsed!\n"); 159 + U_LOG_E("JSON not parsed!"); 162 160 } else { 163 - fprintf(stderr, "No config file!\n"); 161 + U_LOG_W("No config file!"); 164 162 } 165 163 return false; 166 164 } ··· 180 178 } else if (strcmp(str, "remote") == 0) { 181 179 *out_active = P_ACTIVE_CONFIG_REMOTE; 182 180 } else { 183 - fprintf(stderr, "Unknown active config '%s' from %s.\n", str, 184 - from); 181 + U_LOG_E("Unknown active config '%s' from %s.", str, from); 185 182 *out_active = P_ACTIVE_CONFIG_NONE; 186 183 return false; 187 184 } ··· 212 209 { 213 210 cJSON *t = cJSON_GetObjectItemCaseSensitive(p->json.root, "remote"); 214 211 if (t == NULL) { 215 - fprintf(stderr, "No remote node\n"); 212 + U_LOG_E("No remote node"); 216 213 return false; 217 214 } 218 215 219 216 int ver = -1; 220 217 if (!get_obj_int(t, "version", &ver)) { 221 - fprintf(stderr, "Missing version tag!\n"); 218 + U_LOG_E("Missing version tag!"); 222 219 return false; 223 220 } 224 221 if (ver >= 1) { 225 - fprintf(stderr, "Unknown version tag '%i'!\n", ver); 222 + U_LOG_E("Unknown version tag '%i'!", ver); 226 223 return false; 227 224 } 228 225 ··· 241 238 { 242 239 if (p->json.root == NULL) { 243 240 if (p->json.file_loaded) { 244 - fprintf(stderr, "JSON not parsed!\n"); 241 + U_LOG_E("JSON not parsed!"); 245 242 } else { 246 - fprintf(stderr, "No config file!\n"); 243 + U_LOG_W("No config file!"); 247 244 } 248 245 return false; 249 246 } 250 247 251 248 cJSON *t = cJSON_GetObjectItemCaseSensitive(p->json.root, "tracking"); 252 249 if (t == NULL) { 253 - fprintf(stderr, "No tracking node\n"); 250 + U_LOG_E("No tracking node"); 254 251 return false; 255 252 } 256 253 ··· 261 258 262 259 bad |= !get_obj_int(t, "version", &ver); 263 260 if (bad || ver >= 1) { 264 - fprintf(stderr, "Missing or unknown version tag '%i'\n", ver); 261 + U_LOG_E("Missing or unknown version tag '%i'", ver); 265 262 return false; 266 263 } 267 264 ··· 284 281 } else if (strcmp(tmp, "leap_motion") == 0) { 285 282 s->camera_type = XRT_SETTINGS_CAMERA_TYPE_LEAP_MOTION; 286 283 } else { 287 - fprintf(stderr, "Unknown camera type '%s'\n", tmp); 284 + U_LOG_W("Unknown camera type '%s'", tmp); 288 285 return false; 289 286 } 290 287
+13 -13
src/xrt/state_trackers/prober/p_libusb.c
··· 71 71 72 72 ret = p_dev_get_usb_dev(p, bus, addr, vendor, product, &pdev); 73 73 74 - P_SPEW(p, 75 - "libusb\n" 76 - "\t\tptr: %p (%i)\n" 77 - "\t\tvendor_id: %04x\n" 78 - "\t\tproduct_id: %04x\n" 79 - "\t\tbus: %i\n" 80 - "\t\taddr: %i", 81 - (void *)pdev, ret, vendor, product, bus, addr); 74 + P_TRACE(p, 75 + "libusb\n" 76 + "\t\tptr: %p (%i)\n" 77 + "\t\tvendor_id: %04x\n" 78 + "\t\tproduct_id: %04x\n" 79 + "\t\tbus: %i\n" 80 + "\t\taddr: %i", 81 + (void *)pdev, ret, vendor, product, bus, addr); 82 82 83 83 if (ret != 0) { 84 84 P_ERROR(p, "p_dev_get_usb_device failed!"); ··· 144 144 case XRT_PROBER_STRING_SERIAL_NUMBER: which = desc.iSerialNumber; break; 145 145 default: break; 146 146 } 147 - P_SPEW(p, 148 - "libusb\n" 149 - "\t\tptr: %p\n" 150 - "\t\trequested string index: %i", 151 - (void *)pdev, which); 147 + P_TRACE(p, 148 + "libusb\n" 149 + "\t\tptr: %p\n" 150 + "\t\trequested string index: %i", 151 + (void *)pdev, which); 152 152 if (which == 0) { 153 153 // Not available? 154 154 return 0;
+12 -12
src/xrt/state_trackers/prober/p_libuvc.c
··· 71 71 72 72 ret = p_dev_get_usb_dev(p, bus, addr, vendor, product, &pdev); 73 73 74 - P_SPEW(p, 75 - "libuvc\n" 76 - "\t\tptr: %p (%i)\n" 77 - "\t\tvendor_id: %04x\n" 78 - "\t\tproduct_id: %04x\n" 79 - "\t\tbus: %i\n" 80 - "\t\taddr: %i\n" 81 - "\t\tserial: %s\n" 82 - "\t\tmanuf: %s\n" 83 - "\t\tproduct: %s", 84 - (void *)pdev, ret, vendor, product, bus, addr, 85 - desc->serialNumber, desc->manufacturer, desc->product); 74 + P_TRACE(p, 75 + "libuvc\n" 76 + "\t\tptr: %p (%i)\n" 77 + "\t\tvendor_id: %04x\n" 78 + "\t\tproduct_id: %04x\n" 79 + "\t\tbus: %i\n" 80 + "\t\taddr: %i\n" 81 + "\t\tserial: %s\n" 82 + "\t\tmanuf: %s\n" 83 + "\t\tproduct: %s", 84 + (void *)pdev, ret, vendor, product, bus, addr, 85 + desc->serialNumber, desc->manufacturer, desc->product); 86 86 87 87 uvc_free_device_descriptor(desc); 88 88
+8 -11
src/xrt/state_trackers/prober/p_prober.c
··· 39 39 * 40 40 */ 41 41 42 - DEBUG_GET_ONCE_BOOL_OPTION(prober_spew, "PROBER_PRINT_SPEW", false) 43 - DEBUG_GET_ONCE_BOOL_OPTION(prober_debug, "PROBER_PRINT_DEBUG", false) 42 + DEBUG_GET_ONCE_LOG_OPTION(prober_log, "PROBER_LOG", U_LOGGING_WARN) 44 43 45 44 static void 46 45 add_device(struct prober *p, struct prober_device **out_dev); ··· 330 329 p->base.can_open = can_open; 331 330 p->base.destroy = destroy; 332 331 p->lists = lists; 333 - p->print_spew = debug_get_bool_option_prober_spew(); 334 - p->print_debug = debug_get_bool_option_prober_debug(); 332 + p->ll = debug_get_log_option_prober_log(); 335 333 336 334 u_var_add_root((void *)p, "Prober", true); 337 - u_var_add_bool((void *)p, &p->print_debug, "Debug"); 338 - u_var_add_bool((void *)p, &p->print_spew, "Spew"); 335 + u_var_add_ro_u32(p, &p->ll, "Log Level"); 339 336 340 337 int ret; 341 338 ··· 764 761 765 762 ret = os_hid_open_hidraw(hidraw->path, out_hid_dev); 766 763 if (ret != 0) { 767 - P_ERROR(p, "Failed to open device '%s' got '%i'", 764 + U_LOG_E("Failed to open device '%s' got '%i'", 768 765 hidraw->path, ret); 769 766 return ret; 770 767 } ··· 773 770 } 774 771 #endif // XRT_OS_LINUX 775 772 776 - P_ERROR(p, 777 - "Could not find the requested " 778 - "hid interface (%i) on the device!", 779 - interface); 773 + U_LOG_E( 774 + "Could not find the requested " 775 + "hid interface (%i) on the device!", 776 + interface); 780 777 return -1; 781 778 } 782 779
+8 -26
src/xrt/state_trackers/prober/p_prober.h
··· 15 15 #include "xrt/xrt_prober.h" 16 16 #include "xrt/xrt_settings.h" 17 17 18 + #include "util/u_logging.h" 19 + 18 20 #ifdef XRT_HAVE_LIBUSB 19 21 #include <libusb.h> 20 22 #endif ··· 33 35 * 34 36 */ 35 37 36 - #define P_SPEW(p, ...) \ 37 - do { \ 38 - if (p->print_spew) { \ 39 - fprintf(stderr, "%s - ", __func__); \ 40 - fprintf(stderr, __VA_ARGS__); \ 41 - fprintf(stderr, "\n"); \ 42 - } \ 43 - } while (false) 44 - 45 - #define P_DEBUG(p, ...) \ 46 - do { \ 47 - if (p->print_debug) { \ 48 - fprintf(stderr, "%s - ", __func__); \ 49 - fprintf(stderr, __VA_ARGS__); \ 50 - fprintf(stderr, "\n"); \ 51 - } \ 52 - } while (false) 53 - 54 - #define P_ERROR(p, ...) \ 55 - do { \ 56 - fprintf(stderr, "%s - ", __func__); \ 57 - fprintf(stderr, __VA_ARGS__); \ 58 - fprintf(stderr, "\n"); \ 59 - } while (false) 38 + #define P_TRACE(d, ...) U_LOG_IFL_T(d->ll, __VA_ARGS__) 39 + #define P_DEBUG(d, ...) U_LOG_IFL_D(d->ll, __VA_ARGS__) 40 + #define P_INFO(d, ...) U_LOG_IFL_I(d->ll, __VA_ARGS__) 41 + #define P_WARN(d, ...) U_LOG_IFL_W(d->ll, __VA_ARGS__) 42 + #define P_ERROR(d, ...) U_LOG_IFL_E(d->ll, __VA_ARGS__) 60 43 61 44 #define MAX_AUTO_PROBERS 8 62 45 ··· 184 167 size_t num_entries; 185 168 struct xrt_prober_entry **entries; 186 169 187 - bool print_debug; 188 - bool print_spew; 170 + enum u_logging_level ll; 189 171 }; 190 172 191 173
+3 -3
src/xrt/state_trackers/prober/p_tracking.c
··· 137 137 fact->tried_settings = true; 138 138 139 139 if (!p_json_get_tracking_settings(fact->p, &fact->settings)) { 140 - fprintf(stderr, 141 - "ERROR: Could not setup PSVR and/or PSMV tracking, see " 142 - "above.\n"); 140 + U_LOG_E( 141 + "Could not setup PSVR and/or PSMV tracking, " 142 + "see above."); 143 143 return; 144 144 } 145 145
+63 -64
src/xrt/state_trackers/prober/p_udev.c
··· 137 137 { 138 138 struct udev *udev = udev_new(); 139 139 if (!udev) { 140 - P_ERROR(p, "Can't create udev\n"); 140 + P_ERROR(p, "Can't create udev"); 141 141 return -1; 142 142 } 143 143 ··· 213 213 ret = p_dev_get_usb_dev(p, usb_bus, usb_addr, vendor_id, 214 214 product_id, &pdev); 215 215 216 - P_SPEW(p, 217 - "usb\n" 218 - "\t\tptr: %p (%i)\n" 219 - "\t\tsysfs_path: '%s'\n" 220 - "\t\tdev_path: '%s'\n" 221 - "\t\tdev_class: %02x\n" 222 - "\t\tvendor_id: %04x\n" 223 - "\t\tproduct_id: %04x\n" 224 - "\t\tusb_bus: %i\n" 225 - "\t\tusb_addr: %i\n" 226 - "\t\tserial: '%s'\n" 227 - "\t\tproduct: '%s'\n" 228 - "\t\tmanufacturer: '%s'", 229 - (void *)pdev, ret, sysfs_path, dev_path, dev_class, 230 - vendor_id, product_id, usb_bus, usb_addr, serial, 231 - product, manufacturer); 216 + P_TRACE(p, 217 + "usb\n" 218 + "\t\tptr: %p (%i)\n" 219 + "\t\tsysfs_path: '%s'\n" 220 + "\t\tdev_path: '%s'\n" 221 + "\t\tdev_class: %02x\n" 222 + "\t\tvendor_id: %04x\n" 223 + "\t\tproduct_id: %04x\n" 224 + "\t\tusb_bus: %i\n" 225 + "\t\tusb_addr: %i\n" 226 + "\t\tserial: '%s'\n" 227 + "\t\tproduct: '%s'\n" 228 + "\t\tmanufacturer: '%s'", 229 + (void *)pdev, ret, sysfs_path, dev_path, dev_class, 230 + vendor_id, product_id, usb_bus, usb_addr, serial, 231 + product, manufacturer); 232 232 233 233 if (ret != 0) { 234 234 P_ERROR(p, "p_dev_get_usb_device failed!"); ··· 346 346 ret = p_dev_get_usb_dev(p, usb_bus, usb_addr, vendor_id, 347 347 product_id, &pdev); 348 348 349 - P_SPEW(p, 350 - "v4l\n" 351 - "\t\tptr: %p (%i)\n" 352 - "\t\tsysfs_path: '%s'\n" 353 - "\t\tdev_path: '%s'\n" 354 - "\t\tvendor_id: %04x\n" 355 - "\t\tproduct_id: %04x\n" 356 - "\t\tv4l_index: %u\n" 357 - "\t\tusb_iface: %i\n" 358 - "\t\tusb_bus: %i\n" 359 - "\t\tusb_addr: %i\n" 360 - "\t\tserial: '%s'\n" 361 - "\t\tproduct: '%s'\n" 362 - "\t\tmanufacturer: '%s'", 363 - (void *)pdev, ret, sysfs_path, dev_path, vendor_id, 364 - product_id, v4l_index, usb_iface, usb_bus, usb_addr, 365 - serial, product, manufacturer); 349 + P_TRACE(p, 350 + "v4l\n" 351 + "\t\tptr: %p (%i)\n" 352 + "\t\tsysfs_path: '%s'\n" 353 + "\t\tdev_path: '%s'\n" 354 + "\t\tvendor_id: %04x\n" 355 + "\t\tproduct_id: %04x\n" 356 + "\t\tv4l_index: %u\n" 357 + "\t\tusb_iface: %i\n" 358 + "\t\tusb_bus: %i\n" 359 + "\t\tusb_addr: %i\n" 360 + "\t\tserial: '%s'\n" 361 + "\t\tproduct: '%s'\n" 362 + "\t\tmanufacturer: '%s'", 363 + (void *)pdev, ret, sysfs_path, dev_path, vendor_id, 364 + product_id, v4l_index, usb_iface, usb_bus, usb_addr, 365 + serial, product, manufacturer); 366 366 367 367 if (ret != 0) { 368 368 P_ERROR(p, "p_dev_get_usb_device failed!"); ··· 482 482 goto next; 483 483 } 484 484 485 - P_SPEW(p, 486 - "hidraw\n" 487 - "\t\tptr: %p (%i)\n" 488 - "\t\tsysfs_path: '%s'\n" 489 - "\t\tdev_path: '%s'\n" 490 - "\t\tbus_type: %i\n" 491 - "\t\tvendor_id: %04x\n" 492 - "\t\tproduct_id: %04x\n" 493 - "\t\tinterface: %i\n" 494 - "\t\tusb_bus: %i\n" 495 - "\t\tusb_addr: %i\n" 496 - "\t\tbluetooth_id: %012" PRIx64, 497 - (void *)pdev, ret, sysfs_path, dev_path, bus_type, 498 - vendor_id, product_id, interface, usb_bus, usb_addr, 499 - bluetooth_id); 485 + P_TRACE(p, 486 + "hidraw\n" 487 + "\t\tptr: %p (%i)\n" 488 + "\t\tsysfs_path: '%s'\n" 489 + "\t\tdev_path: '%s'\n" 490 + "\t\tbus_type: %i\n" 491 + "\t\tvendor_id: %04x\n" 492 + "\t\tproduct_id: %04x\n" 493 + "\t\tinterface: %i\n" 494 + "\t\tusb_bus: %i\n" 495 + "\t\tusb_addr: %i\n" 496 + "\t\tbluetooth_id: %012" PRIx64, 497 + (void *)pdev, ret, sysfs_path, dev_path, bus_type, 498 + vendor_id, product_id, interface, usb_bus, usb_addr, 499 + bluetooth_id); 500 500 501 501 if (ret != 0) { 502 502 P_ERROR(p, "p_dev_get_usb_device failed!"); ··· 624 624 ok = true; 625 625 } 626 626 } else if (strncmp(line, "HID_NAME=", 9) == 0) { 627 - // printf("\t\tprocuct_name: '%s'\n", line + 9); 627 + // U_LOG_D("\t\tprocuct_name: '%s'", line + 9); 628 628 } else if (strncmp(line, "HID_UNIQ=", 9) == 0) { 629 629 serial_utf8 = &line[9]; 630 - // printf("\t\tserial: '%s'\n", line + 9); 630 + // U_LOG_D("\t\tserial: '%s'", line + 9); 631 631 } 632 632 633 633 line = strtok_r(NULL, "\n", &saveptr); ··· 854 854 static void 855 855 p_udev_dump_device(struct udev_device *udev_dev, const char *name) 856 856 { 857 - // clang-format off 858 - fprintf(stderr, "\t%s\n", name); 859 - fprintf(stderr, "\t\tptr: %p\n", (void*)udev_dev); 857 + U_LOG_I("\t%s", name); 858 + U_LOG_I("\t\tptr: %p", (void *)udev_dev); 860 859 861 860 if (udev_dev == NULL) { 862 861 return; 863 862 } 864 863 865 - fprintf(stderr, "\t\tparent: %p\n", (void*)udev_device_get_parent(udev_dev)); 866 - fprintf(stderr, "\t\tdevpath: %s\n", udev_device_get_devpath(udev_dev)); 867 - fprintf(stderr, "\t\tdevnode: %s\n", udev_device_get_devnode(udev_dev)); 868 - fprintf(stderr, "\t\tdevtype: %s\n", udev_device_get_devtype(udev_dev)); 869 - fprintf(stderr, "\t\tsysname: %s\n", udev_device_get_sysname(udev_dev)); 870 - fprintf(stderr, "\t\tsysnum: %s\n", udev_device_get_sysnum(udev_dev)); 871 - fprintf(stderr, "\t\tsyspath: %s\n", udev_device_get_syspath(udev_dev)); 872 - fprintf(stderr, "\t\tsubsystem: %s\n", udev_device_get_subsystem(udev_dev)); 873 - fprintf(stderr, "\t\tsysfs.product: %s\n", udev_device_get_sysattr_value(udev_dev, "product")); 874 - // clang-format on 864 + U_LOG_I("\t\tparent: %p", (void *)udev_device_get_parent(udev_dev)); 865 + U_LOG_I("\t\tdevpath: %s", udev_device_get_devpath(udev_dev)); 866 + U_LOG_I("\t\tdevnode: %s", udev_device_get_devnode(udev_dev)); 867 + U_LOG_I("\t\tdevtype: %s", udev_device_get_devtype(udev_dev)); 868 + U_LOG_I("\t\tsysname: %s", udev_device_get_sysname(udev_dev)); 869 + U_LOG_I("\t\tsysnum: %s", udev_device_get_sysnum(udev_dev)); 870 + U_LOG_I("\t\tsyspath: %s", udev_device_get_syspath(udev_dev)); 871 + U_LOG_I("\t\tsubsystem: %s", udev_device_get_subsystem(udev_dev)); 872 + U_LOG_I("\t\tsysfs.product: %s", 873 + udev_device_get_sysattr_value(udev_dev, "product")); 875 874 }