I have a fingerprint sensor I want to capture data with. To capture the data, I am using libusb and a small programm in C. Then, I use JNI to pass the data to java where they will analysed.
My sensor has different modes, when it is waiting for the user to put his finger a red light turns on, if I put my finger it turns off.
The problem is when I didn't put my finger.. I put a timeout in the java code so that the data coming from c are no more considered after the timeout, but the sensor stays red. I would like to turn off this red light.
I made different tries and succeed in creating a method that turn off the red light: If the sensor is red when I start my java app, then it turns off.
However if I try with my app to first turn on the red light, then do not put my finger (timeout) and try to turn off the sensor, I got:

A fatal error has been detected by the Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x65ac1e50, pid=8380, tid=9320
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) Client VM (16.3-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [FPRLib.dll+0x1e50]

I think that the problem comes from the fact that the function started by the C code i still running (waiting for my finger) and prevent me from turning the light off.
I tried to put timeout inside the C code, saying that after some time it should stop capturing and free the usb interface but it still doesn't work.

I wonder if what I want to do is possible? I guess it should be because when the java app stops then I can turn the light off, there should be a way to stop what's going on without stopping java, no?