@Lord of nothing
I think, this thread is better qualified for your question:
https://www.eevblog.com/forum/testgear/actual-resolution-of-flir-one-v2/
@cynfab
I saw, that you removed the frame buffer part.
As attachment my last "Flir to v4l2loopback" version without a framebuffer.
compile:
$ /usr/bin/gcc '-I/usr/include/libusb-1.0' -o flir flir8f.c -lusb-1.0 -lm
$ sudo ./flir
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
using output device: /dev/video0
vid_format->type =2
vid_format->fmt.pix.width =160
vid_format->fmt.pix.height =120
vid_format->fmt.pix.pixelformat =1497715271
vid_format->fmt.pix.sizeimage =19200
vid_format->fmt.pix.field =1
vid_format->fmt.pix.bytesperline=160
vid_format->fmt.pix.colorspace =8
using output device: /dev/video1
vid_format->type =2
vid_format->fmt.pix.width =640
vid_format->fmt.pix.height =480
vid_format->fmt.pix.pixelformat =1196444237
vid_format->fmt.pix.sizeimage =1228800
vid_format->fmt.pix.field =1
vid_format->fmt.pix.bytesperline=0
vid_format->fmt.pix.colorspace =8
stop interface 2 FRAME
stop interface 1 FILEIO
start interface 1 FILEIO
...
new feature:
- add chunks from EP0x85 to a full frame (thermal+jpg+status)
- calc addresses inside "full frame" with infos from your reversed engineered header
- write
thermal images to /dev/video0 as grayscale video 160x120
- write
visible images to /dev/video1 as mjpeg video 640x480
please note, you must load v4l2loopback with /dev/video0
and /dev/video1
// unload v4l2loopback
$ sudo modprobe -r v4l2loopback
$ ls /dev/video*
ls: cannot access /dev/video*: No such file or directory
$ sudo modprobe v4l2loopback video_nr=0,1
$ ls /dev/video*
/dev/video0 /dev/video1
now you can view thermal and visible video simultaneously (i.e. with your guvcview in two windows)
I haven't changed the initialization sequence for the end points, because it's the same like in the SDK. I think, it's the safest way for future firmwares etc.
Your advice on the correlation between "sum of time outs" and "frame rate" was great

I played around with some time outs and found this as the best solution for my raspberry pi:
r = libusb_bulk_transfer(devh, 0x85, buf, sizeof(buf), &actual_length, 100);
...
r = libusb_bulk_transfer(devh, 0x81, buf, sizeof(buf), &actual_length, 10);
r = libusb_bulk_transfer(devh, 0x83, buf, sizeof(buf), &actual_length, 10);
EP 0x81 and 0x83 are almost empty (time out of 10ms works fine) and EP 0x85 lose regularly some bytes between chunks, if the time out is shorter as 100ms.
For debugging the code prints the status messages from EPx85.
On the basis of usbNotifiedTimestamp we get the frame rate of 9fps.
As sample a part of the terminal log with a FCC (shutter movement).
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.02701,"usbEnqueuedTimestamp":1175531262.02879,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.14032,"usbEnqueuedTimestamp":1175531262.14213,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.25351,"usbEnqueuedTimestamp":1175531262.25556,"ffcState":"FFC_VALID_IMG"}
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.36882,"usbEnqueuedTimestamp":1175531262.37076,"ffcState":"FFC_VALID_IMG"}
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.48126,"usbEnqueuedTimestamp":1175531262.48321,"ffcState":"FFC_VALID_IMG"}
{"shutterState":"ON","shutterTemperature":312.040008544922,"usbNotifiedTimestamp":1175531262.70933,"usbEnqueuedTimestamp":1175531262.7114,"ffcState":"FFC_DESIRED"}
{"shutterState":"ON","shutterTemperature":311.970001220703,"usbNotifiedTimestamp":1175531262.82371,"usbEnqueuedTimestamp":1175531262.8254,"ffcState":"FFC_PROGRESS"}
{"shutterState":"ON","shutterTemperature":311.970001220703,"usbNotifiedTimestamp":1175531262.93882,"usbEnqueuedTimestamp":1175531262.94059,"ffcState":"FFC_PROGRESS"}
{"shutterState":"ON","shutterTemperature":311.970001220703,"usbNotifiedTimestamp":1175531263.05156,"usbEnqueuedTimestamp":1175531263.0532,"ffcState":"FFC_PROGRESS"}
{"shutterState":"FFC","shutterTemperature":311.970001220703,"usbNotifiedTimestamp":1175531263.16526,"usbEnqueuedTimestamp":1175531263.16728,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"FFC","shutterTemperature":311.970001220703,"usbNotifiedTimestamp":1175531263.2799,"usbEnqueuedTimestamp":1175531263.28168,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"FFC","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531263.39377,"usbEnqueuedTimestamp":1175531263.39579,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"FFC","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531263.96461,"usbEnqueuedTimestamp":1175531263.96619,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"FFC","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.07757,"usbEnqueuedTimestamp":1175531264.07966,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"FFC","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.19097,"usbEnqueuedTimestamp":1175531264.19271,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.30465,"usbEnqueuedTimestamp":1175531264.30635,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.41937,"usbEnqueuedTimestamp":1175531264.42115,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.5326,"usbEnqueuedTimestamp":1175531264.53417,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":311.959991455078,"usbNotifiedTimestamp":1175531264.64702,"usbEnqueuedTimestamp":1175531264.64891,"ffcState":"FFC_VALID_RAD"}
Note the difference between shutterState and ffcStat!