- int ret = droid_probe_device(disp, fd, vendor_name);
- switch (ret) {
- case probe_success:
- goto success;
- case probe_filtered_out:
- /* Set as fallback */
- if (fallback_fd == -1)
- fallback_fd = fd;
- break;
- case probe_fail:
+ /* If a vendor is explicitly provided, we use only that.
+ * Otherwise we fall-back the first device that is supported.
+ */
+ if (vendor_name) {
+ if (droid_filter_device(disp, dri2_dpy->fd, vendor_name)) {
+ /* Device does not match - try next device */
+ close(dri2_dpy->fd);
+ dri2_dpy->fd = -1;
+ continue;
+ }
+ /* If the requested device matches - use it. Regardless if
+ * init fails, do not fall-back to any other device.
+ */
+ if (!droid_probe_device(disp)) {
+ close(dri2_dpy->fd);
+ dri2_dpy->fd = -1;
+ }
+