- if (wprobe_init() != 0) {
- fprintf(stderr, "wprobe init failed\n");
- return -1;
- }
-
- wprobe_dump_attributes(ifname, false, &global_attr, (char *) link_local);
- wprobe_dump_attributes(ifname, true, &link_attr, NULL);
- if (list_empty(&global_attr) && list_empty(&link_attr)) {
- fprintf(stderr, "Cannot connect to wprobe on interface '%s'\n", ifname);
+ dev = wprobe_get_auto(ifname, &err);
+ if (!dev || (list_empty(&dev->global_attr) && list_empty(&dev->link_attr))) {
+ fprintf(stderr, "Cannot connect to wprobe on interface '%s': %s\n", ifname, (err ? err : "Unknown error"));