Author Topic: Question about FLIR One for Android  (Read 113926 times)

0 Members and 1 Guest are viewing this topic.

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #25 on: November 14, 2015, 12:21:25 am »
I was able to recompile the example app from the sdk

I think you are the only one, who testing the Flir SDK.
Here you can download a working SDK sample with the extracted java.class (see my post above)
 see path FLIROneSDKBundle\FLIRONEExampleApplication\app\src\main\java\com\flir\flironesdk\usb

have fun
http://www.file-upload.net/download-11040066/FLIROneSDKBundle04-Basis.zip.html
« Last Edit: November 14, 2015, 12:38:16 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #26 on: November 18, 2015, 11:39:38 pm »
Attached is a annotated dump of the first few seconds of usb activity between a F1G2 and the F1 Android app.

Hi cynfab,

with knowledge of "FLIROneSDKBundle\FLIRONEExampleApplication\app\src\main\java\com\flir\flironesdk\usb\UsbCommunicator.java" I'm played around with your nice usb dump file F6c.txt and found some interesting strings in your hex bytes:
Code: [Select]
>awk "{for(i=1; i <=NF; i=i+1) {tmp=sprintf (\"%s \",\"0x\"$(i)); printf \"%c\", strtonum(tmp) }}" F6c.txt > strings.txt

>strings -n 7 strings.txt
Sysinternals - [url=http://www.sysinternals.com]www.sysinternals.com[/url]

FLIR ONE Camera
FLIR Systems
FLIRONEF0XXX200
SBIBDP Configuration
iAP Interface
com.flir.rosebud.fileio
com.flir.rosebud.frame
{"type":"sledInformation","data":{"serialNumberBoard":"F03XXX00571","partNumberBoard":"21200160201","versionBoard":"C","serialNumberLepton":"355692","versionLepton":"3.1.45","leptonQR":"A0355692","versionRosebudFactoryESW":"0.4.25","versionRosebudOperationalESW":"0.4.26","versionRosebudUpdaterESW":"0.4.26","versionRosebudAPI":"master.26498f5","gitRevision":"master.26498f5","automaticShutter":"Y","formFactor":"dongle","thermalHeight":"120","thermalWidth":"160","bigEndianThermal":"0","operatinwp
gMode":"operational"}}
{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
{"type":"readFile","data":{"streamIdentifier":10}}
/CameraFiles/system/calib.rsc
/CameraFiles/system/maps/ds_we_ap_fi_le_LCFMap.fff
/CameraFiles/system/maps/ds_we_ap_fi_leExFOL2_LCFMap.fff
/CameraFiles/system/calib.rscPK
/CameraFiles/system/maps/ds_we_ap_fi_le_LCFMap.fffPK
/CameraFiles/system/maps/ds_we_ap_fi_leExFOL2_LCFMap.fffPK
{"type":"readFile","data":{"streamIdentifier":10}}
{"type":"setOption","data":{"option":"autoFFC","value":true}}
{"type":"setOptionStatus","data":{"option":"autoFFC","value":-1}}

Unfortunately your dump stops from that moment where the interesting parts begins:
The see some configurations of the F1 device (configWriteEndpoint) and the begin of the streaming of frames (frameReadRequest) it has not started yet :(

Code: [Select]

FLIROneSDKBundle\FLIRONEExampleApplication\app\src\main\java\com\flir\flironesdk\usb\UsbCommunicator.java
...
            for ( int e = 0 ; e < endpointCount; e++)
            {
                UsbEndpoint ep = iface.getEndpoint(e);
                if (ep.getDirection() == 128) {          // read
                    switch (ep.getEndpointNumber())
                    {
                        case 5:               // FRAME_READ_ENDPOINT_ID
                            this.frameReadRequest .initialize(this. connection, ep);
                            break;
                        case 1:
                            this.configReadRequest .initialize(this. connection, ep);
                            break;
                        case 3:
                            this.fileioReadRequest .initialize(this. connection, ep);   // final UsbRequest fileioReadRequest = new UsbRequest();
                            break;
                        case 2:
                        case 4:
                        default:
                            Log. w("UsbCommunicator", "Unknown USB_DIR_IN Endpoint on device!");break;
                    }
                } else {                                  // write
                    switch (ep.getEndpointNumber())       
                    {
                        case 2:
                            this.configWriteEndpoint = ep;
                            break;
                        case 4:
                            this.fileioWriteEndpoint = ep;
                            break;
                        default:
                            Log. w("UsbCommunicator", "Unknown USB_DIR_OUT Endpoint on device!");
                    }
                }



Furthermore I have only bad USB programmer skills.

I can't find this known Read/Write Endpoint Addresses in your dump:
edit: found it
Code: [Select]
Call to address 78 endpoint 1:
[        ]   3.233349 d=  0.000001 [191.7 + 12.633] [  3] IN   : 78.1 

list of Endpoint Addresses
Code: [Select]
# lsusb -v -d 09cb:1996 | grep bEndpointAddress
      iInterface              5 iAP Interface
        bEndpointAddress     0x81  EP 1 IN
        bEndpointAddress     0x02  EP 2 OUT

      iInterface              6 com.flir.rosebud.fileio
        bEndpointAddress     0x83  EP 3 IN
        bEndpointAddress     0x04  EP 4 OUT

      iInterface              7 com.flir.rosebud.frame
        bEndpointAddress     0x85  EP 5 IN
        bEndpointAddress     0x06  EP 6 OUT

compared lsusb with UsbCommunicator.java I understand the relations between EndpointNumbers and InterfaceNumbers:
Code: [Select]
    static final int CONFIG_READ_ENDPOINT_ID = 1 ;
    static final int CONFIG_WRITE_ENDPOINT_ID = 2 ;
    static final int FILEIO_READ_ENDPOINT_ID = 3 ;
    static final int FILEIO_WRITE_ENDPOINT_ID = 4 ;
    static final int FRAME_READ_ENDPOINT_ID = 5 ;

Can you please give us some more output from your nice protocoll sniffer to see the full handshake until the stream begin? FRAME_READ_ENDPOINT_ID = 5 ;)
You debug snippet only grep EndPoint 1,2 (configuration) and 3 (file transfer of CameraFiles.zip, see magic bytes "PK"):
Code: [Select]
>grep ": 78\." F6c.txt
IN   : 78.0
IN   : 78.1
OUT  : 78.2
IN   : 78.3
« Last Edit: November 19, 2015, 02:27:38 am by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #27 on: November 19, 2015, 02:19:18 am »
thomas123,

Sorry I haven't kept you up to date on my disassembly of the usb stream. It is sort of on the back burner while I'm fiddling with the SDK.
Reading the SDK decompiled code is very interesting too, and I hope to tie it and the usb dump together someday.
But until then, here is a somewhat more annotated version of the dump.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #28 on: November 19, 2015, 09:17:41 am »
great, a complete handshake until transfer of first raw image

Code: [Select]
$ gawk  -bniord  '{for(i=1; i <=NF; i=i+1) {tmp=sprintf ("%s ","0x"$(i)); printf "%c", strtonum(tmp)}}' F6d.txt | strings -n 7

{"type":"sledInformation","data":{"serialNumberBoard":"F03xxx00571","partNumberBoard":"21200160201","versionBoard":"C","serialNumberLepton":"355692","versionLepton":"3.1.45","leptonQR":"A0355692","versionRosebudFactoryESW":"0.4.25","versionRosebudOperationalESW":"0.4.26","versionRosebudUpdaterESW":"0.4.26","versionRosebudAPI":"master.26498f5","gitRevision":"master.26498f5","automaticShutter":"Y","formFactor":"dongle","thermalHeight":"120","thermalWidth":"160","bigEndianThermal":"0","operatinwp
gMode":"operational"}}
{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
{"type":"readFile","data":{"streamIdentifier":10}}
// comment: strings inside CameraFiles.zip:
     /CameraFiles/system/calib.rsc
     /CameraFiles/system/maps/ds_we_ap_fi_le_LCFMap.fff
     /CameraFiles/system/maps/ds_we_ap_fi_leExFOL2_LCFMap.fff
     /CameraFiles/system/calib.rscPK
     /CameraFiles/system/maps/ds_we_ap_fi_le_LCFMap.fffPK
     /CameraFiles/system/maps/ds_we_ap_fi_leExFOL2_LCFMap.fffPK
{"type":"readFile","data":{"streamIdentifier":10}}
{"type":"setOption","data":{"option":"autoFFC","value":true}}
{"type":"setOptionStatus","data":{"option":"autoFFC","value":-1}}
{"type":"setOption","data":{"option":"autoFFC","value":true}}
{"type":"setOptionStatus","data":{"option":"autoFFC","value":true}}

now comes the first raw frame on endpoint 5
Code: [Select]
[        ]  21.637696 d=  0.000001 [ 12.5 +  2.967] [  3] IN   : 89.5
[        ]  21.637697 d=  0.000000 [ 12.5 +  3.467] [515] DATA0: ef be 00 00 01 00 00 00 19 25 02 00 ac 9b 00 00 c8 88 01 00 a5 00 00 00 16 bb 99 10 00 50 7e 7c 9f 09 98 09 b7 09 c8 09 c6 09 c5 09 d4 09 d6 09 de 09 ee 09 ee 09 ff 09 02 0a 09 0a 1b 0a 0a 0a 1f 0a 29 0a 22 0a 29 0a 29 0a 33 0a 2b 0a 39 0a 2f 0a 40 0a 37 0a 40 0a 53 0a 48 0a 47 0a 49 0a 57 0a 53 0a 55 0a 5c 0a 57 0a 5c 0a 5e 0a 6e 0a 6a 0a 6d 0a 67 0a 71 0a 73 0a 67 0a 6f 0a 6d 0a 76 0a 72 0a 6c 0a 77 0a 76 0a 7c 0a 77 0a 77 0a 7a 0a 76 0a 77 0a 7e 0a 82 0a 7e 0a 8d 0a 88 0a 8d 0a 8e 0a 85 0a 7c 0a 8f 0a 8f 0a 8b 0a 82 0a 85 0a 8c 0a 8d 0a 93 0a 8c 0a 7c 0a 8e 0a 91 0a 01 00 a6 66 94 0a 8b 0a 8e 0a 95 0a 8c 0a 93 0a 8b 0a 9a 0a 91 0a 8c 0a 89 0a 8f 0a 8b 0a 8e 0a 99 0a 8b 0a 8b 0a 8a 0a 84 0a 90 0a 82 0a 8b 0a 82 0a 83 0a 83 0a 81 0a 85 0a 75 0a 80 0a 76 0a 73 0a 83 0a 74 0a 81 0a 7d 0a 72 0a 6a 0a 65 0a 75 0a 6c 0a 63 0a 71 0a 67 0a 61 0a 65 0a 5f 0a 61 0a 60 0a 5d 0a 55 0a 55 0a 56 0a 48 0a 46 0a 3f 0a 36 0a 41 0a 42 0a 27 0a 2d 0a 22 0a 2c 0a 31 0a 25 0a 1c 0a 27 0a 18 0a 1c 0a 1a 0a 17 0a 14 0a 06 0a fc 09 f8 09 0b 0a f2 09 eb 09 e7 09 dc 09 d6 09 02 00 f8 6c b2 09 c1 09 cc 09 d0 09 cd 09 da 09 e3 09 f2 09 f1 09 03 0a 04 0a 0b 0a 09 0a 17 0a 23 0a 1a 0a 30 0a 38 0a 37 0a 38 0a 35 0a 43 0a 39 0a 43 0a 41 0a 4b 0a 4c 0a 46 0a 50 0a 4c 0a 56 0a 57 0a 59 0a 6c 0a 6f 0a 5d 0a 6b 0a 66 0a 6a 0a 71 0a 71 0a 77 0a 7d 0a 7f 0a 77 0a 7b 0a 7b 0a 79 0a 82 0a 86 0a 80 0a 7a 0a 7d 0a 88 0a 7e 0a 7f 0a 84 0a 86 0a 89 0a 84 0a 8c 0a 87 0a 87 0a 96 0a 96 0a 95 0a 8c 0a 99 0a 8a 0a 9b 0a 8f 0a 8c 0a 96 0a 92 0a 88 0a 9f 0a 8e a2

515 Bytes are short, but it looks that the lines are 164 (160+4) Byte long, as described here (after a header ef be 00 00 01 00 00 00... ):

« Last Edit: November 19, 2015, 09:54:33 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #29 on: November 19, 2015, 09:10:34 pm »
a note about the crop factor

the start process of "regular" Flir One App  (from play store):
(1) copy the simulator config file CameraFiles.zip to folder \Android\data\com.flir.flirone\files\
(2) decompress it to folder \Android\data\com.flir.flirone\files\CameraFiles
(3) try to open the USB Flir One
(4) copy from Flir One Device his CameraFiles.zip to  \Android\data\com.flir.flirone\files\
(5) decompress it to folder \Android\data\com.flir.flirone\files\CameraFiles

With step (5) the simulator config file .\CameraFiles\system\calib.rsc with "uncropped full resolution" is changed with calib.rsc from Flir One with magnQuote>1.
The crop factor switch in calib.rsc of simulator device:
Code: [Select]
     .calib.visual.fusion.leExFOL2.magnQuote double 0
     .calib.visual.fusion.leExFOL2.magnQuoteComp double 0

The crop factor switch in calib.rsc of real Flir One device:
Code: [Select]
     .calib.visual.fusion.leExFOL2.magnQuote double 1.2312108
     .calib.visual.fusion.leExFOL2.magnQuoteComp double 0

 160/1.2312108=130,0  >:D


« Last Edit: November 19, 2015, 10:43:52 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #30 on: November 20, 2015, 07:29:31 am »
It is sort of on the back burner while I'm fiddling with the SDK.

the simplest way to defeat the crop factor is comment out the line 213 in
flironesdk/Device.java
Code: [Select]
     //FrameProcessor.updateCameraFiles(zis, cachedContext.getFilesDir().getAbsolutePath() + File.separator);
now the sdk used the CameraFiles (extracted default_camera_files.zip) from simulator with magnQuote=0  ;)

The next step is to edit the calib.rsc in the CameraFiles.zip from your real FlirOne and replace it in the SDK file system with default_camera_files.zip.
Code: [Select]
./app/src/main/res/raw/default_camera_files.zip
Don't forget to edit the crc32 (see E4 thread)



As I wrote here
http://www.eevblog.com/forum/testgear/question-about-flir-one-for-android/msg803459/#msg803459
the Flir One App from play store stored your CameraFiles.zip in the public path Environment.getDataDirectory()
Code: [Select]
\Android\data\com.flir.flirone\files\CameraFilesHere you can grep the file >:D

Unfortunately the SDK stores the file to getFilesDir()
Code: [Select]
/data/data/com.flir.flironeexampleapplication/files/CameraFilesYou need a rootet device to read this path

see
http://stackoverflow.com/questions/21230629/getfilesdir-vs-environment-getdatadirectory
Quote
If you want to get your application path use getFilesDir() which will give you path /data/data/your package/files

You can get the path using the Environment var of your data/package using the getExternalFilesDir(Environment.getDataDirectory().getAbsolutePath()).getAbsolutePath();
which will return the path from the root directory of your external storage as
/storage/sdcard/Android/data/your pacakge/files/data
« Last Edit: November 20, 2015, 08:07:02 am by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #31 on: November 20, 2015, 08:57:02 am »
But you could also change the storage path code in FrameProcessor.java

Code: [Select]
    private FrameProcessor(Context context)
    {
        this.emissivity = EMISSIVITY_SKIN;  // was DEFAULT ie.0.95F km

        String storagePath = context.getFilesDir().getAbsolutePath() + File.separator;
        cameraFilesPath = storagePath + "CameraFiles";
        Boolean cameraFilesExists = Boolean.valueOf(new File(cameraFilesPath).exists());

        InputStream defaultCameraFilesInput = context.getApplicationContext().getResources().openRawResource(R.raw.default_camera_files);

        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(defaultCameraFilesInput));
        updateCameraFiles(zis, storagePath);

        setupAppCore(cameraFilesPath);
    }

So that it wasn't stored in a root protected path.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #32 on: November 20, 2015, 11:42:36 am »
of course  :)

a note:
the crop factor inside calib.rsc is not the suspected ".calib.visual.fusion.leExFOL2.magnQuote double 1.2312108"   :(

you find it in calib.rsc around the maps files entries
Code: [Select]
.calib.lensCorr entry
.calib.lensCorr.ds_we_ap_fi_le index
.calib.lensCorr.ds_we_ap_fi_le.enabled bool true
.calib.lensCorr.ds_we_ap_fi_le.fileName text "ds_we_ap_fi_le_LCFMap.fff"
.calib.lensCorr.ds_we_ap_fi_le.rotation double 0.32686445
.calib.lensCorr.ds_we_ap_fi_le.type int32 100
.calib.lensCorr.ds_we_ap_fi_le.zoom double 7.7799269
.calib.lensCorr.ds_we_ap_fi_leExFOL2 index
.calib.lensCorr.ds_we_ap_fi_leExFOL2.enabled bool true
.calib.lensCorr.ds_we_ap_fi_leExFOL2.fileName text "ds_we_ap_fi_leExFOL2_LCFMap.fff"
.calib.lensCorr.ds_we_ap_fi_leExFOL2.rotation double 0.32686445
.calib.lensCorr.ds_we_ap_fi_leExFOL2.type int32 100
.calib.lensCorr.ds_we_ap_fi_leExFOL2.zoom double 7.7799269
if I remove this block, then I have uncropped Lepton images with calibrated temperature measurements.
This is not the best solution. I'm unsure about the content of the both mapping files *.fff

After editing the calib.rsc you must calculate a new crc32.
I use this fast method:
Code: [Select]
// count (n) lines
$ wc -l calib.rsc
     646 calib.rsc

//print last line
$ tail -n1 calib.rsc
# CRC32 4683a151

//calc a new crc32 for (n-1) lines
$ crc32 <(head -n 645 calib.rsc)
4683a151

// edit last line
first test it on a unpatched sample and compare last line with output of crc32

After editing the calib.rsc inside
Code: [Select]
./app/src/main/res/raw/default_camera_files.zipwith my patched calib.rsc from my Flir One the SDK.app works fine.
Now I'm looking for an switch to suppress the magic pattern noise.
« Last Edit: November 20, 2015, 12:08:26 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #33 on: November 20, 2015, 12:03:37 pm »
another idea hasen't work:

you can multiple ImageTypes request in same time

sample:
Code: [Select]
frameProcessor.setImageTypes(EnumSet.of(RenderedImage.ImageType.BlendedMSXRGBA8888Image, RenderedImage.ImageType.ThermalLinearFlux14BitImage));
from help
Quote
Called when a frame has been received and processed. Note: if you have requested N formats, this method will be called N times per Frame passed to the FrameProcessor instance. If your goal is to record a video from a sequence of frames, use android.media.MediaCodec and call mediaCodec.queueInputBuffer from this method with the frame's pixelData byte array put in the input ByteBuffer of the mediaCodec


I thought, if this.pixeldata from format ThermalLinearFlux14BitImage, then it's simple to copy it to this.rawFrame before I take a photo.

FLIROneSDKBundle/FLIRONEExampleApplication/app/src/main/java/com/flir/flironesdk/RenderedImage.java
Code: [Select]
    private RenderedImage(int width, int height, byte[] pixelData, byte frameTypeValue, float emissivity, int paletteOrdinal, Frame originalFrame)
    {
        this.width = width;
        this.height = height;
        this.pixelData = pixelData;
        this.imageType = ImageType.get(frameTypeValue);
        this.emissivity = emissivity;
        if ((paletteOrdinal >= 0) && (paletteOrdinal < Palette.values().length)) {
            this.palette = Palette.values()[paletteOrdinal];
        } else {
            this.palette = null;
        }
        this.rawFrame = originalFrame;
    }
But I haven't found a way to write to "private" array this.rawFrame.

 :(
« Last Edit: November 20, 2015, 12:10:35 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #34 on: November 20, 2015, 12:05:33 pm »
Another quick n' dirty solution works fine:

Save the ThermalLinearFlux14BitImage RAW image:

FLIRONEExampleApplication/app/src/main/java/com/flir/flironeexampleapplication/PreviewActivity.java
Code: [Select]

// for raw images
import java.io.FileOutputStream;

   public void onFrameProcessed(final RenderedImage renderedImage){
        thermalBitmap = renderedImage.getBitmap();
        updateThermalImageView(thermalBitmap);


        /*
        Capture this image if requested.
        */
        if (this.imageCaptureRequested) {
            imageCaptureRequested = false;
            final Context context = this;
            new Thread(new Runnable() {
                public void run() {
                    String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString();
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ssZ", Locale.getDefault());
                    String formatedDate = sdf.format(new Date());
                    String fileName = "FLIROne-" + formatedDate + ".jpg";
                    try{
                        lastSavedPath = path+ "/" + fileName;
                        renderedImage.getFrame().save(new File(lastSavedPath), RenderedImage.Palette.Iron, RenderedImage.ImageType.BlendedMSXRGBA8888Image);

                        MediaScannerConnection.scanFile(context,
                                new String[]{path + "/" + fileName}, null,
                                new MediaScannerConnection.OnScanCompletedListener() {
                                    @Override
                                    public void onScanCompleted(String path, Uri uri) {
                                        Log.i("ExternalStorage", "Scanned " + path + ":");
                                        Log.i("ExternalStorage", "-> uri=" + uri);
                                    }

                                });
                        if (renderedImage.imageType() == RenderedImage.ImageType.ThermalLinearFlux14BitImage){
                            // save the Lepton RAW file
                            String rawName = "FLIROne-" + formatedDate + ".raw";
                            lastSavedPath = path+ "/" + rawName;
                            File file = new File(lastSavedPath);
                            FileOutputStream fop = null;
                            fop = new FileOutputStream(file);
                            if (!file.exists()) {
                                file.createNewFile();
                            }
                            //int rawLength = renderedImage.pixelData().length;
                            byte[] LeptonRAWBytes = renderedImage.pixelData();
                            fop.write(LeptonRAWBytes);
                            fop.flush();
                            fop.close();
                        }

                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {

                            thermalImageView.animate().setDuration(50).scaleY(0).withEndAction((new Runnable() {
                                public void run() {
                                    thermalImageView.animate().setDuration(50).scaleY(1);
                                }
                            }));
                        }
                    });
                }
            }).start();
        }
...


If the image type is set to "ThermalLinearFlux14BitImage" then it save also the raw frame 160x120 to disk.

So I got the nice gallery photo from F1G2:
I wrote here something about the new Flir One G2 with Lepton 160x120.
http://www.eevblog.com/forum/testgear/flir-one-thermal-imaging-camera-teardown-and-hacks/msg801504/#msg801504

I shot comparison photos with Flir One G1, Flir One G2 , Flir E4 and Flir E40 from a motherboard.
The temperature scale is auto-level, but Flir tools use a different "gamma correction" for the color scale of E40.

Flir One G1 Lepton 80x60


Flir One G2 Lepton 160x120 Mode: ThermalLinearFlux14BitImage



Flir Ex 320x240



Flir Exx 320x240

« Last Edit: December 13, 2015, 10:35:24 pm by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #35 on: November 20, 2015, 12:21:52 pm »
I've been able to use the multiple image format FrameProcess request and indeed the onFrameProcessed delegate is call for each type, BUT there is no way for the delegate to determine what type of image it is UNLESS you modify Renderimage.java to make ImageType public

    public ImageType imageType; 

I have an app that displays the 14bit thermal greyscale image and the visual image simultaneously in separate ImageViews side by side.
It is very fast since there is no paletteization

Code: [Select]
    // Frame Processor Delegate method, will be called each time a rendered frame is produced
    public void onFrameProcessed(final RenderedImage renderedImage){

        if (renderedImage.imageType == RenderedImage.ImageType.VisualJPEGImage) {
            visualBitmap = renderedImage.getBitmap();
            updateVisualImageView(visualBitmap);
            Log.i("app", "Visual Image");
        }

        if (renderedImage.imageType == RenderedImage.ImageType.ThermalLinearFlux14BitImage) {    // seems ot come here for thermal image as well
            thermalBitmap = renderedImage.getBitmap();
            updateThermalImageView(thermalBitmap);
            Log.i("app","Thermal Image");
        }


    }
« Last Edit: November 20, 2015, 12:23:23 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #36 on: November 21, 2015, 03:44:21 am »
BUT there is no way for the delegate to determine what type of image it is UNLESS you modify Renderimage.java to make ImageType public

    public ImageType imageType; 

see my sample code above for saving the ThermalLinearFlux14BitImage to disk ;)

in flironesdk\RenderedImage.java you find:
Code: [Select]
public ImageType imageType()
    {
        return this.imageType;
    }

public byte[] pixelData()
    {
        return this.pixelData;
    }


so you must use brackets:
Code: [Select]
if (renderedImage.imageType() == RenderedImage.ImageType.ThermalLinearFlux14BitImage){
...
                            fop = new FileOutputStream(file);
                            byte[] LeptonRAWBytes = renderedImage.pixelData();
                            fop.write(LeptonRAWBytes);

« Last Edit: November 21, 2015, 04:09:44 am by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #37 on: November 21, 2015, 04:53:53 am »
Of course...
This just shows again my lack of programming skills  :P
Thanks for the tip, the app runs just fine.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #38 on: November 21, 2015, 05:31:36 am »
My programming skills are scary  :-[ (this are my first steps with java).

I haven't found yet a good code template (for linux shell) to grab the frames over usb.

the usb protocol of F1 is similar to the seek


sample 1


It seems extremely simple:
1. Write control transfer on EP0: 0xC0 7E 00 00 (probably does shutter calibration)
2. Read entire frame from EP1. Repeat for a few seconds then recal
 

but the sample code from user sgstair is for windows
I've built some PC side library code to do really basic frame acquisition and calibration based on the data from marshallh's captures, feel free to try it:
https://github.com/sgstair/winusbdotnet

It's winusb based, you should use Zadig to install the winusb driver on the "iAP interface" device that enumerates.

It's not perfect or polished but it does work, I'll probably continue to improve it as I have time.


sample 2
another seek source is here (my hit for linux):
https://github.com/zougloub/libseek

compare the lsusb with the FlirOne (also a iAP Interface and one additional endpoint for frame transfer)
Code: [Select]
  iManufacturer           1 Seek Thermal
  iProduct                2 PIR206 Thermal Camera

      iInterface              3 iAP Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0




      iInterface              4 com.thermal.pir206.1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0


you dual screen is a nice idea  :-+
please post your code for testing
« Last Edit: November 21, 2015, 05:42:57 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #39 on: November 23, 2015, 09:02:46 am »
Hi cynfab,

with your usb debug file I was able to set a basic configuration and get some telegrams with Ubuntu (modified code from https://github.com/zougloub/libseek )

Code: [Select]

{"type":"sledInformation","data":{"serialNumberBoard":"xxxxxxxxx","partNumberBoard":"xxxxxxxxx","versionBoard":"D","serialNumberLepton":"xxxxxxx","versionLepton":"3.1.46","leptonQR":"xxxxxx","versionRosebudFactoryESW":"0.4.27","versionRosebudOperationalESW":"0.4.27","versionRosebudUpdaterESW":"0.4.27","versionRosebudAPI":"master.015ede4","gitRevision":"master.015ede4","automaticShutter":"Y","formFactor":"dongle","thermalHeight":"120","thermalWidth":"160","bigEndianThermal":"0","operatingMode":"operational"}}

{"type":"batteryVoltageUpdate","data":{"voltage":3.95000004768372,"percentage":76}}

// after power cable plugin
{"type":"batteryChargingCurrentUpdate","data":{"chargingCurrent":500}}
{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateManagedBatteryCharging"}} 


but I can't get a frame with an image.

I'm not sure, if we are missing a command on libusb_control_transfer() to start the frame transfer on endpoint 5.
There is a gab of 17 seconds in your log.
Code: [Select]
[        ]   3.233354 d=  0.000000 [191.7 + 17.317] [  1] NAK

  Here is another capture that starts with the above command & data (different) see below
[        ]  20.832611 d=  0.000001 [231.4 +107.300] [  3] IN   : 89.3
 

Next, I will debug the usb traffic with Android Studio.
« Last Edit: November 23, 2015, 09:09:52 am by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #40 on: November 23, 2015, 12:12:44 pm »
In general the gaps in my log are due to the large number of nak's in between the two ends.
I may have screwed one up.
There is a lot going on in the Flir portocol, I think it is more complex than the Seek, as I was able to get the Seek streaming fairly easily.

I'm still fiddling with my dual view app, but will post the source as soon as I get it looking good enough for my intended use >:D
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #41 on: November 23, 2015, 08:16:18 pm »
There is a lot going on in the Flir portocol, I think it is more complex than the Seek, as I was able to get the Seek streaming fairly easily.

Do you have a lightwave source code in c for usb communication?
I use the code from https://github.com/zougloub/libseek, but the c++ code it's more complex as I need for this purpose.

Offline frenky

  • Supporter
  • ****
  • Posts: 875
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #42 on: November 23, 2015, 10:21:27 pm »
Many of the custom apps for Seek also have support for linux: https://github.com/lod/seek-thermal-documentation/wiki/Clients

It might help someone on making a Flir One linux app.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #43 on: November 23, 2015, 11:13:41 pm »
great link, thank you

and there is the requested code "Seek by Cynfab"  ;)


@cynfab
after hours by reading your usb recording ...
and 15 minutes with android studio and debugging over WiFi I got all necessary informations  :-+


// complete handshake of packets which sends the SDK App to FlirOne (write)
Code: [Select]
controlTransfer
protocolType = {UsbCommunicator$ProtocolType@20946} "FRAME"
startCommunication = false

controlTransfer
protocolType = {UsbCommunicator$ProtocolType@20970} "FILEIO"
startCommunication = false

controlTransfer
protocolType = {UsbCommunicator$ProtocolType@20970} "FILEIO"
startCommunication = true

bulkTransfer
protocolType = {UsbCommunicator$ProtocolType@20993} "CONFIGURATION"
data = {byte[16]@20992}
0 = -52 (0xCC)
1 = 1 (0x1)
2 = 0 (0x0)
3 = 0 (0x0)
4 = 1 (0x1)
5 = 0 (0x0)
6 = 0 (0x0)
7 = 0 (0x0)
8 = 65 (0x41)
9 = 0 (0x0)
10 = 0 (0x0)
11 = 0 (0x0)
12 = -8 (0xF8)
13 = -77 (0xB3)
14 = -9 (0xF7)
15 = 0 (0x0)

bulkTransfer
protocolType = {UsbCommunicator$ProtocolType@20992} "CONFIGURATION"
data = {byte[65]@21002}
{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}

bulkTransfer
protocolType = {UsbCommunicator$ProtocolType@20993} "CONFIGURATION"
data = {byte[16]@21044}
0 = -52 (0xCC)
1 = 1 (0x1)
2 = 0 (0x0)
3 = 0 (0x0)
4 = 1 (0x1)
5 = 0 (0x0)
6 = 0 (0x0)
7 = 0 (0x0)
8 = 51 (0x33)
9 = 0 (0x0)
10 = 0 (0x0)
11 = 0 (0x0)
12 = -17 (0xEF)
13 = -37 (0xDB)
14 = -63 (0xC1)
15 = -63 (0xC1)

bulkTransfer
protocolType = {UsbCommunicator$ProtocolType@20993} "CONFIGURATION"
data = {byte[51]@21053}
{"type":"readFile","data":{"streamIdentifier":10}}

controlTransfer
protocolType = {UsbCommunicator$ProtocolType@20946} "FRAME"
startCommunication = true
after this  control transfer we get the frames over EP 5

-------

Control Transfer

source code:

    private static final int SET_INTERFACE = 11;
    static final int CONFIG_READ_ENDPOINT_ID = 1;
    static final int CONFIG_WRITE_ENDPOINT_ID = 2;   // CONFIGURATION
    static final int FILEIO_READ_ENDPOINT_ID = 3;
    static final int FILEIO_WRITE_ENDPOINT_ID = 4;  // only for firmware update
    static final int FRAME_READ_ENDPOINT_ID = 5;

controlTransfer EP0:
    int altSetting = startCommunication ? 1 : 0;
    FILEIO: interfaceNumber = 1;
    FRAME: interfaceNumber = 2;
    int result = this.connection.controlTransfer(1, 0x0B, altSetting, interfaceNumber, null, 0, 200);

you F6d.txt
[        ]   3.221377 d=  0.000000 [179.7 + 40.967] [ 11] DATA0: 01 0b 01 00 02 00 00 00 c4 91
Call to address 78 endpoint 0 Set Interface
Offset Field Value
0 bmRequestType = 01
1 bRequest = 0b
2 wValue 0001 type (H) index (L)
4 wIndex 02
5 wLength 00
6 Data 0000
« Last Edit: November 24, 2015, 03:58:21 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #44 on: November 25, 2015, 10:30:39 am »
Hi cynfab,

to push this thread I used your python code for seek
http://www.eevblog.com/forum/testgear/yet-another-cheap-thermal-imager-incoming/msg544080/#msg544080
and implemented my knowledge about FlirOne as described above.

Until yet I cannot make a correct bulk write. >:(

But with this code from attachment I get some nice status messages:
Code: [Select]
$ sudo python flir.py
send bytes:16
send bytes:65
array('B', [204, 1, 0, 0, 1, 0, 0, 0, 93, 0, 0, 0, 223, 91, 56, 26])
?]?[8
0x83 usb.core.USBError: [Errno 110] Operation timed out
array('B', [123, 34, 116, 121, 112, 101, 34, 58, 34, 111, 112, 101, 110, 70, 105, 108, 101, 83, 116, 97, 116, 117, 115, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 112, 97, 116, 104, 34, 58, 34, 67, 97, 109, 101, 114, 97, 70, 105, 108, 101, 115, 46, 122, 105, 112, 34, 44, 34, 115, 116, 114, 101, 97, 109, 73, 100, 101, 110, 116, 105, 102, 105, 101, 114, 34, 58, 49, 49, 44, 34, 109, 111, 100, 101, 34, 58, 34, 114, 34, 125, 125, 0])
{"type":"openFileStatus","data":{"path":"CameraFiles.zip","streamIdentifier":11,"mode":"r"}}
0x83 usb.core.USBError: [Errno 110] Operation timed out
array('B', [204, 1, 0, 0, 1, 0, 0,
....
1, 110, 97, 108, 34, 125, 125, 0])
?w`
   ?{"type":"sledInformation","data":{"serialNumberBoard":FFFFFFFFFF","partNumberBoard":"21xxxxxx01","versionBoard":"D","serialNumberLepton":"37xxxx1","versionLepton":"3.1.46","leptonQR":"A0xxxx1","versionRosebudFactoryESW":"0.4.27","versionRosebudOperationalESW":"0.4.27","versionRosebudUpdaterESW":"0.4.27","versionRosebudAPI":"master.015ede4","gitRevision":"master.015ede4","automaticShutter":"Y","formFactor":"dongle","thermalHeight":"120","thermalWidth":"160","bigEndianThermal":"0","operatingMode":"operational"}}
0x83 usb.core.USBError: [Errno 110] Operation timed out
0x81 usb.core.USBError: [Errno 110] Operation timed out
0x83 usb.core.USBError: [Errno 110] Operation timed out
array('B', [204, 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 85, 20, 48, 103, 123, 34, 116, 121, 112, 101, 34, 58, 34, 98, 97, 116, 116, 101, 114, 121, 86, 111, 108, 116, 97, 103, 101, 85, 112, 100, 97, 116, 101, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 118, 111, 108, 116, 97, 103, 101, 34, 58, 51, 46, 56, 48, 57, 57, 57, 57, 57, 52, 50, 55, 55, 57, 53, 52, 44, 34, 112, 101, 114, 99, 101, 110, 116, 97, 103, 101, 34, 58, 53, 51, 125, 125, 0])
?TU0g{"type":"batteryVoltageUpdate","data":{"voltage":3.80999994277954,"percentage":53}}
0x83 usb.core.USBError: [Errno 110] Operation timed out
array('B', [204, 1, 0, 0, 1, 0, 0, 0, 69, 0, 0, 0, 175, 36, 149, 143, 123, 34, 116, 121, 112, 101, 34, 58, 34, 98, 97, 116, 116, 101, 114, 121, 67, 104, 97, 114, 103, 105, 110, 103, 67, 117, 114, 114, 101, 110, 116, 85, 112, 100, 97, 116, 101, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 99, 104, 97, 114, 103, 105, 110, 103, 67, 117, 114, 114, 101, 110, 116, 34, 58, 48, 125, 125, 0, 204, 1, 0, 0, 1, 0, 0, 0, 81, 0, 0, 0, 103, 228, 238, 80, 123, 34, 116, 121, 112, 101, 34, 58, 34, 98, 97, 116, 116, 101, 114, 121, 67, 104, 97, 114, 103, 105, 110, 103, 83, 116, 97, 116, 101, 85, 112, 100, 97, 116, 101, 34, 44, 34, 100, 97, 116, 97, 34, 58, 123, 34, 99, 104, 97, 114, 103, 105, 110, 103, 83, 116, 97, 116, 101, 34, 58, 34, 115, 116, 97, 116, 101, 78, 111, 67, 104, 97, 114, 103, 105, 110, 103, 34, 125, 125, 0])
?E?$??{"type":"batteryChargingCurrentUpdate","data":{"chargingCurrent":0}}?Qg??P{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateNoCharging"}}
0x83 usb.core.USBError: [Errno 110] Operation timed out
« Last Edit: November 25, 2015, 06:27:59 pm by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #45 on: November 25, 2015, 12:37:18 pm »
thomas123,

That's great progress, I'm still dealing with other things and can't fiddle with FlirOne for linux/otherOS stuff for a while.

I'm making progress on my dual view app for android and am almost done enough to post the code. maybe by the week end.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #46 on: December 09, 2015, 09:13:40 am »
Hi cynfab,

After two weeks hacking the Flir One G2 Android I need your help:

I rechecked all bytes in your dump files F6c.txt and F7c.txt and wrote a C code to exact replay all your sniffed USB packets with libusb.
But I get no datas over EP 0x83 (CameraFiles.zip )and EP 0x85 (frames)  |O

Please, can you make with your OpenVizsla a fresh uncut dump of a SDK.apk start process and also a dump of the USB packets of my code ?
Then can I see the difference.

I have a conjecture, that there is a knocking key to open the frame endpoint of Flir One.
See the mystic order of getting the strings descriptors and a libusb_set_configuration(devh, 3) in the middle:
Code: [Select]
libusb_get_string_descriptor langid=0x409
String descriptor 2: "FLIR ONE Camera"
String descriptor 1: "FLIR Systems"
String descriptor 3: "FLIRONEF03FXXXXAFFF"
Successfully set usb configuration 3
String descriptor 4: "SBIBDP Configuration"

The c code is simple with many comments and prints. You can compile it on Linux and OSX (after installing libusb 1.0).
I goes from python code to c code, because I want direct access to libusb to avoid extra USB traffic.


compile on Mac OSX
Code: [Select]
$ gcc -L/opt/local/lib/ -I/opt/local/include/libusb-1.0/ -o flir flir7d.c  -lusb-1.0after installing libusb 1.0 with mac port
Code: [Select]
$ sudo port install libusb
$ sudo port install libusb-legacy


or compile on Ubuntu
Code: [Select]
$ lsb_release -r
Release: 14.04
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -o flir flir7d.c  -lusb-1.0

and start with
$ sudo ./flir


the current output of the code (EP 0x81 works fine):
Code: [Select]
./flir
Successfully find the Flir One G2 device

libusb_control_transfer(devh, DATA0: 80 | 06 | 00 01 | 00 00 | 12 00
DATA1:  12 01 00 02 00 00 00 40 cb 09 96 19 08 01 01 02 03 01

libusb_control_transfer(devh, DATA0: 80 06 00 02 00 00 09 00
DATA1:  09 02 60 00 03 03 04 c0 00

libusb_control_transfer(devh, DATA0: 80 06 00 02 00 00 60 00
DATA1:  09 02 60 00 03 03 04 c0 00 09 04 00 00 02 ff f0 00 05 07 05 81 02 00 02 00 07 05 02 02 00 02 01 09 04 01 01 00 ff f0 01 06 09 04 01 00 02 ff f0 01 06 07 05 83 02 00 02 00 07 05 04 02 00 02 01 09 04 02 01 00 ff f0 01 07 09 04 02 00 02 ff f0 01 07 07 05 85 02 00 02 00 07 05 06 02 00 02 01

libusb_get_string_descriptor langid=0x409
String descriptor 2: "FLIR ONE Camera"
String descriptor 1: "FLIR Systems"
String descriptor 3: "FLIRONEF03FXXXXXFFF"
Successfully set usb configuration 3
String descriptor 4: "SBIBDP Configuration"
String descriptor 5: "iAP Interface"
String descriptor 6: "com.flir.rosebud.fileio"
String descriptor 7: "com.flir.rosebud.frame"
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

: Tue Dec  8 22:41:23 2015

: Tue Dec  8 22:41:23 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

: Tue Dec  8 22:41:24 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_OTHER

: Tue Dec  8 22:41:25 2015
 bulk read EP 0x81, actual length 535
HEX:
 cc 01 00 00 01 00 00 00 07 02 00 00 77 60 0c bd 7b 22 74 79 70 65 22 3a 22 73 6c 65 64 49 6e 66 6f 72 6d 61 74 69 6f 6e 22 2c 22 64 61 74 61 22 3a 7b 22 73 65 72 69 61 6c 4e 75 6d 62 65 72 42 6f 61 72 64 22 3a 22 46 30 33 46 38 4f 30 30 41 46 46 22 2c 22 70 61 72 74 4e 75 6d 62 65 72 42 6f 61 72 64 22 3a 22 32 31 32 30 30 31 36 30 32 30 31 22 2c 22 76 65 72 73 69 6f 6e 42 6f 61 72 64 22 3a 22 44 22 2c 22 73 65 72 69 61 6c 4e 75 6d 62 65 72 4c 65 70 74 6f 6e 22 3a 22 33 37 31 38 37 31 22 2c 22 76 65 72 73 69 6f 6e 4c 65 70 74 6f 6e 22 3a 22 33 2e 31 2e 34 36 22 2c 22 6c 65 70 74 6f 6e 51 52 22 3a 22 41 30 33 37 31 38 37 31 22 2c 22 76 65 72 73 69 6f 6e 52 6f 73 65 62 75 64 46 61 63 74 6f 72 79 45 53 57 22 3a 22 30 2e 34 2e 32 37 22 2c 22 76 65 72 73 69 6f 6e 52 6f 73 65 62 75 64 4f 70 65 72 61 74 69 6f 6e 61 6c 45 53 57 22 3a 22 30 2e 34 2e 32 37 22 2c 22 76 65 72 73 69 6f 6e 52 6f 73 65 62 75 64 55 70 64 61 74 65 72 45 53 57 22 3a 22 30 2e 34 2e 32 37 22 2c 22 76 65 72 73 69 6f 6e 52 6f 73 65 62 75 64 41 50 49 22 3a 22 6d 61 73 74 65 72 2e 30 31 35 65 64 65 34 22 2c 22 67 69 74 52 65 76 69 73 69 6f 6e 22 3a 22 6d 61 73 74 65 72 2e 30 31 35 65 64 65 34 22 2c 22 61 75 74 6f 6d 61 74 69 63 53 68 75 74 74 65 72 22 3a 22 59 22 2c 22 66 6f 72 6d 46 61 63 74 6f 72 22 3a 22 64 6f 6e 67 6c 65 22 2c 22 74 68 65 72 6d 61 6c 48 65 69 67 68 74 22 3a 22 31 32 30 22 2c 22 74 68 65 72 6d 61 6c 57 69 64 74 68 22 3a 22 31 36 30 22 2c 22 62 69 67 45 6e 64 69 61 6e 54 68 65 72 6d 61 6c 22 3a 22 30 22 2c 22 6f 70 65 72 61 74 69 6e 67 4d 6f 64 65 22 3a 22 6f 70 65 72 61 74 69 6f 6e 61 6c 22 7d 7d 00
STRING:
?w`?{"type":"sledInformation","data":{"serialNumberBoard":"F03XXXXXXX","partNumberBoard":"21222222201","versionBoard":"D","serialNumberLepton":"32333331","versionLepton":"3.1.46","leptonQR":"A0777781","versionRosebudFactoryESW":"0.4.27","versionRosebudOperationalESW":"0.4.27","versionRosebudUpdaterESW":"0.4.27","versionRosebudAPI":"master.015ede4","gitRevision":"master.015ede4","automaticShutter":"Y","formFactor":"dongle","thermalHeight":"120","thermalWidth":"160","bigEndianThermal":"0","operatingMode":"operational"}}

: Tue Dec  8 22:41:25 2015
 bulk read EP 0x81, actual length 100
HEX:
 cc 01 00 00 01 00 00 00 54 00 00 00 55 14 30 67 7b 22 74 79 70 65 22 3a 22 62 61 74 74 65 72 79 56 6f 6c 74 61 67 65 55 70 64 61 74 65 22 2c 22 64 61 74 61 22 3a 7b 22 76 6f 6c 74 61 67 65 22 3a 34 2e 30 31 39 39 39 39 39 38 30 39 32 36 35 31 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 39 35 7d 7d 00
STRING:
?TU0g{"type":"batteryVoltageUpdate","data":{"voltage":4.01999998092651,"percentage":95}}

: Tue Dec  8 22:41:25 2015
 bulk read EP 0x81, actual length 182
HEX:
 cc 01 00 00 01 00 00 00 45 00 00 00 af 24 95 8f 7b 22 74 79 70 65 22 3a 22 62 61 74 74 65 72 79 43 68 61 72 67 69 6e 67 43 75 72 72 65 6e 74 55 70 64 61 74 65 22 2c 22 64 61 74 61 22 3a 7b 22 63 68 61 72 67 69 6e 67 43 75 72 72 65 6e 74 22 3a 30 7d 7d 00 cc 01 00 00 01 00 00 00 51 00 00 00 67 e4 ee 50 7b 22 74 79 70 65 22 3a 22 62 61 74 74 65 72 79 43 68 61 72 67 69 6e 67 53 74 61 74 65 55 70 64 61 74 65 22 2c 22 64 61 74 61 22 3a 7b 22 63 68 61 72 67 69 6e 67 53 74 61 74 65 22 3a 22 73 74 61 74 65 4e 6f 43 68 61 72 67 69 6e 67 22 7d 7d 00
STRING:
?E?$??{"type":"batteryChargingCurrentUpdate","data":{"chargingCurrent":0}}?Qg??P{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateNoCharging"}}

ask for CameraFiles.zip on EP 0x83:

: Tue Dec  8 22:41:26 2015

EP 0x02 to be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 41 00 00 00 f8 b3 f7 00 ]

Write successful!
EP 0x02 to be sent: {"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
Write successful!
Sent 65 bytes with string: {"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}

EP 0x02 to be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 33 00 00 00 ef db c1 c1 ]

Write successful!
EP 0x02 to be sent 51 Bytes: {"type":"readFile","data":{"streamIdentifier":10}}
Write successful!
Sent 51 bytes with string: {"type":"readFile","data":{"streamIdentifier":10}}

: Tue Dec  8 22:41:26 2015

: Tue Dec  8 22:41:26 2015
 bulk read EP 0x81, actual length 109
HEX:
 cc 01 00 00 01 00 00 00 5d 00 00 00 df 5b 38 1a 7b 22 74 79 70 65 22 3a 22 6f 70 65 6e 46 69 6c 65 53 74 61 74 75 73 22 2c 22 64 61 74 61 22 3a 7b 22 70 61 74 68 22 3a 22 43 61 6d 65 72 61 46 69 6c 65 73 2e 7a 69 70 22 2c 22 73 74 72 65 61 6d 49 64 65 6e 74 69 66 69 65 72 22 3a 31 30 2c 22 6d 6f 64 65 22 3a 22 72 22 7d 7d 00
STRING:
?]?[8{"type":"openFileStatus","data":{"path":"CameraFiles.zip","streamIdentifier":10,"mode":"r"}}

: Tue Dec  8 22:41:28 2015

Ask for video stream, start EP 0x85:

: Tue Dec  8 22:41:28 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x85: LIBUSB_ERROR_OTHER
« Last Edit: December 09, 2015, 09:30:38 am by tomas123 »
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #47 on: December 10, 2015, 04:46:50 am »
Sorry I missed your post yesterday, I'll see if I can do some dumps using my OV.
Give me a few days as things are real busy right now.

   ...ken...
 

Online cynfab

  • Regular Contributor
  • *
  • Posts: 148
Re: Question about FLIR One for Android
« Reply #48 on: December 10, 2015, 04:56:35 am »
Here is what my linux box shows for the output of your code:

Code: [Select]
$ sudo ./flir
[sudo] password for kenm:
Successfully find the Flir One G2 device

libusb_control_transfer(devh, DATA0: 80 | 06 | 00 01 | 00 00 | 12 00
DATA1:  12 01 00 02 00 00 00 40 cb 09 96 19 08 01 01 02 03 01

libusb_control_transfer(devh, DATA0: 80 06 00 02 00 00 09 00
DATA1:  09 02 60 00 03 03 04 c0 00

libusb_control_transfer(devh, DATA0: 80 06 00 02 00 00 60 00
DATA1:  09 02 60 00 03 03 04 c0 00 09 04 00 00 02 ff f0 00 05 07 05 81 02 00 02 00 07 05 02 02 00 02 01 09 04 01 01 00 ff f0 01 06 09 04 01 00 02 ff f0 01 06 07 05 83 02 00 02 00 07 05 04 02 00 02 01 09 04 02 01 00 ff f0 01 07 09 04 02 00 02 ff f0 01 07 07 05 85 02 00 02 00 07 05 06 02 00 02 01

libusb_get_string_descriptor langid=0x409
String descriptor 2: "FLIR ONE Camera"
String descriptor 1: "FLIR Systems"
String descriptor 3: "FLIRONEF03F62xxxxxxxF"
Successfully set usb configuration 3
String descriptor 4: "SBIBDP Configuration"
String descriptor 5: "iAP Interface"
String descriptor 6: "com.flir.rosebud.fileio"
String descriptor 7: "com.flir.rosebud.frame"
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

: Wed Dec  9 10:50:57 2015

: Wed Dec  9 10:50:57 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_IO

: Wed Dec  9 10:50:58 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_NO_DEVICE

: Wed Dec  9 10:50:59 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_NO_DEVICE

ask for CameraFiles.zip on EP 0x83:

: Wed Dec  9 10:51:00 2015

EP 0x02 to be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 41 00 00 00 f8 b3 f7 00 ]

Error in write! res = -4 and transferred = 0

EP 0x02 to be sent: {"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
Error in write! res = -4 and transferred = 0

EP 0x02 to be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 33 00 00 00 ef db c1 c1 ]

Error in write! res = -4 and transferred = 0

EP 0x02 to be sent 51 Bytes: {"type":"readFile","data":{"streamIdentifier":10}}
Error in write! res = -4 and transferred = 0

: Wed Dec  9 10:51:00 2015

: Wed Dec  9 10:51:00 2015

Ask for video stream, start EP 0x85:
Control Out error -4

Looks to be different from what you get.
I'm using the latest Linux Mint 17.3:

$ lsb_release -r
Release:   17.3

I have not poked at any of this yet so I may have something messed up.


   ...ken...
« Last Edit: December 10, 2015, 04:58:18 am by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #49 on: December 10, 2015, 08:24:46 am »
Thanks for your attempt!

Your Linux Mint successful claimed the interfaces 0,1,2 but got on Endpoints 0x02, 0x83 and 0x85 a LIBUSB_ERROR_NO_DEVICE = -4.
Do you unplugged the Flir1 before running "sudo ./flir" ?

I will self install Linux Mint 17.3 and see inside the code...


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf