Comment 66 for bug 790183

Revision history for this message
In , anarsoul (anarsoul) wrote :

(In reply to comment #30)
> Created attachment 83699 [details] [review]
> 0001-lib-Add-VFS5011-driver.patch
>
> Sorry to take so long to resend the patch.
>
> @@ +1000,5 @@
> >> +
> >> + struct fpi_ssm *ssm;
> >> + ssm = fpi_ssm_new(dev->dev, open_loop, DEV_OPEN_NUM_STATES);
> >> + ssm->priv = dev;
> >> + fpi_ssm_start(ssm, open_loop_complete);
> >
> >And no one waits for this ssm (and async USB reqs) to complete here. It's a race >condition I've described earlier. Please move device initialization into >dev_activate().

> The code is required and I can imagine the race condition you mentioned, but
> the fingerprint device won't work if move the code to dev_activate()
> function.

Because you need to wait for completion of these transfers, but probably you don't.

> So, I add a check in dev_activate() function to make sure
> open_loop_complete() have finished to continue.

Please, no workarounds, let's fix an issue instead.

> And you had mentioned that do we need to do reset in dev_open()
> r = libusb_reset_device(dev->udev);
> if (r != 0) {
> fp_err("Failed to reset the device");
> return r;
> }
> I checked if I removed the code, the device doesn't work.

I guess it doesn't work on second time, because there's no proper deinit sequence and device is still in active state.

> I'm learning libfprint by modifying the code, so please give me more
> explicit advise, so that I can know how to fix it.
> Thanks.

Take a look at other drivers, almost all for AuthenTec devices are pretty simple. Try to catch me on IRC (#<email address hidden>) if you have further questions.