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

0 Members and 1 Guest are viewing this topic.

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Question about FLIR One for Android
« on: October 04, 2015, 03:12:39 am »
Now that FLIR has finally released it (not just for pre-sale anymore), has anybody managed to make a USB driver for Windows for it yet? I remember with the Seek Thermal imager, somebody managed to (after connecting it to their PC's USB port, via a USB-A to micro-USB cable) create Windows drivers for it, so that it was usable on the PC as a webcam. Has anybody yet managed to do the same thing with the FLIR One for Android, which (like the Seek Thermal) has a micro-USB connector on it?
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #1 on: October 05, 2015, 12:02:50 am »
50 views and no replies? I think there was an entire thread, several pages long, regarding 3rd party drivers for the Seek Thermal imager. I'd think this would be a hot topic, but nobody has replied yet. I'd think somebody would be trying to accomplish the same thing with the FLIR One for Android, but there seems to be little interest, as evidenced by the fact that this thread is on the second page of the Test Equipment section, and yet has no replies (other than the one I'm posting now, for the purpose of putting it back on the first page).
 

Offline encryptededdy

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nz
Re: Question about FLIR One for Android
« Reply #2 on: October 05, 2015, 01:40:42 am »
I think due to the use of a Lepton sensor, those who are interesting in integrating thermal imaging into some kind of product or for some kind of static PC-connected setup are just waiting for FLIR to officially release the Lepton 3 for sale. We already know PureEngineering/GroupGets has their hands on a Lepton 3 module and developed a USB <-> Lepton 3 interface board. https://vine.co/v/edPq5ZD9aO7



Also I can't see much use in connecting the FLIR One Gen 2 to a PC... with the Seek we could use it to increase image quality, fix the gradient, and get raw data out. However with the FLIR One I doubt there's much to be improved on in terms of IQ (due to FLIR's already heavy image processing done in-module) and it also saves radiometric JPEGs with full raw data.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #3 on: October 05, 2015, 05:53:52 am »
I think due to the use of a Lepton sensor, those who are interesting in integrating thermal imaging into some kind of product or for some kind of static PC-connected setup are just waiting for FLIR to officially release the Lepton 3 for sale. We already know PureEngineering/GroupGets has their hands on a Lepton 3 module and developed a USB <-> Lepton 3 interface board. https://vine.co/v/edPq5ZD9aO7



Also I can't see much use in connecting the FLIR One Gen 2 to a PC... with the Seek we could use it to increase image quality, fix the gradient, and get raw data out. However with the FLIR One I doubt there's much to be improved on in terms of IQ (due to FLIR's already heavy image processing done in-module) and it also saves radiometric JPEGs with full raw data.

Even so, for those who want a simple way of doing it, without soldering (as you would need to do with the USB interface board you have been speaking of), having an already existing module (like the FLIR One for Android) would be a great thing. Also, you can get raw, unprocessed thermal image, if you create your own reverse engineered driver for the FLIR One for Android on the PC. And I want that raw, unprocessed data, and I don't want to have to use a soldered project board (like the one you were talking about) to do it. Using a PC driver created from info gathered by reverse engineering it the FLIR One for Android, I would be able to use an already assembled thermal module, that costs very little money, and requires absolutely ZERO soldering, in order to capture true thermal images. So consider this thread a request to all reverse engineers out there, to get on with reverse engineering the FLIR One for Android, so that I will be able to use it ultimately as a thermal webcam for doing all kinds of fun experiments.

One of the things about using the official software on an Android device is that it resizes the thermal image prior to embedding it in a JPEG. You see, the "FLIR One for Android"'s actual output is a 160x120 thermal image that comes out of the USB port, and is then processes by the FLIR One app on an Android device. Part of the processing is to interpolate the 160x120 thermal raw pixels to a 320x240 image. This interpolation is done prior to saving in the radiometric JPEG file, but it is done by the app, NOT by the microcontroller in the "FLIR One for Android" hardware (or at least I hope that's the case). If you can reverse engineer the USB communication protocol used by the FLIR One for Android, and then write your own driver for it for a PC, you SHOULD be able to access the truly RAW (160x120) thermal pixels data stream from the device. As nice as it is to have an image that is bigger than 160x120, doubling the resolution to 320x240 is in effect falsifying scientific data, meaning that it's basically useless for anything other than taking thermal pictures for fun. At this point, saving it as a thermometric JPEG image (as if the data was scientifically valid) is a quite deceptive practice. It give the false impression that the data is actually useful for measuring real temperatures. It is not. It only gives you APPROXIMATE temperatures (which any true scientist would laugh at).

But if I can access (via PC drivers, created through reverse engineering), the actual 160x120 raw thermal image data, I will have my hands on actual usable scientific data. And I will be guarantied that the temperatures calculated from this data are completely accurate.

And by the way, I've never heard of a Lepton 3. I haven't even heard of a Lepton 2. I've just heard of a Lepton, and that the new version with double the horizontal and vertical resolution (160x120, instead of 80x60) is still just called the Lepton. FLIR does not seem to number its newer versions of cores. I can't find any official naming of the Lepton 3 on FLIR's website.
« Last Edit: October 05, 2015, 06:01:08 am by Ben321 »
 

Offline encryptededdy

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nz
Re: Question about FLIR One for Android
« Reply #4 on: October 05, 2015, 06:25:17 am »
Lepton 2 is the 80x60 one we currently have access to. Lepton 3 is the new 160x120 one. They appear to be just internal FLIR names, so you won't find them on the FLIR website. See this document.

At least groupget's previous breakout boards were all sold pre-soldered and ready to use. See: https://groupgets.com/manufacturers/groupgets-labs/products/flir-lepton-breakout-board-v1-4

Here is the full datasheet for Lepton 3: http://media.wix.com/ugd/53cdb6_5191be73d1c943d78d2e1a095cb7f3b8.pdf

According to that, the Lepton 3 does output 160x120 data over voSPI (page 38), so the upscaling must be done in the app or the hardware of the FLIR One.

To be honest, I don't understand your issue with the upscaling. While it's true that native resolution data is the most optimal, if we consider the issues with sharpness on the Lepton's lens (see the FLIR One G2 actual resolution thread) making the sensor only resolve details similarly to a ~120x90 sensor (even though the sensor really is 160x120) and the fact that the Lepton's temperature accuracy is ±2 degrees C, I doubt the upscaling makes any appreciable difference to the observed accuracy of the temperature readings.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #5 on: October 05, 2015, 06:30:22 am »
Lepton 2 is the 80x60 one we currently have access to. Lepton 3 is the new 160x120 one. They appear to be just internal FLIR names, so you won't find them on the FLIR website. See this document.

At least groupget's previous breakout boards were all sold pre-soldered and ready to use. See: https://groupgets.com/manufacturers/groupgets-labs/products/flir-lepton-breakout-board-v1-4

Here is the full datasheet for Lepton 3: http://media.wix.com/ugd/53cdb6_5191be73d1c943d78d2e1a095cb7f3b8.pdf

According to that, the Lepton 3 does output 160x120 data over voSPI (page 38), so the upscaling must be done in the app or the hardware of the FLIR One.

To be honest, I don't understand your issue with the upscaling. While it's true that native resolution data is the most optimal, if we consider the issues with sharpness on the Lepton's lens (see the FLIR One G2 actual resolution thread) making the sensor only resolve details similarly to a ~120x90 sensor (even though the sensor really is 160x120) and the fact that the Lepton's temperature accuracy is ±2 degrees C, I doubt the upscaling makes any appreciable difference to the observed accuracy of the temperature readings.

Do you have the software programming skills needed to write a driver for me, that will let me use a FLIR One for Android as a webcam on my PC? If so, please write this driver for me. I have no interest in building a thermal webcam from scratch, by soldering together a project board like the one mentioned in an above post. It should ideally be a VFW (video for windows) driver, as I have recently discovered how to control webcams in Visual Basic 6, using VFW drivers.
 

Offline encryptededdy

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nz
Re: Question about FLIR One for Android
« Reply #6 on: October 05, 2015, 06:48:06 am »
I literally just said that no soldering is required (at least for the previous boards they've shipped).

I don't have a skills to write a driver, and I also don't have access to the FLIR One gen 2 at this time.

I think your best bet is to wait until Groupgets release their USB interface board. I'm sure it will come with sample software that you can use.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #7 on: October 06, 2015, 04:04:51 am »
I literally just said that no soldering is required (at least for the previous boards they've shipped).

I don't have a skills to write a driver, and I also don't have access to the FLIR One gen 2 at this time.

I think your best bet is to wait until Groupgets release their USB interface board. I'm sure it will come with sample software that you can use.

As far as I know, the only Lepton chip being sold as a separate component is the old one with 80x60 resolution. The new one with 160x120 resolution is not yet being sold to the public, and is only found inside gen-2 FLIR One units. Are you aware of any plans FLIR has to sell the new Lepton chip as a separate component?
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #8 on: October 06, 2015, 05:11:32 pm »
50 views and no replies? I think there was an entire thread, several pages long, regarding 3rd party drivers for the Seek Thermal imager. I'd think this would be a hot topic, but nobody has replied yet.

The only reason why there is no discussion, is the lack of a Flir One G2 camera.
In Germany no trader can deliver this part.
The combination of a thermal camera with an automatic shutter and a real camera is a nice feature for robotics, spy cams and another hacker toys.

You can download the Flir One SDK and study the interesting docs and the code sample.
There is a precompiled flir library for Arm7 CPU. This is the only part which needs reverse engineering  :)

Until now we only know the similar USB announcements from Flir and Seek cameras (iAP Interface)

see my post here
https://www.eevblog.com/forum/testgear/new-flir-products/msg750352/#msg750352
« Last Edit: October 06, 2015, 05:16:12 pm by tomas123 »
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #9 on: October 07, 2015, 03:11:03 am »
50 views and no replies? I think there was an entire thread, several pages long, regarding 3rd party drivers for the Seek Thermal imager. I'd think this would be a hot topic, but nobody has replied yet.

The only reason why there is no discussion, is the lack of a Flir One G2 camera.
In Germany no trader can deliver this part.
The combination of a thermal camera with an automatic shutter and a real camera is a nice feature for robotics, spy cams and another hacker toys.

You can download the Flir One SDK and study the interesting docs and the code sample.
There is a precompiled flir library for Arm7 CPU. This is the only part which needs reverse engineering  :)

Until now we only know the similar USB announcements from Flir and Seek cameras (iAP Interface)

see my post here
https://www.eevblog.com/forum/testgear/new-flir-products/msg750352/#msg750352

But there's lots of other discussion of FLIR products here, why not a lot about the FLIR One version2? I believe it can be sold in Germany too, by the way. It is only 9 frames per second, which means that it is not prevented from being sold outside the USA by ITAR. Besides, there's lots of people on these forums from many places in the world, including the USA.

If I buy one of these FLIR One for Android units for $250, I won't want to have to buy a separate chip (another $150) plus a project board in order to use it on a PC. I will want to use one unit (the one I spent $250 for) to be able to work on both the PC and android. So that's why I want to see some reverse engineering project going on regarding the FLIR One for Android.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #10 on: October 07, 2015, 10:12:53 am »
I believe it can be sold in Germany too, by the way.

Yes, it's shipped from Flir UK to Germany. But if I want a regular bill with germany VAT then I need a germany Flir distributor.
Flir moved the deliver date to the germany distributors from end of september to november.
« Last Edit: October 07, 2015, 10:15:26 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #11 on: October 07, 2015, 01:53:06 pm »
There is some RE going on, just not as obvious as in the early E4 and Seek days.

Attached is a annotated dump of the first few seconds of usb activity between a F1G2 and the F1 Android app.
It's not finished.
There may be inaccuracies.
There is much more to uncover.
This is a long way from a stand alone PC program.
Your mileage may vary.
blah, blah, blah.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #12 on: October 07, 2015, 10:43:06 pm »
very intersting  :-+
How do you got the datas from a android handy?
« Last Edit: October 07, 2015, 10:54:42 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #13 on: October 07, 2015, 10:47:17 pm »
I used my handy USB analyzer in series with the F1 and my tablet running F1 app.
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #14 on: October 07, 2015, 10:57:20 pm »
Guess I can't add a picture after the fact...

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #15 on: October 07, 2015, 11:06:57 pm »
Thank you, but which nice hardware is this? (altium is a PCB design software)
« Last Edit: October 07, 2015, 11:09:25 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #16 on: October 07, 2015, 11:26:01 pm »
Sorry, forgot to add the link:

http://openvizsla.org/

Part of a KickStarter campaign, took many years to get the hardware, but it finally arrived, and works too!
Though it does take a bit of fiddling, and there is no nice GUI.

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #17 on: October 08, 2015, 09:49:30 am »
really nice hardware :-+

as you posted here
https://www.eevblog.com/forum/testgear/new-flir-products/msg752703/#msg752703
it's possible to run the Flir Tools under Chrome with ARChon

I succesfull tested it!!
That's great, because the Flir Apps don't run under Android Studio because there is a precompiled library libflirsdk.so for armeabi-v7a.
There is is same problem with the Flir One SDK.

Unfortunately as yet I haven't a Flir One Android and can't test it: (I'm waiting for delivery).
It is possible to greb the USB traffic between camera and app (under Chrome+ARChon) with a "normal" windows usb sniffer (like sysinternals etc)?

 :palm: ARChon doesn't support the USB Port  :(

PS: https://developer.chrome.com/apps/getstarted_arc
Quote
PC, Mac, Linux, or Chromebook on Chrome Version 41+.

    Note: ARC is no longer supported on 32-bit x86 platforms and those platforms will no longer receive updates after October 13, 2015. All ARM platforms will continue to work and receive updates.
« Last Edit: October 08, 2015, 11:10:25 am by tomas123 »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #18 on: October 08, 2015, 12:26:05 pm »
I received my replacement F1G2 this week. From my conversations with Bill Terre, VP FLIR, it is apparent that demand has far outstripped supply of this little camera. FLIR were not expecting such initial demand for the unit. This is good news as it will hopefully lead to a healthy user base and community support.

It is obvious from FLIRs invitation to developers to create new apps that they wish to encourage product development in many areas. It would be worth registering as a developer on the FLIR ONE web site as this gives access to the SDK, developer documentation and the community forum.

I can foresee the development of applications that run on Windows, Linux, Android etc.If FLIR really want to 'own' this market segment they may be willing to provide developer information for cross platform use.

Bill Terre is VP, GM and OEM market development so an email to him may gain a useful response. Bill is a gentleman and he has been very friendly and helpful to me in recent communications. Great chap.

I have been looking at the cheap Android TV boxes this week to see if they would run the FLIR ONE app. They are really just an ARM based computer and many will run most Android apps with a keyboard and mouse. They have a suitable USB port so should work. The issue will be processor power. Most TV boxes use older ARMtechnology, such as ARM 5 or 7.not great for the FLIR ONE app.

For those unaware, the FLIR ONE Android app was developed on a Samsung S5 and FLIR expect users to use similar powerful hardware. The S5 runs its modern processor at 2.5 GHz.

IMHO, the F1G2 should be considered a very reasonably priced thermal imaging building block. I see no reason to limit its use to just phones and tablets running Android. With a ZnSe close up lens it would make a cheap PCB thermal profiling camera. It could be run on a micro USB cable from a desktop host.

I am hopeful that the F1G2 will become a ground breaking camera that is embraced by the maker community. FLIR will likely release the LEPTON 3  as a part once the demand for the F1G2 can be met.

In the mean time FLIR are looking at placing thermal camera technology into all manner of test products. I have seen the new clamp meter and expect to see a thermal camera equipped multimeter in the future. The LEPTON is so small that it may be incorporated into many devices. Thermal imaging for the masses is coming. The F1G2 could become the VW Beetle of thermal cameras.

Fraser
« Last Edit: October 08, 2015, 12:30:55 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline Balaur

  • Supporter
  • ****
  • Posts: 525
  • Country: fr
Re: Question about FLIR One for Android
« Reply #19 on: October 08, 2015, 03:47:01 pm »
Bummer, I've just received a mail from the eBay seller where I've ordered the Flir One. According to this message, FLIR announced that they had a huge (and unexpected?) success with this product and will not be able to meet the promised delivery times. (Apparently more than 2 million devices have been pre-ordered)

Shipments originally expected on Sep 30 have now a delay of 6 to 8 weeks and will be rationed (fairly?).
 

Online Bud

  • Super Contributor
  • ***
  • Posts: 6905
  • Country: ca
Re: Question about FLIR One for Android
« Reply #20 on: October 08, 2015, 04:19:36 pm »
And because of Flir's creepy practice to phone home (will this nice feature be embedded into the SDK?), it is a good time fo Flir to get a better "home" server to handle the increased volume of data.
Facebook-free life and Rigol-free shack.
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #21 on: October 08, 2015, 04:50:35 pm »
Fraser,

My F1G2 works well on the Hardkernel XU4,
at < $US100, with an octa core processor, it's quite snappy with the F1 app. Runs Android or one of several flavours of Linux.

I am a Flir Registered dev. and have their SDK. So far, only Android, and it is a bit fiddly to get working.
I have been able to build the sample app, and although they say it will run on Android 4.x, my 4.4.2 tablet refuses to load it.
My 5.1.1 tablet loads & runs it, but it crashes. I need to get adb over wifi working again so I can see what's going on.
I think that there are some files missing from the built .apk file, but I need some time to play with it some more.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #22 on: November 11, 2015, 05:01:54 pm »
There is some RE going on, just not as obvious as in the early E4 and Seek days.

Attached is a annotated dump of the first few seconds of usb activity between a F1G2 and the F1 Android app.
It's not finished.
There may be inaccuracies.
There is much more to uncover.
This is a long way from a stand alone PC program.
Your mileage may vary.
blah, blah, blah.

Hi cynfab,

you dumped the usb traffic.

I wrote here and in the following posts some nice details about the Flir One SDK app.
https://www.eevblog.com/forum/testgear/actual-resolution-of-flir-one-v2/msg797214/#msg797214

The SDK contain a compiled modul flironesdk.aar with a system library libjnidevicewrapper.so and a classes.jar
With classes.jar we get some interesting details about the USB protocol like the endpoint numbers.

Code: [Select]
package com.flir.flironesdk.usb;

import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbRequest;
import android.util.Log;
import java.io.Closeable;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;

public class UsbCommunicator
  implements Closeable
{
  private boolean IS_SIMULATED;
  private Delegate mDelegate;
  private volatile UsbDeviceConnection connection;
  private static final String LOG_TAG = "UsbCommunicator";
  private static final int SET_INTERFACE = 11;
  private static final int CTRL_TRANSFER_TIMEOUT = 200;
  static final int FRAME_READ_ENDPOINT_ID = 5;
  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 SUPPORTED_VENDOR_ID = 2507;
  static final int SUPPORTED_PRODUCT_ID = 6550;
  private UsbEndpoint configWriteEndpoint;
 
  public static abstract interface Delegate
  {
    public abstract void onDataReceived(byte[] paramArrayOfByte, UsbCommunicator.ProtocolType paramProtocolType);
   
    public abstract void onCommunicationAvailabilityChange(boolean paramBoolean);
  }
 
  public static enum ProtocolType
  {
    CONFIGURATION((byte)1),  FILEIO((byte)2),  FRAME((byte)4);
   
    private final byte value;
   
    private ProtocolType(byte value)
    {
      this.value = value;
    }
   
    byte getValue()
    {
      return this.value;
    }
  }
 
  private UsbEndpoint fileioWriteEndpoint = null;
  final UsbRequest frameReadRequest = new UsbRequest();
  final UsbRequest fileioReadRequest = new UsbRequest();
  final UsbRequest configReadRequest = new UsbRequest();
  private UsbDevice mDevice;
  volatile boolean connected = false;
  volatile boolean expectFrameData = false;
  volatile boolean expectFileData = false;
 
  public static boolean deviceIsValid(UsbDevice device)
  {
    try
    {
      validateDevice(device);
      return true;
    }
    catch (Exception e)
    {
      Log.e("UsbCommunicator", "Invalid device: " + e.getMessage());
    }
    return false;
  }
 
  public static void validateDevice(UsbDevice device)
    throws Exception
  {
    if (device.getVendorId() != 2507) {
      throw new Exception("Unsupported USB Vendor ID of " + Integer.toHexString(device.getVendorId()));
    }
    if (device.getProductId() != 6550) {
      throw new Exception("Unsupported USB Product ID of " + Integer.toHexString(device.getProductId()));
    }
    int ifaceCount = device.getInterfaceCount();
    HashMap<Integer, Boolean> inEndpointsFound = new HashMap();
    HashMap<Integer, Boolean> outEndpointsFound = new HashMap();
    inEndpointsFound.put(Integer.valueOf(3), Boolean.valueOf(false));
    inEndpointsFound.put(Integer.valueOf(1), Boolean.valueOf(false));
    inEndpointsFound.put(Integer.valueOf(5), Boolean.valueOf(false));
    outEndpointsFound.put(Integer.valueOf(2), Boolean.valueOf(false));
    outEndpointsFound.put(Integer.valueOf(4), Boolean.valueOf(false));
    UsbInterface iface;
    for (int i = 0; i < ifaceCount; i++)
    {
      iface = device.getInterface(i);
     
      int endpointCount = iface.getEndpointCount();
      for (int e = 0; e < endpointCount; e++)
      {
        UsbEndpoint ep = iface.getEndpoint(e);
        if (ep.getDirection() == 128) {
          inEndpointsFound.put(Integer.valueOf(ep.getEndpointNumber()), Boolean.valueOf(true));
        } else {
          outEndpointsFound.put(Integer.valueOf(ep.getEndpointNumber()), Boolean.valueOf(true));
        }
      }
    }
    HashSet<Map.Entry<Integer, Boolean>> allEndpointsFound = new HashSet();
    allEndpointsFound.addAll(inEndpointsFound.entrySet());
    allEndpointsFound.addAll(outEndpointsFound.entrySet());
    for (Map.Entry<Integer, Boolean> endpoint : allEndpointsFound) {
      if (!((Boolean)endpoint.getValue()).booleanValue()) {
        throw new Exception("Unable to communicate with USB device, endpoint " + ((Integer)endpoint.getKey()).toString() + " not found");
      }
    }
  }
 
  public UsbCommunicator(UsbDevice device, UsbDeviceConnection usbConnection, Delegate delegate)
    throws Exception
  {
    validateDevice(device);
   
    this.mDelegate = delegate;
    this.connection = usbConnection;
    this.mDevice = device;
   
    int ifaceCount = device.getInterfaceCount();
    for (int i = 0; i < ifaceCount; i++)
    {
      UsbInterface iface = device.getInterface(i);
      if (false == this.connection.claimInterface(iface, false))
      {
        Log.e("UsbCommunicator", "Unable to claim interface " + iface.getId() + ", close connection and try again.");
        delegate.onCommunicationAvailabilityChange(false);
        throw new Exception("Unable to claim USB interface");
      }
      int endpointCount = iface.getEndpointCount();
      for (int e = 0; e < endpointCount; e++)
      {
        UsbEndpoint ep = iface.getEndpoint(e);
        if (ep.getDirection() == 128) {
          switch (ep.getEndpointNumber())
          {
          case 5:
            this.frameReadRequest.initialize(this.connection, ep);
            break;
          case 1:
            this.configReadRequest.initialize(this.connection, ep);
            break;
          case 3:
            this.fileioReadRequest.initialize(this.connection, ep);
            break;
          case 2:
          case 4:
          default:
            Log.w("UsbCommunicator", "Unknown USB_DIR_IN Endpoint on device!");break;
          }
        } else {
          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!");
          }
        }
      }
    }
    if (this.fileioWriteEndpoint != null)
    {
      stopCommunication(ProtocolType.FRAME);
      stopCommunication(ProtocolType.FILEIO);
    }
    else
    {
      delegate.onCommunicationAvailabilityChange(false);
    }
  }
 
  final int CONFIG_BUFFER_SIZE = 4096;
  final int FRAME_BUFFER_SIZE = 131072;
  final int FILE_BUFFER_SIZE = 1048576;
  final ByteBuffer configBuffer = ByteBuffer.allocate(4096);
  final ByteBuffer frameBuffer = ByteBuffer.allocate(131072);
  final ByteBuffer fileBuffer = ByteBuffer.allocate(1048576);
 
  private void pollEndpoints()
  {
    new Thread(new Runnable()
    {
      public void run()
      {
        Log.d("configReadRequest", "Starting configReadRequest poll loop...");
        UsbCommunicator.this.configReadRequest.queue(UsbCommunicator.this.configBuffer, 4096);
        while (UsbCommunicator.this.connected)
        {
          UsbRequest requestResult = UsbCommunicator.this.connection.requestWait();
          synchronized (UsbCommunicator.this.configReadRequest)
          {
            if (!UsbCommunicator.this.connected) {
              break;
            }
            if (requestResult == UsbCommunicator.this.configReadRequest)
            {
              byte[] data = new byte[UsbCommunicator.this.configBuffer.position()];
              UsbCommunicator.this.configBuffer.flip();
              UsbCommunicator.this.configBuffer.get(data);
              if (data.length > 0) {
                UsbCommunicator.this.mDelegate.onDataReceived(data, UsbCommunicator.ProtocolType.CONFIGURATION);
              }
              UsbCommunicator.this.configBuffer.clear();
              UsbCommunicator.this.configReadRequest.queue(UsbCommunicator.this.configBuffer, 4096);
            }
            else if (requestResult == UsbCommunicator.this.frameReadRequest)
            {
              byte[] data = new byte[UsbCommunicator.this.frameBuffer.position()];
              UsbCommunicator.this.frameBuffer.flip();
              UsbCommunicator.this.frameBuffer.get(data);
              if (data.length > 0) {
                UsbCommunicator.this.mDelegate.onDataReceived(data, UsbCommunicator.ProtocolType.FRAME);
              }
              if (UsbCommunicator.this.expectFrameData) {
                UsbCommunicator.this.frameReadRequest.queue(UsbCommunicator.this.frameBuffer, 131072);
              }
              UsbCommunicator.this.frameBuffer.clear();
            }
            else if (requestResult == UsbCommunicator.this.fileioReadRequest)
            {
              byte[] data = new byte[UsbCommunicator.this.fileBuffer.position()];
              UsbCommunicator.this.fileBuffer.flip();
              UsbCommunicator.this.fileBuffer.get(data);
              UsbCommunicator.this.mDelegate.onDataReceived(data, UsbCommunicator.ProtocolType.FILEIO);
              UsbCommunicator.this.fileBuffer.clear();
              if (UsbCommunicator.this.expectFileData) {
                UsbCommunicator.this.fileioReadRequest.queue(UsbCommunicator.this.fileBuffer, 1048576);
              }
            }
          }
        }
      }
    })
   
      .start();
  }
 
  public UsbCommunicator(Delegate usbDelegate)
  {
    Log.i("UsbCommunicator", "Simulated device constructor");
    this.mDelegate = usbDelegate;
    this.IS_SIMULATED = true;
  }
 
  private void sendData(UsbEndpoint ep, byte[] data, int length)
  {
    Log.d("UsbCommunicator", "Sending " + length + " bytes on EP" + ep.getEndpointNumber());
    synchronized (this.connection)
    {
      int offset = 0;
      while (offset < length)
      {
        int result = this.connection.bulkTransfer(ep, data, offset, length - offset, 500);
        if (result > 0)
        {
          Log.d("UsbCommunicator", "Bulk transfer sent " + result + " bytes on Endpoint " + ep.getEndpointNumber());
          offset += result;
        }
        else
        {
          Log.w("UsbCommunicator", "Bulk Transfer Failed on Endpoint " + ep.getEndpointNumber());
        }
      }
    }
  }
 
  native void sendConfigDataToSimulatedDevice(byte[] paramArrayOfByte);
 
  public void sendDataToDevice(byte[] data, ProtocolType protocolType)
  {
    if (this.IS_SIMULATED)
    {
      switch (protocolType)
      {
      case CONFIGURATION:
        sendConfigDataToSimulatedDevice(data);
        break;
      }
    }
    else
    {
      UsbEndpoint destinationEndpoint;
      UsbEndpoint destinationEndpoint;
      switch (protocolType)
      {
      case CONFIGURATION:
        destinationEndpoint = this.configWriteEndpoint;
        break;
      case FILEIO:
        destinationEndpoint = this.fileioWriteEndpoint;
        break;
      default:
        Log.w("UsbCommunicator", "Attempted to send data on knosupported protocol!"); return;
      }
      UsbEndpoint destinationEndpoint;
      sendData(destinationEndpoint, data, data.length);
    }
  }
 
  public void sendConfigData(byte[] data)
  {
    sendDataToDevice(data, ProtocolType.CONFIGURATION);
  }
 
  public void sendFileioData(byte[] data)
  {
    sendDataToDevice(data, ProtocolType.FILEIO);
  }
 
  public void close()
  {
    if (this.connected)
    {
      pause();
     
      this.connection.close();
      this.mDelegate.onCommunicationAvailabilityChange(false);
      Log.d("UsbCommunicator", "Connection closed.");
    }
  }
 
  public void pause()
  {
    if (this.connected)
    {
      synchronized (this.configReadRequest)
      {
        stopFrames();
        stopCommunication(ProtocolType.FILEIO);
        this.connected = false;
        this.configReadRequest.cancel();
        this.configBuffer.clear();
       
        this.fileioReadRequest.cancel();
       
        this.frameReadRequest.cancel();
      }
      this.mDelegate.onCommunicationAvailabilityChange(false);
    }
  }
 
  private void startFrames()
  {
    startCommunication(ProtocolType.FRAME);
  }
 
  private void stopFrames()
  {
    stopCommunication(ProtocolType.FRAME);
  }
 
  private void startCommunication(ProtocolType protocolType)
  {
    toggleCommunication(protocolType, true);
  }
 
  private void stopCommunication(ProtocolType protocolType)
  {
    toggleCommunication(protocolType, false);
  }
 
  private void toggleCommunication(ProtocolType protocolType, boolean startCommunication)
  {
    if (this.IS_SIMULATED == true) {
      return;
    }
    switch (protocolType)
    {
    case FRAME:
      int interfaceNumber = 2;
      this.expectFrameData = startCommunication;
      this.frameBuffer.clear();
      if (this.expectFrameData) {
        this.frameReadRequest.queue(this.frameBuffer, 131072);
      }
      break;
    case FILEIO:
      int interfaceNumber = 1;
      this.expectFileData = startCommunication;
      this.fileBuffer.clear();
      if (this.expectFileData) {
        this.fileioReadRequest.queue(this.fileBuffer, 1048576);
      }
      break;
    case CONFIGURATION:
      Log.w("UsbCommunicator", "Configuration Protocol cannot be started or stopped.");
    default:
      return;
    }
    int interfaceNumber;
    int altSetting = startCommunication ? 1 : 0;
    synchronized (this.connection)
    {
      int result = this.connection.controlTransfer(1, 11, altSetting, interfaceNumber, null, 0, 200);
      Log.d("UsbCommunicator", "Result from control transfer: " + result);
    }
  }
 
  public void connect()
  {
    if (!this.connected)
    {
      this.connected = true;
      this.mDelegate.onCommunicationAvailabilityChange(true);
      startCommunication(ProtocolType.FILEIO);
      pollEndpoints();
    }
  }
}
« Last Edit: November 11, 2015, 05:04:31 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #23 on: November 11, 2015, 06:05:33 pm »
Thanks for that,
I've been tied up with other projects,
I was able to recompile the example app from the sdk, but it just crashed on the 2 tablets I use for the Flir ONE, I was a bit disappointed, till you posted about the cropping issues. So I tried your recompilation, and found it did the same thing. I then tried it on my Odroid XU4, and it works just fine!. So I believe that there is a performance issue with the Example App and if your phone/tablet doesn't have the horsepower it just crashes.

I'll take a look at what you just posted as soon as I cand find some time.


   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #24 on: November 12, 2015, 09:23:33 pm »
So I believe that there is a performance issue with the Example App and if your phone/tablet doesn't have the horsepower it just crashes.

I compiled also against the old SDK 1.0.1 ( FLIROneSDK-Android-1_0_1.zip )

there is  newer version
Quote
SDK 1.0.2

CHANGE LOG

Improves reliability of saving and loading frames.


The file size of system library  libjnidevicewrapper.so is shrinked from 33MB to 16MB  :-+

try it
« Last Edit: November 12, 2015, 09:26:43 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #25 on: November 13, 2015, 01:21:25 pm »
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 13, 2015, 01:38:16 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #26 on: November 18, 2015, 12: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 18, 2015, 03:27:38 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #27 on: November 18, 2015, 03:19:18 pm »
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 18, 2015, 10:17:41 pm »
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 18, 2015, 10:54:33 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #29 on: November 19, 2015, 10:10:34 am »
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, 11:43:52 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #30 on: November 19, 2015, 08:29:31 pm »
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
https://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 19, 2015, 09:07:02 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #31 on: November 19, 2015, 09:57:02 pm »
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, 12: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, 01:08:26 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #33 on: November 20, 2015, 01:03:37 am »
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, 01:10:35 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #34 on: November 20, 2015, 01:05:33 am »
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.
https://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, 11:35:24 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #35 on: November 20, 2015, 01:21:52 am »
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, 01:23:23 am by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #36 on: November 20, 2015, 04:44:21 pm »
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 20, 2015, 05:09:44 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #37 on: November 20, 2015, 05:53:53 pm »
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 20, 2015, 06:31:36 pm »
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 20, 2015, 06:42:57 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #39 on: November 22, 2015, 10:02:46 pm »
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 22, 2015, 10:09:52 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #40 on: November 23, 2015, 01:12:44 am »
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, 09:16:18 am »
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: 1003
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #42 on: November 23, 2015, 11:21:27 am »
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, 12: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 23, 2015, 04:58:21 pm by tomas123 »
 

Offline tomas123

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

to push this thread I used your python code for seek
https://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, 07:27:59 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #45 on: November 25, 2015, 01:37:18 am »
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 08, 2015, 10:13:40 pm »
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 08, 2015, 10:30:38 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #47 on: December 09, 2015, 05:46:50 pm »
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...
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #48 on: December 09, 2015, 05:56:35 pm »
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 09, 2015, 05:58:18 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #49 on: December 09, 2015, 09:24:46 pm »
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...

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #50 on: December 09, 2015, 11:09:54 pm »
I've been trying to figure this out all afternoon and haven't so far. No I didn't unplug the device. I get the same basic response when I try my seek python code moded for the flir one.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #51 on: December 09, 2015, 11:31:10 pm »

After installing a fresh Linux Mint I can write on EP 0x02

install necessary packages (libusb.h, errno.h):
Code: [Select]
$ lsb_release -r
Release: 17.3
$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install g++

compile
Code: [Select]
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -I/usr/include/ -o flir flir7d.c  -lusb-1.0
run
Code: [Select]
$ sudo ./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: "FLIRONEF03FXXXXXXFFF"
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

: Thu Dec 10 00:41:50 2015

: Thu Dec 10 00:41:50 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

: Thu Dec 10 00:41:51 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_TIMEOUT

: Thu Dec 10 00:41:54 2015
 bulk read EP 0x81, actual length 97
HEX:
 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:
?Qg??P{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateNoCharging"}}

ask for CameraFiles.zip on EP 0x83:

: Thu Dec 10 00:41:57 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}}

: Thu Dec 10 00:41:57 2015

: Thu Dec 10 00:41:57 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"}}

: Thu Dec 10 00:42:01 2015

Ask for video stream, start EP 0x85:

: Thu Dec 10 00:42:01 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x85: LIBUSB_ERROR_TIMEOUT

same result: no packages from EP 83 and 85  :-\



interesting:
on OSX and ubuntu I get after starting the interface 1 with libusb_control_transfer(devh,1,0x0b,1,1,data,0,100) this long status message (like in your log F6c.txt)
Code: [Select]
start interface 1 FILEIO

: 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"}}
.. but not with Mint  :-\



edit: randomly I get a full message with Mint:
maybe trouble with virtual machine (linux mint runs under vmware fusion)
Code: [Select]
$ sudo ./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: "FLIRONEF03F8O00AFFF"
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

: Thu Dec 10 00:50:29 2015

: Thu Dec 10 00:50:29 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

: Thu Dec 10 00:50:30 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_TIMEOUT

: Thu Dec 10 00:50:32 2015
 bulk read EP 0x81, actual length 519
HEX:
 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:
{"type":"sledInformation","data":{"serialNumberBoard":"F03FXXXXXXFF","partNumberBoard":"211111111","versionBoard":"D","serialNumberLepton":"3222221","versionLepton":"3.1.46","leptonQR":"A3444441","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"}}

ask for CameraFiles.zip on EP 0x83:

: Thu Dec 10 00:50:36 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}}

: Thu Dec 10 00:50:36 2015

: Thu Dec 10 00:50:36 2015
 bulk read EP 0x81, actual length 16
HEX:
 cc 01 00 00 01 00 00 00 5d 00 00 00 df 5b 38 1a
STRING:
?]?[8

« Last Edit: December 10, 2015, 12:07:11 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #52 on: December 10, 2015, 12:03:56 am »
Very interesting, I just tried on a laptop and got the same results as I got before, this was a 32bit laptop and before I was using my 64bit desktop.
I find it interesting that I get different error messages.
Maybe my Flir One has different fiirmware.
THe FlirOne app says I have vers 0.4.26
and vers 1.4.1 fro the app.
Hardware version C

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #53 on: December 10, 2015, 12:06:57 am »
my F1: "versionBoard":"D"
your F1: "versionBoard":"C"

As I wrote above I changed from phyton to c because c has a native access to libusb without overhead.
I tried to write the same bytes to usb as I read in your log file.
I hope your OpenVizsla can show the difference.

PS: I installed 64 Bit Linux Mint

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #54 on: December 10, 2015, 12:21:04 am »
What version of libusb-1.0 are you using, mine is what comes with Linux Mint 17.3 which is:
2:1.0.17-1ubuntu2
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #55 on: December 10, 2015, 12:46:44 am »
Here is an OV dump of my laptop talking to the FlirOne using your code.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #56 on: December 10, 2015, 09:42:23 am »
Great :-+

The good news: Our USB packets from c-code are byte identical (include checksum) with the Flir One App
The bad news: You can't start with your Linux Mint the EP 0x81 (CONFIG_READ_ENDPOINT) on interface 0 of the Flir1. Therefore you got an error and the transfer stops.

Lets compare our configuration:

I downloaded the linuxmint-17.3-cinnamon-64bit.iso from http://www.linuxmint.com/download.php
and after installing in vmware :D I only make the following steps for running the code:
Code: [Select]
$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install g++

$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -I/usr/include/ -o flir flir7d.c  -lusb-1.0

then I can open the EP 0x81 as you see in my log files above
 
Code: [Select]
bulk read EP 0x81, actual length 519
...
STRING:
{"type":"sledInformation","data":{"serialNumberBoard":"F03FXXXXXXFF","partNumberBoard":"211111111","versionBoard":"D","serialNumberLepton":"3222221","versionLepton":"3.1.46","leptonQR":"A3444441","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"}}

my libusb version is the same as yours (2:1.0.17-1ubuntu2):
Code: [Select]
$ dpkg -l | grep -i usb
...
ii  libusb-0.1-4:amd64                          2:0.1.12-23.3ubuntu1                                amd64        userspace USB programming library
ii  libusb-1.0-0:amd64                          2:1.0.17-1ubuntu2                                   amd64        userspace USB programming library
ii  libusb-1.0-0:i386                           2:1.0.17-1ubuntu2                                   i386         userspace USB programming library
ii  libusb-1.0-0-dev:amd64                      2:1.0.17-1ubuntu2                                   amd64        userspace USB programming library development files

it's possible, that you included a bad lib path with your gcc
please compare you command line with my line:
Code: [Select]
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -I/usr/include/ -o flir flir7d.c  -lusb-1.0
Maybe that a claim interface with "force" make sense, but I got an ok!
http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection.html#claimInterface(android.hardware.usb.UsbInterface,%20boolean)
« Last Edit: December 10, 2015, 09:58:31 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #57 on: December 10, 2015, 05:05:47 pm »
I use Linux mint as my main desktop, so no vmware involved. I am using Mint 17.3 MATE
I have lots of stuff installed so it is possible that there is some sort of usb conflict.
I already had libusb-1.0-0-dev and build essentials installed so after executing your 2 apt-get commands apt reported nothing further installed.
I cut and pasted your compile command.

 dpkg -l | grep -i usb
ii  libgusb2:amd64                              0.1.6-5                                                     amd64        GLib wrapper around libusb1
ii  libusb-0.1-4:amd64                          2:0.1.12-23.3ubuntu1                                        amd64        userspace USB programming library
ii  libusb-1.0-0:amd64                          2:1.0.17-1ubuntu2                                           amd64        userspace USB programming library
ii  libusb-1.0-0:i386                           2:1.0.17-1ubuntu2                                           i386         userspace USB programming library
ii  libusb-1.0-0-dev:amd64                      2:1.0.17-1ubuntu2                                           amd64        userspace USB programming library development files
ii  libusbmuxd2                                 1.0.8-2ubuntu1                                              amd64        USB multiplexor daemon for iPhone and iPod Touch devices - library
ii  mintstick                                   1.2.6                                                       all          write .img and .iso files to USB sticks
ii  python-usb                                  0.4.3-1                                                     amd64        USB interface for Python
ii  usb-modeswitch                              2.1.1+repack0-1ubuntu1                                      amd64        mode switching tool for controlling "flip flop" USB devices
ii  usb-modeswitch-data                         20140327-1                                                  all          mode switching data for usb-modeswitch
ii  usbmuxd                                     1.0.8-2ubuntu1                                              amd64        USB multiplexor daemon for iPhone and iPod Touch devices
ii  usbutils                                    1:007-2ubuntu1                                              amd64        Linux USB utilities
ii  xserver-xorg-video-sisusb                   1:0.9.6-2build1                                             amd64        X.Org X server -- SiS USB display driver

I think my lib path is ok as ldd seems to find the libusb-1.0 lib


 ldd flir
   linux-vdso.so.1 =>  (0x00007ffcdd786000)
   libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f6e74610000)
   libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6e7424b000)
   libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f6e74039000)
   libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6e73e1b000)
   /lib64/ld-linux-x86-64.so.2 (0x00007f6e74852000)
   libcgmanager.so.0 => /lib/x86_64-linux-gnu/libcgmanager.so.0 (0x00007f6e73c00000)
   libnih.so.1 => /lib/x86_64-linux-gnu/libnih.so.1 (0x00007f6e739e7000)
   libnih-dbus.so.1 => /lib/x86_64-linux-gnu/libnih-dbus.so.1 (0x00007f6e737dd000)
   libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f6e73598000)
   librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6e7338f000)

I'll tried to use the FORCE  boolean and it makes no difference.  oops, that's only for android, my bad...;>P

could you send me your flir binary.
« Last Edit: December 10, 2015, 06:23:37 pm by cynfab »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #58 on: December 10, 2015, 07:39:54 pm »
It's working on my system now,
I removed the lsusb_reset_device from main, and added a few prints to see what was going on and it's now reading data from EP 85!!
I think the reset device was screwing things up (differently) on our respective systems.
Now we can move on to do some real Thermal Imaging.
   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #59 on: December 10, 2015, 10:58:34 pm »
... and it's now reading data from EP 85!!

wow :-+

Really from EP 0x85 ? Please send me a terminal log from your F1 :palm:

I used your changed code on Mint and OSX ... and nothing happens on EP 0x83 and 0x85 ...
Code: [Select]
>>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_OTHER
>>>>>>>>>>>>>>>>>bulk transfer (in) 0x85: LIBUSB_ERROR_OTHER

As I said, I rechecked every USB byte twice and I have the suspicion that there is a special sequence for opening the endpoint 0x85 like port knocking
https://en.wikipedia.org/wiki/Port_knocking.

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #60 on: December 11, 2015, 01:16:52 am »
took out some of the prints so the dump of the data from EP 85 wouldn't overwhelm my terminal.

Here is the terminal log and the code that generated it.

I would still like to try your binary.

  ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #61 on: December 11, 2015, 11:20:14 am »
as attachment my binary and terminal log

I'm interested in your binary  ;)

Code: [Select]
$ ldd flir
linux-vdso.so.1 =>  (0x00007ffd3e51a000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007fd5a8e9a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd5a8ad5000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fd5a88c4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd5a86a6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd5a90b1000)
libcgmanager.so.0 => /lib/x86_64-linux-gnu/libcgmanager.so.0 (0x00007fd5a848b000)
libnih.so.1 => /lib/x86_64-linux-gnu/libnih.so.1 (0x00007fd5a8273000)
libnih-dbus.so.1 => /lib/x86_64-linux-gnu/libnih-dbus.so.1 (0x00007fd5a8069000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fd5a7e24000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd5a7c1c000)
... no differences to your "ldd flir"
« Last Edit: December 11, 2015, 02:28:50 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #62 on: December 11, 2015, 11:31:04 am »
Hi cynfab,

please check, if your code is also working fine after changing the order of the string descriptors
a[8] = { 2,1,3,4,5,6,7};
and
if (a==3){
          r = libusb_set_configuration(devh, 3);

this part give as result:
Code: [Select]
libusb_get_string_descriptor langid=0x409
String descriptor 2: "FLIR ONE Camera"
String descriptor 1: "FLIR Systems"
String descriptor 3: "FLIRONEFXXXXXXXFFF"
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"

Code: [Select]
    int  a[8] = { 2,1,3,4,5,6,7};
   
// Get all string descriptors.
for (i = 0; i <= 6; i++)
{

    r = libusb_get_string_descriptor(devh, a[i], langid, tbuf, 0xFF);

if (r >= 0)
{
//printf("String descriptor %u: \"%s\"\n", a[i], string_buffer);
int si, di;

for (di = 0, si = 2; si < tbuf[0]; si += 2) {
        if ((tbuf[si] & 0x80) || (tbuf[si + 1])) /* non-ASCII */
        string_buffer[di++] = '?';
        else
        string_buffer[di++] = tbuf[si];
        }
        string_buffer[di] = 0;
printf("String descriptor %u: \"%s\"\n", a[i], string_buffer);


} else {
fprintf(stderr, "libusb_get_string_descriptor wValue=%i error %d\n", a[i], r);
      goto out;
}

// after string_descriptor 0303 comes SET_CONFIGURATION = 03
if (a[i]==3){
r = libusb_set_configuration(devh, 3);
        if (r < 0) {
          fprintf(stderr, "libusb_set_configuration error %d\n", r);
          goto out;
          }
          printf("Successfully set usb configuration 3\n");

}
}

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #63 on: December 11, 2015, 03:11:49 pm »
Hi tomas123,
Your binary runs ok on my system. i.e. it reads from EP 83 & 85.
log attached.
Of interest is that I ran the code twice and the first time it got Camerafiles.zip from the device, the second time it did not. The camera was powered on continuously and the runs were less than a minuet apart.

Do you want me to change the order of descriptors? the code you posted is identical to what I have now.
I'll change it if you like, please say to what.
I don't think the order is the same as what I observed with my OV.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #64 on: December 11, 2015, 04:24:13 pm »
this is exact the mystic order, which you have logged in F6c.txt:

Code: [Select]
libusb_get_string_descriptor langid=0x409
String descriptor 2: "FLIR ONE Camera"
String descriptor 1: "FLIR Systems"
String descriptor 3: "FLIRONEFXXXXXXXFFF"
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"

from your log F6c.txt:
Code: [Select]
0 bmRequestType = 80
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0300 type (H) index (L)          type: String Descriptor (0x03)  // http://www.beyondlogic.org/usbnutshell/usb5.shtml#StringDescriptors
4 wIndex 00
5 wLength 00
DATA0: 80 06 00 03 00 00 ff 00 d4 64
-> String Descriptor result
     Offset Field Value
     0 bLength = 04
     1 bDescriptorType = 03
     2 bString 0409

 
--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0302 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 02 03 09 04 ff 00 97 db
-> String Descriptor result (FLIR ONE Camera)


--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0301 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 01 03 09 04 ff 00 97 e8
-> String Descriptor result (FLIR SYSTEMS)

--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0303 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 03 03 09 04 ff 00 96 0a
-> String Descriptor result (FLIRONEF03F6200xxxx)

--
0 bmRequestType = 00
1 bRequest = 09                     SET_CONFIGURATION     03
2 wValue 0003 type (H) index (L)
4 wIndex 00
5 wLength 00
DATA0: 00 09 03 00 00 00 00 00 26 c7

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
2 wValue 0304 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 04 03 09 04 ff 00 97 bd
-> String Descriptor result (SBI BDP Configuration)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
2 wValue 0305 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 05 03 09 04 ff 00 96 6c
-> String Descriptor result (iAP Interface)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
2 wValue 0306 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 06 03 09 04 ff 00 96 5f
-> String Descriptor result (com.flir.rosebud.fileio)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
2 wValue 0307 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 07 03 09 04 ff 00 97 8e
-> String Descriptor result (com.flir.rosebud.frame)

Please change the order, so I know whether it is a key.

Otherwise I have the trouble, the the first different bytes on USB between our cameras is the serial number with "String descriptor 3: "FLIRONEFXXXXXXXFFF"
Is there a key, then it can be only placed after the string descriptor 3.

my suggest for a attempt is:

a[8] = { 1,2,3,4,5,6,7};
and
if (a==7){
          r = libusb_set_configuration(devh, 3);


I also can't find anything magic keys in the Flir One SDK java files. It looks like the magic seqeunce is arranged from the Android operating system (USB handshake).
But in your logfile F6c.txt nobody ask for "bConfigurationValue = 3"  but gives the command  "libusb_set_configuration(dev,0x03)" ... :-//
|O
« Last Edit: December 11, 2015, 04:51:05 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #65 on: December 11, 2015, 04:57:48 pm »
Here is the log, and code
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #66 on: December 11, 2015, 05:29:55 pm »
Great :-+

It's sure, that this changed order is not working??
Do you for test purposes unplugged the F1 from USB? 

Please poke a little around this code piece.
I'm very interested in!!
« Last Edit: December 11, 2015, 05:32:14 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #67 on: December 11, 2015, 05:54:11 pm »
Maybe not so great...
I moved the set config 3 around a bit and it still worked, then set it back to where it was when I last posted, and it worked.....
So I'm not sure what's going on, I'll keep poking at it.
Now that I'm getting frames, it would be nice to be able to see what they look like.
   ...ken...

After running that version several times, sometimes it works, sometimes not.
It seems like you can charge the battery at the same time the camera is running too. This will be good for unattended operation.
« Last Edit: December 11, 2015, 06:12:58 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #68 on: December 11, 2015, 06:16:01 pm »
Hi cynfab,

you are the greatest!!! :-+ :-+
I searched for an old notebook and installed a clean Linux Mint 17 native to disc (no virtual machine).
And now it works fine.

The next step is to search the different between "your" Linux Mint and my systems (Ubuntu, OSX).

Thanks for your help.
« Last Edit: December 11, 2015, 06:17:46 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #69 on: December 11, 2015, 06:29:43 pm »
I found that when it doesn't work:

libusb_get_string_descriptor langid=0x409
String descriptor 1: "FLIR Systems"
String descriptor 2: "FLIR ONE Camera"
String descriptor 3: "FLIRONEF03F6200571F"
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 set usb configuration 3
Successfully claimed interface 0,1,2
stop interface 1 FILEIO
stop interface 2 FRAME

start interface 1 FILEIO
Control Out error -1

If I try to start the interface again r=0, so maybe the start interface section needs to retry if it gets r=-1.

 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #70 on: December 11, 2015, 07:21:38 pm »
Fascinating reading guys. I do not pretend to understand most of it, but I like seeing your team work to solve problems. I hope your efforts are appreciated by others as well. Please keep posting updates as and when you have the time.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #71 on: December 11, 2015, 07:55:02 pm »
The FlirONE is capable of better imaging than the FlirONE app shows.
The SDK is one way to that end, the other will be via the community developing applications that run on something other than Android devices with Flir's closed library.
I'm happy to be able to participate in this effort, as I did in the Seek RE effort.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #72 on: December 11, 2015, 10:42:53 pm »
happy our, on my Raspberry Pi the code also runs fine
I worked the last two weeks at wrong computers  |O

Code: [Select]
$ uname -a
Linux raspberryLCD 3.18.13-v7+ #784 SMP PREEMPT Sat May 9 15:57:36 BST 2015 armv7l GNU/Linux
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -o flir flir7f.c  -lusb-1.0
$ sudo ./flir
...
: Fri Dec 11 23:40:00 2015
 bulk read EP 0x85, actual length 166
HEX:
 7b 22 73 68 75 74 74 65 72 53 74 61 74 65 22 3a 22 4f 4e 22 2c 22 73 68 75 74 74 65 72 54 65 6d 70 65 72 61 74 75 72 65 22 3a 33 31 32 2e 32 33 39 39 39 30 32 33 34 33 37 35 2c 22 75 73 62 4e 6f 74 69 66 69 65 64 54 69 6d 65 73 74 61 6d 70 22 3a 31 31 37 34 36 37 32 30 31 30 2e 35 38 37 34 2c 22 75 73 62 45 6e 71 75 65 75 65 64 54 69 6d 65 73 74 61 6d 70 22 3a 31 31 37 34 36 37 32 30 31 30 2e 35 39 33 35 31 2c 22 66 66 63 53 74 61 74 65 22 3a 22 46 46 43 5f 56 41 4c 49 44 5f 52 41 44 22 7d 00
STRING:
{"shutterState":"ON","shutterTemperature":312.239990234375,"usbNotifiedTimestamp":1174672010.5874,"usbEnqueuedTimestamp":1174672010.59351,"ffcState":"FFC_VALID_RAD"}

: Fri Dec 11 23:40:01 2015
 bulk read EP 0x85, actual length 128208
HEX:
 cf 0b da 0b d2 0b cb 0b c6 0b cd 0b d0 0b cf 0b d2 0b d1 0b d0 0b ca 0b d0 0b cb 0b cb 0b cf 0b cb 0b c6 0b d2 0b cf 0b cd 0b db 0b d5 0b c8 0b cb 0b ce 0b ce 0b cb 0b cd 0b ca 0b d1 0b d1 0b d4 0b ca 0b d9 0b c6 0b ce 0b d6 0b d5 0b cc 0b ca 0b d9 0b c9 0b d5 0b d4 0b d7 0b d3 0b d3 0b cf 0b cf 0b d5 0b d6 0b d1 0b db 0b d7 0b da 0b d2 0b e5 0b e4 0b d3 0b e0 0b d8 0b d6 0b dd 0b e1 0b e8 0b d5 0b dc 0b d9 0b dc 0b de 0b d4 0b d6 0b d9 0b de 0b dc 0b 07 00 b5 7a e2 0b df 0b d8 0b e4 0b d4 0b df 0b d9 0b d8 0b d8 0b d7 0b d7 0b d9 0b e4 0b de 0b e0 0b d7 0b de 0b e3 0b d8 0b e7 0b dc 0b e5 0b e2 0b e6 0b f0 0b ea 0b e0 0b dc 0b de 0b e0 0b d3 0b de 0b d4 0b db 0b da 0b dd 0b e0 0b e2 0b e9 0b e0 0b e5 0b e2 0b ea 0b e2 0b e7 0b e6 0b e2 0b e7 0b e7 0b db 0b e5 0b eb 0b e5 0b e9 0b e8 0b e4 0b ec 0b ee 0b e6 0b e2 0b e5 0b e5 0b e5 0b e4 0b ed 0b de 0b e6 0b e2 0b ee 0b e4 0b f2 0b e8 0b
« Last Edit: December 11, 2015, 11:46:18 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #73 on: December 12, 2015, 01:20:24 am »
As it turns out you can remove the get string descriptors as well as a lot of other stuff and it still "works".
BUT I think there are some timing issues as this code doesn't always work, and sometimes the EP 85 reads come a lot faster than other times.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #74 on: December 12, 2015, 09:22:06 am »
I think, the best way for stable code is to shorten the code exact to the USB initialization sequence of Flir SDK:
- flironesdk/usb/UsbCommunicator.java
- flironesdk/Device.java.

see my attachment flir7h.c

I moved the start/stop interface to state 1
Therefore we get while first loop a non ciritical error
bulk transfer (in) 0x81/0x83: LIBUSB_ERROR_TIMEOUT



Flir One with Raspberry Pi
Code: [Select]
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0' -o flir flir7i.c  -lusb-1.0
analyses of endpoint 0x85 frames 
use flir7i.c for saving the frames to disc, code needs 2/3 frames to sync (simple use only frames > 80Kb):

(1) first image inside the 0x85 frame is the RAW image:
32 Byte Header
then 164x120 2 Byte Little Endian

read with ImageJ http://imagej.nih.gov/ij/download.html
File/Import/RAW

or PS:
https://www.eevblog.com/forum/testgear/actual-resolution-of-flir-one-v2/msg797330/#msg797330

(2) second image is the visible image JPG 640x480
starts at byte 39880 with magic byte sequence  of jpeg "FF 08 FF C0"
Code: [Select]
$ dd if=EP0x85#00005.bin of=1.jpg bs=1 skip=39880
$ identify 1.jpg
1.jpg JPEG 640x480 640x480+0+0 8-bit sRGB 69.3KB 0.000u 0:00.000

(3) at the end a string with some status infomations
Code: [Select]
0001a8b0  ff d9 00 00 00 00 00 00  7b 22 73 68 75 74 74 65  |........{"shutte|
0001a8c0  72 53 74 61 74 65 22 3a  22 4f 4e 22 2c 22 73 68  |rState":"ON","sh|
0001a8d0  75 74 74 65 72 54 65 6d  70 65 72 61 74 75 72 65  |utterTemperature|
0001a8e0  22 3a 33 31 33 2e 35 31  39 39 38 39 30 31 33 36  |":313.5199890136|
0001a8f0  37 32 2c 22 75 73 62 4e  6f 74 69 66 69 65 64 54  |72,"usbNotifiedT|
0001a900  69 6d 65 73 74 61 6d 70  22 3a 31 31 37 34 37 31  |imestamp":117471|
0001a910  36 31 33 35 2e 37 34 35  37 33 2c 22 75 73 62 45  |6135.74573,"usbE|
0001a920  6e 71 75 65 75 65 64 54  69 6d 65 73 74 61 6d 70  |nqueuedTimestamp|
0001a930  22 3a 31 31 37 34 37 31  36 31 33 35 2e 37 34 37  |":1174716135.747|
0001a940  33 36 2c 22 66 66 63 53  74 61 74 65 22 3a 22 46  |36,"ffcState":"F|
0001a950  46 43 5f 56 41 4c 49 44  5f 52 41 44 22 7d 00     |FC_VALID_RAD"}.|

at usbEnqueuedTimestamp you see, that the frame rate is only 5 fps  :(
Code: [Select]
$ strings -n 60 EP0x85*.bin
{"shutterState":"ON","shutterTemperature":313.450012207031,"usbNotifiedTimestamp":1174716129.83373,"usbEnqueuedTimestamp":1174716129.83571,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.459991455078,"usbNotifiedTimestamp":1174716130.15704,"usbEnqueuedTimestamp":1174716130.15865,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.459991455078,"usbNotifiedTimestamp":1174716130.36589,"usbEnqueuedTimestamp":1174716130.36731,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.459991455078,"usbNotifiedTimestamp":1174716130.58713,"usbEnqueuedTimestamp":1174716130.5937,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.470001220703,"usbNotifiedTimestamp":1174716130.80297,"usbEnqueuedTimestamp":1174716130.80479,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.470001220703,"usbNotifiedTimestamp":1174716131.01766,"usbEnqueuedTimestamp":1174716131.0193,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.489990234375,"usbNotifiedTimestamp":1174716131.23305,"usbEnqueuedTimestamp":1174716131.2348,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.489990234375,"usbNotifiedTimestamp":1174716131.44797,"usbEnqueuedTimestamp":1174716131.44984,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.480010986328,"usbNotifiedTimestamp":1174716131.66307,"usbEnqueuedTimestamp":1174716131.6651,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.489990234375,"usbNotifiedTimestamp":1174716131.8858,"usbEnqueuedTimestamp":1174716131.88725,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.5,"usbNotifiedTimestamp":1174716132.1132,"usbEnqueuedTimestamp":1174716132.11485,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.489990234375,"usbNotifiedTimestamp":1174716132.34005,"usbEnqueuedTimestamp":1174716132.34374,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.489990234375,"usbNotifiedTimestamp":1174716132.5623,"usbEnqueuedTimestamp":1174716132.56389,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.5,"usbNotifiedTimestamp":1174716132.79527,"usbEnqueuedTimestamp":1174716132.79729,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.5,"usbNotifiedTimestamp":1174716133.01296,"usbEnqueuedTimestamp":1174716133.01477,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.5,"usbNotifiedTimestamp":1174716133.23994,"usbEnqueuedTimestamp":1174716133.24187,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.510009765625,"usbNotifiedTimestamp":1174716133.4633,"usbEnqueuedTimestamp":1174716133.46513,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716133.67718,"usbEnqueuedTimestamp":1174716133.6789,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716133.89206,"usbEnqueuedTimestamp":1174716133.89397,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.510009765625,"usbNotifiedTimestamp":1174716134.00615,"usbEnqueuedTimestamp":1174716134.00789,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716134.21907,"usbEnqueuedTimestamp":1174716134.22141,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716134.43391,"usbEnqueuedTimestamp":1174716134.43569,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716134.65212,"usbEnqueuedTimestamp":1174716134.65416,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.529998779297,"usbNotifiedTimestamp":1174716134.86733,"usbEnqueuedTimestamp":1174716134.86918,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.540008544922,"usbNotifiedTimestamp":1174716135.08135,"usbEnqueuedTimestamp":1174716135.08307,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.540008544922,"usbNotifiedTimestamp":1174716135.29754,"usbEnqueuedTimestamp":1174716135.29895,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.529998779297,"usbNotifiedTimestamp":1174716135.52014,"usbEnqueuedTimestamp":1174716135.52226,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.519989013672,"usbNotifiedTimestamp":1174716135.74573,"usbEnqueuedTimestamp":1174716135.74736,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.529998779297,"usbNotifiedTimestamp":1174716135.97042,"usbEnqueuedTimestamp":1174716135.97194,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.529998779297,"usbNotifiedTimestamp":1174716136.08966,"usbEnqueuedTimestamp":1174716136.09131,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.540008544922,"usbNotifiedTimestamp":1174716136.3133,"usbEnqueuedTimestamp":1174716136.31491,"ffcState":"FFC_VALID_RAD"}
{"shutterState":"ON","shutterTemperature":313.529998779297,"usbNotifiedTimestamp":1174716136.52721,"usbEnqueuedTimestamp":1174716136.53921,"ffcState":"FFC_VALID_RAD"}
« Last Edit: December 12, 2015, 03:09:37 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #75 on: December 12, 2015, 04:57:56 pm »
tomas123,
Very nice.
I ran flir7i and it dumped many files before I realized it. Looking at the EP85 ones, I see ones that are pure jpg, some are pure thermal, some are combined, some are shuter state and some are 28 bytes of who knows what.

Code: [Select]
-rw-r--r-- 1 kenm kenm 107921 Dec 12 09:11 EP0x85#00023.bin
-rw-r--r-- 1 kenm kenm  26896 Dec 12 09:11 EP0x85#00024.bin
-rw-r--r-- 1 kenm kenm    168 Dec 12 09:11 EP0x85#00025.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00026.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00027.bin
-rw-r--r-- 1 kenm kenm  63289 Dec 12 09:11 EP0x85#00028.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00029.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00030.bin
-rw-r--r-- 1 kenm kenm  93785 Dec 12 09:11 EP0x85#00031.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00032.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00033.bin
-rw-r--r-- 1 kenm kenm  93385 Dec 12 09:11 EP0x85#00034.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00035.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00036.bin
-rw-r--r-- 1 kenm kenm  93201 Dec 12 09:11 EP0x85#00037.bin
-rw-r--r-- 1 kenm kenm  77944 Dec 12 09:11 EP0x85#00038.bin
-rw-r--r-- 1 kenm kenm    169 Dec 12 09:11 EP0x85#00039.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00040.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00041.bin
-rw-r--r-- 1 kenm kenm 103896 Dec 12 09:11 EP0x85#00042.bin
-rw-r--r-- 1 kenm kenm 124008 Dec 12 09:11 EP0x85#00043.bin
-rw-r--r-- 1 kenm kenm    169 Dec 12 09:11 EP0x85#00044.bin
-rw-r--r-- 1 kenm kenm 132952 Dec 12 09:11 EP0x85#00045.bin
-rw-r--r-- 1 kenm kenm    169 Dec 12 09:11 EP0x85#00046.bin
-rw-r--r-- 1 kenm kenm 116440 Dec 12 09:11 EP0x85#00047.bin
-rw-r--r-- 1 kenm kenm    169 Dec 12 09:11 EP0x85#00048.bin
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00049.bin

EP0x85#00036 thermal
EP0x85#00037 jpg
EP0x85#00038 ???
EP0x85#00039 shutter
EP0x85#00040 28 byte ???
EP0x85#00043 combined

Or maybe I'm missing something
« Last Edit: December 12, 2015, 05:10:56 pm by cynfab »
 

Offline sonic

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
    • Homepage
Remote thermal cam
« Reply #76 on: December 12, 2015, 05:36:27 pm »
[...]it was usable on the PC as a webcam.

I did this with the help of SmartCam. I modified the Android SDK example to send a MJPEG stream to it via WiFi. Details on my website.
« Last Edit: January 10, 2016, 02:29:49 am by sonic »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #77 on: December 13, 2015, 08:43:53 am »
Hi sonic,

good work  :-+ :-+

Do you know my posts about the SDK?
You can edit the sdk java files and also switch from cropped to full lepton resolution. Read this thread for more informations...
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

background:
 http://stackoverflow.com/questions/21417419/how-to-convert-aar-to-jar
Quote
Android Studio (version: 1.3.2) allows you to seamlessly access the .jar inside a .aar.
Bonus: it automatically decompiles the classes!
Simply follow these steps:
1. File > New > New Module > Import .JAR/.AAR Package to import you .aar as a module
2. Add the newly created module as a dependency to your main project (not sure if needed)
3. Right click on "classes.jar" as shown in the capture below, and click "Show in explorer". Here is your .jar.

next step:
Android Studio / File / Project Structur
     Modules "app" / Dependencies / + "Module Dependency" and select FlirSDK




SDK without cropped images (full resolution 160x120):

change SDK path for CameraFiles from intern
/data/data/com.flir.flironeexampleapplication/files/CameraFiles
to extern
/sdcard/Android/data/com.flir.flironeexampleapplication/files/CameraFiles

by editing two code lines
Code: [Select]
\FLIROneSDKBundle\FLIRONEExampleApplication\app\src\main\java\com\flir>grep -r -n -A1  getFilesDir *
flironesdk/Device.java:213:        //FrameProcessor.updateCameraFiles(zis, cachedContext.getFilesDir().getAbsolutePath() + File.separator);
flironesdk/Device.java-214-        FrameProcessor.updateCameraFiles(zis, cachedContext.getExternalFilesDir(null).getAbsolutePath() + File.separator);
--
flironesdk/FrameProcessor.java:101:        // String storagePath = context.getFilesDir().getAbsolutePath() + File.separator;
flironesdk/FrameProcessor.java-102-        String storagePath = context.getExternalFilesDir(null).getAbsolutePath() + File.separator;

next step is avoid overwriting your file calib.rsc after starting the apk
edit the function updateCameraFiles() in file FrameProcessor.java
Code: [Select]
static void updateCameraFiles(ZipInputStream zis, String storagePath)
{
    try
    {
        ZipEntry ze;
        while ((ze = zis.getNextEntry()) != null) {
            File f = new File(storagePath + ze.getName());
            if ((!f.exists())||(!ze.getName().endsWith( "calib.rsc")))
            {
                if (ze.isDirectory()) {
                    //File f = new File(storagePath + ze.getName());
                    if (!f.isDirectory()) {
                        f.mkdirs();
                    }
                } else {
                    File parentDir = new File(storagePath + ze.getName()).getParentFile();
                    if (( null != parentDir) &&
                            (!parentDir.isDirectory())) {
                        parentDir.mkdirs();
                    }
                    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(storagePath + ze.getName()));
                    byte[] bytesIn = new byte['?' ];
                    int read;
                    while ((read = zis.read(bytesIn)) != - 1) {
                        bos.write(bytesIn, 0, read);
                    }
                    zis.closeEntry();
                    bos.flush();
                    bos.close();
                }
            }
        }
        zis.close();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
simple delete
/sdcard/Android/data/com.flir.flironeexampleapplication/files/CameraFiles/system/calib.rsc
for getting a fresh version of the file from the FlirOne Flash

now you can edit your calib.rsc (without always overwriting with original file from your F1)

edit your calib.rsc to remove the crop factor by removing the .calib.lensCorr part
the crop factor is inside *.fff files, this files are not bad pixel map files (like Ex):
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.345
.calib.lensCorr.ds_we_ap_fi_le.type int32 100
.calib.lensCorr.ds_we_ap_fi_le.zoom double 7.69
.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.345
.calib.lensCorr.ds_we_ap_fi_leExFOL2.type int32 100
.calib.lensCorr.ds_we_ap_fi_leExFOL2.zoom double 7.69

calc a new checksum crc
Code: [Select]
// crc32 sample on bash command line

// count 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
first try this steps with an original file
inside the large E4 thread in this forum you find some more methods for calculating the Flir CRC



a hint: the FlirOne App from Play Store save the original CameraFiles also to the visible path:
/sdcard/Android/data/com.flir.flirone/files/
CameraFiles.zip
CameraFilesSimu.zip

Here you can always get an original (unpatched) CameraFiles.zip.


view my thermal gallery  ;)
https://www.eevblog.com/forum/testgear/flir-e4-thermal-imaging-camera-teardown/msg802245/#msg802245
Flir One G2 Lepton 160x120 with hacked config file calib.rsc


« Last Edit: December 13, 2015, 11:44:12 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #78 on: December 13, 2015, 11:37:37 am »
Hi sonic,

I saw in your code, that you modified the function onFrameProcessed().

Here is my code modification for onFrameProcessed() for saving full size raw images to *.raw

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:
...

« Last Edit: December 13, 2015, 11:45:28 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #79 on: December 13, 2015, 12:02:57 pm »
Hi cynfab,

you are right.
On my Raspberry Pi this glitches rarely happens, but they appear.
See my log from the first 300 frames.
Code: [Select]
-rw-r--r-- 1 root root     28 2015-12-13 12:47:47.628956961 +0100 EP0x85#00221.bin
-rw-r--r-- 1 root root  38828 2015-12-13 12:47:47.838952429 +0100 EP0x85#00222.bin
-rw-r--r-- 1 root root  63830 2015-12-13 12:47:48.048947898 +0100 EP0x85#00223.bin
there are also jumbo frames :)
Code: [Select]
-rw-r--r-- 1 root root 206830 2015-12-13 12:47:44.959014674 +0100 EP0x85#00207.bin
We know, that the USB Buffer size is limited to 512 Bytes (see lsusb -v and USB specification) .
The libusb driver glues the packets together to a "frame".
Quote
# lsusb -v -d 09cb:1996
...
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN           // libusb_bulk_transfer()
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
          wMaxPacketSize     0x0200  1x 512 bytes

I think, its simple to handle this different frame size in software.
One possibly is to stitch the packets self to a full frame (thermal+jpg+status)

Please look also at the full time stamp. Do you have another frame rate??
and sometimes the EP 85 reads come a lot faster than other times.

another minor information:
Now we know, that the header is not 32, but 28 Bytes and the raw image begins with the two status lines (2 Pixel * 16 Bit = 4 Byte).
With a 32 Byte header the status lines are in the middle and on the right side of the image.
Code: [Select]
-rw-r--r-- 1 kenm kenm     28 Dec 12 09:11 EP0x85#00029.bin
-rw-r--r-- 1 kenm kenm  39852 Dec 12 09:11 EP0x85#00030.bin


Until yet I not thought deeper about this 4 columns.

Encryptededdy linked this, but I think our columns (120px) are not telemetry datas (lines with 160 px) :

More info about the 4 lines of addtl' information: http://media.wix.com/ugd/53cdb6_5191be73d1c943d78d2e1a095cb7f3b8.pdf


« Last Edit: December 13, 2015, 07:56:46 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #80 on: December 13, 2015, 01:07:31 pm »
Hi cynfab,

Code: [Select]
-rw-r--r-- 1 root root    167 2015-12-13 12:47:54.798802942 +0100 EP0x85#00254.bin
-rw-r--r-- 1 root root  39340 2015-12-13 12:47:55.008798450 +0100 EP0x85#00255.bin
-rw-r--r-- 1 root root  70983 2015-12-13 12:47:55.228793750 +0100 EP0x85#00256.bin
after looking inside the glitch frames I get this result:
1. All packets with size about 60k are correct jpeg images without errors (begins with magic byte sequence of jpeg "FF 08 FF C0").
2. All packets with size about 40k are broken raw images, which misses the first/second line
3. All packets with size of 168 Bytes are correct status strings
4. All packets with size of 28 Bytes are the header bytes of a regular full frame (thermal+jpg+status)



my interpretation:
The FlirOne has an internal (timing/sync) problem with the i2c bus to lepton sensor.
This results sometimes in loosing the first lines of thermal sensor and as a result of this we get the usb glitches.
-> litter this frames (my waste quote is 10/314 frames = 3%)

my jumbo frames (200k) are two regular frames (thermal+jpg+status) without the second status, which follows behind with 169 Byte
Code: [Select]
-rw-r--r-- 1 root root 103719 2015-12-13 12:47:46.988970775 +0100 EP0x85#00218.bin
-rw-r--r-- 1 root root 206879 2015-12-13 12:47:47.218965810 +0100 EP0x85#00219.bin
-rw-r--r-- 1 root root    167 2015-12-13 12:47:47.418961494 +0100 EP0x85#00220.bin



for another readers:
currently Flir doesn't public infos about the Leptons radiometric feature:
http://www.flir.com/cvs/cores/knowledgebase/index.cfm?CFTREEITEMKEY=914&view=67485
the FlirOne is currently the only chance to get radiometric datas from Lepton 3 sensor (with black body calibration, thanks to Flir!!) ;)
« Last Edit: December 13, 2015, 01:28:12 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #81 on: December 14, 2015, 05:06:36 pm »
Hi tomas123,
All interesting stuff.
I think we need to look carefully at how the FlirOne SDK example and the decompiled SDK files work. As well as considering the use of libusb's Async API.
I should have some time this week to dig into things.
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #82 on: December 14, 2015, 10:53:06 pm »
I've figured out most of what the 28byte header is about:

A typical 28 byte header:

ef be 00 00 01 00 00 00 b3 02 02 00 ac 9b 00 00  <<< oops typo in orig post
60 66 01 00 a7 00 00 00 cf 4f 12 3c 00 30 ef 9e

From EPx85#00035.bin which is the combined thermal & jpeg.

ls -la
-rw-r--r-- 1 kenm kenm  91911 Dec 14 14:25 1.jpg
-rw-r--r-- 1 kenm kenm 131791 Dec 14 12:32 EP0x85#00035.bin

dd if=EP0x85#00035.bin of=1.jpg bs=1 skip=39880
91911+0 records in
91911+0 records out
91911 bytes (92 kB) copied, 0.140179 s, 656 kB/s

identify 1.jpg
1.jpg JPEG 640x480 640x480+0+0 8-bit DirectClass 91.9KB 0.000u 0:00.000

This jpeg has no EXIF data.

location of status start
28 + thermal image length + length of jpeg:
28 + 39852 + 91744 = 131624

dd if=EP0x85#00035.bin of=1.txt bs=1 skip=131624
167+0 records in
167+0 records out
167 bytes (167 B) copied, 0.000448197 s, 373 kB/s

cat 1.txt
{"shutterState":"FFC","shutterTemperature":307.850006103516,"usbNotifiedTimestamp":1176851589.8668,"usbEnqueuedTimestamp":1176851589.86892,"ffcState":"FFC_VALID_RAD"}

shutter states are FFC | ON
ffc states are Valid | Desired
(maybe more)

Byte Fields:

0 ef
1 be
2 00
3 00
4 01
5 00
6 00
7 00
8-b file (less 28 byte header) length: 02 02 b3 = 131763 + 28 = 131791
c-f length of thermal image:  9b ac = 39852 + 28 byte header = 39880
10-14 length of jpeg image: 01 66 60 = 91744 -> 91911 - 91744 = 167
14-17 length of status: a7 = 167
18-1b ??  still need to figure out what this is
1c-1d 00|10|20|30|40|50|60|70|80 ?? still need this
1e-1f checksum ?? this too.

   ...ken...

« Last Edit: December 15, 2015, 02:16:59 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #83 on: December 15, 2015, 07:27:45 am »
Wow!!
I also looked inside the header but overlooked  thermal/jpg image size
Quote
c-f length of thermal image:  9b ac = 39852 + 28 byte header = 39880

for comparing as attachment 300 headers from my log
I filtered my glitches with "-size +90k", but sometimes (after a glitch) slips the status string to the header of the next "full frame"

The combination of image size >90k and magic bytes "ef be"  is the best marker.

Code: [Select]
$ for i in $(find . -type f -name "EP0x85*" -size +90k); do  ls -al $i; hexdump -C -n 32 $i;done
-rw-r--r--@ 1 tom  staff  101476 13 Dez 12:47 ./EP0x85#00006.bin
00000000  ef be 00 00 01 00 00 00  48 8c 01 00 ac 9b 00 00  |........H.......|
00000010  00 f0 00 00 9c 00 00 00  32 b8 42 8a 00 40 6e 6f  |........2.B..@no|
00000020
-rw-r--r--@ 1 tom  staff  101516 13 Dez 12:47 ./EP0x85#00007.bin
00000000  ef be 00 00 01 00 00 00  70 8c 01 00 ac 9b 00 00  |........p.......|
00000010  28 f0 00 00 9c 00 00 00  7d 1b da 22 00 50 a3 d0  |(.......}..".P..|
00000020
-rw-r--r--@ 1 tom  staff  101430 13 Dez 12:47 ./EP0x85#00008.bin
00000000  ef be 00 00 01 00 00 00  1a 8c 01 00 ac 9b 00 00  |................|
00000010  d0 ef 00 00 9e 00 00 00  85 07 39 f8 00 50 3e 6b  |..........9..P>k|
00000020
-rw-r--r--@ 1 tom  staff  101336 13 Dez 12:47 ./EP0x85#00009.bin
00000000  ef be 00 00 01 00 00 00  64 8c 01 00 ac 9b 00 00  |........d.......|
00000010  10 f0 00 00 a8 00 00 00  5a 4e ad 39 00 50 b4 c5  |........ZN.9.P..|
00000020
-rw-r--r--@ 1 tom  staff  101488 13 Dez 12:47 ./EP0x85#00011.bin
00000000  ef be 00 00 01 00 00 00  fc 8c 01 00 ac 9b 00 00  |................|
00000010  a8 f0 00 00 a8 00 00 00  6d cf 77 f5 00 70 d5 1e  |........m.w..p..|
00000020
-rw-r--r--@ 1 tom  staff  101719 13 Dez 12:47 ./EP0x85#00012.bin
00000000  7b 22 73 68 75 74 74 65  72 53 74 61 74 65 22 3a  |{"shutterState":|
00000010  22 46 46 43 22 2c 22 73  68 75 74 74 65 72 54 65  |"FFC","shutterTe|
00000020
-rw-r--r--@ 1 tom  staff  101647 13 Dez 12:47 ./EP0x85#00013.bin
00000000  ef be 00 00 01 00 00 00  f3 8c 01 00 ac 9b 00 00  |................|
00000010  a0 f0 00 00 a7 00 00 00  b4 a3 1b f0 00 30 20 d3  |.............0 .|
00000020
-rw-r--r--@ 1 tom  staff  141638 13 Dez 12:47 ./EP0x85#00014.bin
00000000  ef be 00 00 01 00 00 00  62 8d 01 00 ac 9b 00 00  |........b.......|
00000010  10 f1 00 00 a6 00 00 00  d1 80 6f 95 00 60 b7 0b  |..........o..`..|
00000020
-rw-r--r--@ 1 tom  staff  101847 13 Dez 12:47 ./EP0x85#00016.bin
00000000  ef be 00 00 01 00 00 00  bb 8d 01 00 ac 9b 00 00  |................|
00000010  68 f1 00 00 a7 00 00 00  df 46 b9 1b 00 50 dc 5b  |h........F...P.[|
00000020
-rw-r--r--@ 1 tom  staff  101861 13 Dez 12:47 ./EP0x85#00017.bin
00000000  ef be 00 00 01 00 00 00  c9 8d 01 00 ac 9b 00 00  |................|
00000010  78 f1 00 00 a5 00 00 00  05 29 cd 95 00 30 33 4c  |x........)...03L|
00000020
-rw-r--r--@ 1 tom  staff  101783 13 Dez 12:47 ./EP0x85#00018.bin
00000000  ef be 00 00 01 00 00 00  7b 8d 01 00 ac 9b 00 00  |........{.......|
00000010  28 f1 00 00 a7 00 00 00  3c 9f a7 40 00 40 cc ad  |(.......<..@.@..|
00000020
-rw-r--r--@ 1 tom  staff  101631 13 Dez 12:47 ./EP0x85#00019.bin
00000000  ef be 00 00 01 00 00 00  e3 8c 01 00 ac 9b 00 00  |................|
00000010  90 f0 00 00 a7 00 00 00  57 ce f1 93 00 50 8b 4c  |........W....P.L|
00000020
-rw-r--r--@ 1 tom  staff  101839 13 Dez 12:47 ./EP0x85#00020.bin
00000000  ef be 00 00 01 00 00 00  b3 8d 01 00 ac 9b 00 00  |................|
00000010  60 f1 00 00 a7 00 00 00  25 c2 4f bb 00 60 59 53  |`.......%.O..`YS|
00000020
-rw-r--r--@ 1 tom  staff  101871 13 Dez 12:47 ./EP0x85#00021.bin
00000000  ef be 00 00 01 00 00 00  d3 8d 01 00 ac 9b 00 00  |................|
00000010  80 f1 00 00 a7 00 00 00  c3 6a de 01 00 20 59 89  |.........j... Y.|
00000020
-rw-r--r--@ 1 tom  staff  100807 13 Dez 12:47 ./EP0x85#00022.bin
00000000  ef be 00 00 01 00 00 00  ab 89 01 00 ac 9b 00 00  |................|
00000010  58 ed 00 00 a7 00 00 00  e5 b8 51 52 00 40 66 41  |X.........QR.@fA|
00000020
-rw-r--r--@ 1 tom  staff  100775 13 Dez 12:47 ./EP0x85#00023.bin
00000000  ef be 00 00 01 00 00 00  8b 89 01 00 ac 9b 00 00  |................|
00000010  38 ed 00 00 a7 00 00 00  23 63 85 95 00 50 56 d3  |8.......#c...PV.|
00000020

« Last Edit: December 15, 2015, 02:36:38 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #84 on: December 15, 2015, 03:51:47 pm »
Hi cynfab,

your infos for endpoint 0x85 in formatted notation:


dump header

$ hexdump -C -n 32 ./EP0x85#00019.bin
-rw-r--r--@ 1 tom  staff  101631 13 Dez 12:47 ./EP0x85#00019.bin
00000000  ef be 00 00 01 00 00 00  e3 8c 01 00 ac 9b 00 00  |................|
00000010  90 f0 00 00 a7 00 00 00  57 ce f1 93 00 50 8b 4c  |........W....P.L|

->  file size  101.631 Byte
    header         -28 Byte
    ---------------------
    frame size 101.603 Byte

--------------------------------------
header

address   
00000000  ef be 00 00   magic bytes 0xEF 0xBE
00000004  01 00 00 00   0x00000001
00000008  e3 8c 01 00   0x00018CE3 = 101.603 byte frame size

0000000C  ac 9b 00 00   0x00009BAC =  39.852 byte thermal image size
00000010  90 f0 00 00   0x0000F090 =  61.584 byte jpg image size
00000014  a7 00 00 00   0x000000A7 =     167 byte status string size
                                     ------------
                             total:  101.603 byte frame size
00000018  57 ce f1 93   unknown
0000001C  00 50 8b 4c   unknown

--------------------------------------------
start adresses

size       adress   (in dezimal)
           0000000  magic bytes 0xEF 0xBE
+     28   0000028  thermal image with size of 39.852 byte
+ 39.852   0039880  jpg image with size of 61.584 byte
+ 61.584   0101464  status string with size of 167 byte
+    167
---------
 101.631 total file size




identify 1.jpg
1.jpg JPEG 640x480 640x480+0+0 8-bit DirectClass 91.9KB 0.000u 0:00.000

This jpeg has no EXIF data.

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #85 on: December 15, 2015, 04:11:09 pm »
Hi cynfab,

some infos:

my next step (on weekend) is to write a code for a V4L2 loopback devices ( /dev/video0 )
Then we can simple connect the FlirOne with Linux video world  ;)

3 month ago I supplemented the great code from user tmbinc  :-+ with a loopback "driver" for the Flir E4, therefore I can recycle most of the the code.
see: https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg756530/#msg756530

another thermal video concept with OpenCV comes from user Bud:
see my linklist: https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg729604/#msg729604

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #86 on: December 15, 2015, 05:05:02 pm »
Hi tomas123,

I was going to do a better job of documenting the EP 81 & EP 83 headers, but here are my raw notes:

Header for EP 81 data

16 bytes

cc 01 00 00 01 00 00 00 55 00 00 00 30 73 8c df


00-03 Header ID cc 01 00 00
04    01
05    00
06    00
06    00
08-0b 00 00 00 55 length of message
0c    ??
0d    ??
0e-0f checksum ??
10-end-1 status message
end   00

++++++++++++++++++++++++

header for the EP83 --> camerafiles.zip
24 bytes

10 55 00 00 01 00 00 00 b7 1a 00 00 0a 00 00 00
00 99 9d 5d 2c 91 a3 df

00-03 header ID 10 55 00 00
04    01
05    00
06    00
07    00
08-0b 00 00 1a b7 = 6839 length of CameraFiles.zip
0c
0d
0e
0f
10
11
12
13
14
15
16-17 checksum ??
18-end CameraFiles.zip


I'd like to see a v4l2 driver too, but I haven't the skills to create one from  scratch.
I'd also like to replicate my dual view android app, maybe as an offshoot of your v4l2 work.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #87 on: December 17, 2015, 12:17:23 am »
Hi cynfab,

I copied the framebuffer and v4l2 code parts from here
https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg756530/#msg756530
to our code.

This code is only a first buggy study!!

hardware: raspberry pi
$ uname -a
Linux raspberryLCD 3.18.13-v7+ #784 SMP PREEMPT Sat May 9 15:57:36 BST 2015 armv7l GNU/Linux



flir8a.c writes the thermal video stream only to the linux framebuffer.
You must switch from your x session to a virtual console (native shell) to see the framebuffer.
I wrote the code for my raspberry display 800x480 in 16 bit.
See comments in code for another resolution and bit depth.

compile with
Code: [Select]
$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0'  -o flir flir8a.c -lusb-1.0 -lm
Code: [Select]
$ sudo ./flir
The framebuffer device opened.
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

:xx Thu Dec 17 01:08:24 2015

: Thu Dec 17 01:08:24 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

: Thu Dec 17 01:08:25 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_TIMEOUT

ask for CameraFiles.zip on EP 0x83:

: Thu Dec 17 01:08: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}}

: Thu Dec 17 01:08:26 2015





flir8b.c writes the thermal video stream to the linux framebuffer and /dev/video0

read my notes to install v4l2loopback on a raspberry pi
https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg756530/#msg756530
and for a V4L2 loopback device under Ubuntu
https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg756831/#msg756831

don't forget to load the kernel driver:
Code: [Select]
$ sudo depmod -a  `uname -r`
$ sudo modprobe v4l2loopback

$ lsmod
Module                  Size  Used by
v4l2loopback           23348  0
videodev              122487  1 v4l2loopback

For v4l2 I removed the switch "std=c99" (avoid "/usr/include/linux/videodev2.h:2090:20: error: field ‘timestamp’ has incomplete type").
Compile with
Code: [Select]
$ /usr/bin/gcc '-I/usr/include/libusb-1.0'  -o flir flir8b.c -lusb-1.0 -lm

start with
Code: [Select]
$ sudo ./flir
The framebuffer device opened.
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   =20480
     vid_format->fmt.pix.field       =1
     vid_format->fmt.pix.bytesperline=160
     vid_format->fmt.pix.colorspace  =8
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

:xx Thu Dec 17 00:52:26 2015

: Thu Dec 17 00:52:26 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

: Thu Dec 17 00:52:27 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_TIMEOUT

ask for CameraFiles.zip on EP 0x83:

: Thu Dec 17 00:52:28 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}}

: Thu Dec 17 00:52:28 2015

: Thu Dec 17 00:52:28 2015
 bulk read EP 0x81, actual length 23
HEX:

STRING:
gMode":"operational"}}

Ask for video stream, start EP 0x85:

: Thu Dec 17 00:52:28 2015
 bulk read EP 0x81, actual length 108
HEX:

STRING:
?\?<??{"type":"openFileStatus","data":{"path":"CameraFiles.zip","streamIdentifier":9,"mode":"r"}}


use mplayer to get the stream
Code: [Select]
$ sudo mplayer tv:// -tv driver=v4l2:device=/dev/video0
MPlayer svn r34540 (Raspbian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: Dummy video device (0x0000)
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = loopback;
 Current input: 0
 Current format: GREY
...
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x562380] using unscaled gray -> yuv420p special converter
VO: [sdl] 160x120 => 160x120 Planar YV12



PS: I have the suspicion that the delay of flir8a.c (frame buffer) is a little bit greater as in the Flir App in mode ThermalLinearFlux14BitImage :-\
« Last Edit: December 17, 2015, 08:17:29 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #88 on: December 17, 2015, 12:40:30 am »
Hi tomas123,
wow that was fast, looks very interesting, I'll be playing with that code over the next few days.
Nice job!!
   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #89 on: December 17, 2015, 12:43:27 am »
only cut and paste  8)

frame buffer works fine, but v4l2 needs some tuning...

the original frame buffer code comes from user tmbinc  :-+
watch his video: https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg626608/#msg626608
and get the code (another resolution): https://www.eevblog.com/forum/testgear/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg736344/#msg736344

please note the great font.h
« Last Edit: December 17, 2015, 12:52:43 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #90 on: December 17, 2015, 11:06:29 pm »
flir8b.c writes the thermal video stream to  /dev/video0 and works better than expected.
Runs since hours rock stable!

here my experiences with a live stream from raspberry pi to my notebook:

start Flir One video grabber on raspberry pi
Code: [Select]
$ sudo modprobe v4l2loopback
$ /usr/bin/gcc '-I/usr/include/libusb-1.0'  -o flir flir8b.c -lusb-1.0 -lm
$ sudo ./flir

start a video server on raspberry pi with avconv and stream /dev/video0 to my notebook with address 192.168.1.42
(parameters yet not adjusted)
Code: [Select]
$ avconv -f video4linux2 -i /dev/video0 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method epzs -b 2600k -bt 256k -f rtp rtp://192.168.1.42:1234
avconv version 9.14-6:9.14-1rpi1rpi1, Copyright (c) 2000-2014 the Libav developers
  built on Jul 22 2014 15:08:12 with gcc 4.6 (Debian 4.6.3-14+rpi1)
[video4linux2 @ 0x1ffc740] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2, from '/dev/video0':
  Duration: N/A, start: 1450392797.097902, bitrate: 4608 kb/s
    Stream #0.0: Video: rawvideo, gray, 160x120, 4608 kb/s, 1000k tbn, 30 tbc
Output #0, rtp, to 'rtp://192.168.1.42:1234':
  Metadata:
    encoder         : Lavf54.20.4
    Stream #0.0: Video: mpeg2video, yuv420p, 160x120, q=2-31, 2600 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
...
Press ctrl-c to stop encoding
frame=23557 fps= 25 q=2.0 size=   14522kB time=942.20 bitrate= 126.3kbits/s   
 

on my notebook:
start VLC and open the stream with
   vlc / open network
Code: [Select]
rtp://@:1234and we get a live stream  8)





my first test with motion http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

our flir device:
Code: [Select]
$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Capture
Pixel Format: 'GREY'
Name        : [GREY]
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)

install motion
Code: [Select]
$ sudo apt-get install motion
edit config file
Code: [Select]
$ sudo nano /etc/motion/motion.conf

# Maximum framerate for webcam streams (default: 1)
webcam_maxrate 10

# Restrict webcam connections to localhost only (default: on)
webcam_localhost off

but we cant select our frame format V4L2_PIX_FMT_GREY in motion.conf  :(
Code: [Select]
# v4l2_palette allows to choose preferable palette to be use by motion
# V4L2_PIX_FMT_SN9C10X : 0  'S910'
# V4L2_PIX_FMT_SBGGR8  : 1  'BA81'
# V4L2_PIX_FMT_MJPEG   : 2  'MJPEG'
# V4L2_PIX_FMT_JPEG    : 3  'JPEG'
# V4L2_PIX_FMT_RGB24   : 4  'RGB3'
# V4L2_PIX_FMT_UYVY    : 5  'UYVY'
# V4L2_PIX_FMT_YUYV    : 6  'YUYV'
# V4L2_PIX_FMT_YUV422P : 7  '422P'
# V4L2_PIX_FMT_YUV420  : 8  'YU12'
v4l2_palette 8

It's possible to convert /dev/video0 with ffmpeg to a compatible frame format and write to next device /dev/video1.
But I think it's better to make the converts in our code (like the current convert for frame buffer to RGB565 16 Bit)   
« Last Edit: December 17, 2015, 11:47:06 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #91 on: December 18, 2015, 01:09:52 am »
tomas123,
I've run this with mplayer and it works as described, every so often I get a noise frame, but it seems to correct itself quickly.

Nice work. this will be the beginning of FlirOne for Linux (maybe MacOSX  and Windoze too)

  ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #92 on: December 18, 2015, 08:56:09 am »
...this will be the beginning of FlirOne for Linux (maybe MacOSX  and Windoze too)

I believe not.
Since last two years I wrote here hundreds of posts about
  • hacking Flir RAW formats (exiftool)
  • Plancks Law
  • calculate temperature from flir radiometric sensor values with Flir calibration values
  • stitch thermal panoramas
  • raw videos and streaming of Flir Ex, Flir Exx  and Flir One 2. gen
  • convert thermal images and videos from another manufacturers (Seek, Opgal) in Flir radiometric jpg / video and open it with Flir Tools for evaluation

... but only half a dozen users are interested in

I've run this with mplayer and it works as described, every so often I get a noise frame, but it seems to correct itself quickly.
Do you mean a FFC frame,  a regular 160x120 frame with a closed shutter ?
Otherwise flir8b.c is until missing a validation of frame size (make only a magic byte check), therefore we have sometimes noise glitches.
But I haven't seen v4l2 sync problems...

please post my a "ls -al" of 1 or 2 minutes EP0x85#00xxx.bin, so I can see how often your system got broken frames
« Last Edit: December 18, 2015, 10:36:35 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #93 on: December 19, 2015, 01:03:27 pm »
Hi cynfab,

I found this nice short source samples on github with lepton drivers on the basis of https://github.com/umlaeute/v4l2loopback :
https://github.com/andrewhodel/flirpi-mjpeg
Quote
"These are miscellaneous utilities that work with the lepton module on the raspberry pi."
a fork of https://github.com/groupgets/LeptonModule/tree/master/software/flirpi

forum: https://groups.google.com/forum/#!topic/flir-lepton/VcdpMY_vcho

the code is for Lepton G1 80x60 connected over SPI
Quote
leptsci.c is the code to access the flir module over SCI and fill an image buffer.
and we fill our image buffer over usb




please post my a "ls -al" of 1 or 2 minutes EP0x85#00xxx.bin, so I can see how often your system got broken frames
;)
« Last Edit: December 19, 2015, 01:17:14 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #94 on: December 19, 2015, 02:01:46 pm »
Hi tomas123,
Looks interesting, I'm tied up all weekend and into next week, so I probably won't get to do anything with the FlirOne till Xmas.

   ...ken...
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #95 on: December 20, 2015, 07:31:11 pm »
Hi tomas123,
I got some some time to fiddle with the flir code and here is a "simplified" version that works pretty well.
With Guvcview it gets almost to 9fps on my i7 linux Mint 17.3 desktop.


   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #96 on: December 20, 2015, 10:29:41 pm »
With Guvcview it gets almost to 9fps on my i7 linux Mint 17.3 desktop.

sorry, my mistake...
Code: [Select]
r = libusb_bulk_transfer(devh, 0x83, buf, sizeof(buf), &actual_length, 100); ...because the "old" code polls permanently the empty EP 0x81 and 0x83 with a timeout of 100ms, therefore we got only a max frame rate of 1000/(2*100)=5 fps

if we set in the old code flir7i.c (write frames to file) the timeout of EP 0x85 to 10ms we get to 9 fps

this is one second and I count 9 thermal frames

$ /usr/bin/gcc -std=c99 '-I/usr/include/libusb-1.0'  -o flir flir7i.c -lusb-1.0 -lm
$ sudo ./flir
...
$ ls -al --time-style=full-iso *0x85*
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.054600840 +0100 #00551-EP0x85.bin
-rw-r--r-- 1 root root  38828 2015-12-20 23:20:34.084600631 +0100 #00552-EP0x85.bin
-rw-r--r-- 1 root root  73008 2015-12-20 23:20:34.114600423 +0100 #00553-EP0x85.bin
-rw-r--r-- 1 root root    167 2015-12-20 23:20:34.144600214 +0100 #00554-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.164600075 +0100 #00555-EP0x85.bin
-rw-r--r-- 1 root root  38828 2015-12-20 23:20:34.194599866 +0100 #00556-EP0x85.bin
-rw-r--r-- 1 root root  73079 2015-12-20 23:20:34.224599657 +0100 #00557-EP0x85.bin
-rw-r--r-- 1 root root  39880 2015-12-20 23:20:34.294599171 +0100 #00558-EP0x85.bin
-rw-r--r-- 1 root root  73415 2015-12-20 23:20:34.324598962 +0100 #00559-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.384598544 +0100 #00560-EP0x85.bin
-rw-r--r-- 1 root root  38828 2015-12-20 23:20:34.414598336 +0100 #00561-EP0x85.bin
-rw-r--r-- 1 root root  73175 2015-12-20 23:20:34.444598127 +0100 #00562-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.514597640 +0100 #00563-EP0x85.bin
-rw-r--r-- 1 root root  38828 2015-12-20 23:20:34.544597432 +0100 #00564-EP0x85.bin
-rw-r--r-- 1 root root  73647 2015-12-20 23:20:34.574597223 +0100 #00565-EP0x85.bin
-rw-r--r-- 1 root root 112768 2015-12-20 23:20:34.644596736 +0100 #00566-EP0x85.bin
-rw-r--r-- 1 root root    167 2015-12-20 23:20:34.664596597 +0100 #00567-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.734596110 +0100 #00568-EP0x85.bin
-rw-r--r-- 1 root root  39852 2015-12-20 23:20:34.764595901 +0100 #00569-EP0x85.bin
-rw-r--r-- 1 root root  73048 2015-12-20 23:20:34.794595693 +0100 #00570-EP0x85.bin
-rw-r--r-- 1 root root    167 2015-12-20 23:20:34.814595553 +0100 #00571-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.844595345 +0100 #00572-EP0x85.bin
-rw-r--r-- 1 root root  39852 2015-12-20 23:20:34.874595136 +0100 #00573-EP0x85.bin
-rw-r--r-- 1 root root  73575 2015-12-20 23:20:34.904594927 +0100 #00574-EP0x85.bin
-rw-r--r-- 1 root root     28 2015-12-20 23:20:34.964594510 +0100 #00575-EP0x85.bin
-rw-r--r-- 1 root root  38828 2015-12-20 23:20:34.994594301 +0100 #00576-EP0x85.bin

it's interesting , with 10ms timeout we get no jumbo frames (header+thermal+visible+status) but rather splittet frames

My next step is to write a pipe and stitch the splittet frames together to a full frame...
« Last Edit: December 20, 2015, 10:35:46 pm by tomas123 »
 

Offline Lord of nothing

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: at
Re: Question about FLIR One for Android
« Reply #97 on: December 22, 2015, 12:03:09 am »
Its possible to search for Animals in the Woods with the Cam?
I know the resolution is very low.  :-+
Made in Japan, destroyed in Sulz im Wienerwald.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #98 on: December 22, 2015, 11:19:07 pm »
@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:
Code: [Select]
$ /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
Code: [Select]
// 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:
Code: [Select]
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).
Code: [Select]
{"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!
« Last Edit: December 22, 2015, 11:59:10 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #99 on: December 23, 2015, 01:58:17 am »
Hi tomas123,
Yep, I removed the framebuffer code. That's because my current target is to stream the thermal and visible images from a headless embedded processor.
Here is a video I captured with Guvcview. Encoding is MPEG 1 so the pixels are a bit fuzzy.

Just remove the .txt and play it with totem on Linux.

I'll try our your new code asap.....Maybe tomorrow... lots of snow here, need to plow the driveway again... and again... and again........

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #100 on: December 26, 2015, 07:55:15 pm »
I saw, there is a typo in line 245 of file flir8f.c.

changed
Code: [Select]
   write(fdwr1, &buf[28+ThermalSize], JpgSize);to
Code: [Select]
   write(fdwr1, &buf85[28+ThermalSize], JpgSize);

edit
... and a memory leak  >:(
Code: [Select]
  // write video to v4l2loopback
   write(fdwr0, fb_proc, framesize0);
   write(fdwr1, &buf85[28+ThermalSize], JpgSize);
   
   free(fb_proc);
« Last Edit: December 28, 2015, 11:11:16 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #101 on: December 29, 2015, 01:41:37 am »
Hi tomas123,
This looks really good, better than my last effort that just hoped to get a full frame.
Have you had any luck getting video1 to stream the visual jpg data?
I've poked at it and still have no clue as to what it should do. The v4l2 api is very dense reading. :( and I am struggling with trying to understand what I need to do.
But, it looks like things are progressing.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #102 on: December 29, 2015, 04:43:54 pm »
Have you had any luck getting video1 to stream the visual jpg data?

Yes, my last code (found typo buff85 and the memory leak) runs since two days without errors on /dev/video0 and /dev/video1 on my raspberry pi.

after 1.309.405 frames with 8,2 fps:
(1.309.405/8,2/3600=44 hours)

Code: [Select]
#1309405 82/10 fps:{"shutterState":"ON","shutterTemperature":311.869995117188,"usbNotifiedTimestamp":1176080489.24421,"usbEnqueuedTimestamp":1176080489.24568,"ffcState":"FFC_VALID_RAD"}
#1309406 83/10 fps:{"shutterState":"ON","shutterTemperature":311.869995117188,"usbNotifiedTimestamp":1176080489.35792,"usbEnqueuedTimestamp":1176080489.35936,"ffcState":"FFC_VALID_RAD"}
#1309407 82/10 fps:{"shutterState":"ON","shutterTemperature":311.880004882812,"usbNotifiedTimestamp":1176080489.4717,"usbEnqueuedTimestamp":1176080489.47328,"ffcState":"FFC_VALID_RAD"}
#1309408 82/10 fps:{"shutterState":"ON","shutterTemperature":311.880004882812,"usbNotifiedTimestamp":1176080489.5864,"usbEnqueuedTimestamp":1176080489.58808,"ffcState":"FFC_VALID_RAD"}
#1309409 82/10 fps:{"shutterState":"ON","shutterTemperature":311.880004882812,"usbNotifiedTimestamp":1176080489.70209,"usbEnqueuedTimestamp":1176080489.70338,"ffcState":"FFC_VALID_RAD"}

With Guvcview I can view both videos simultaneously with perfect quality (no drops and artefacts etc).
Can you exact describe your problems with /dev/video1 ?

My next step is to send both video (thermal/real) with RTSP streaming (ffmpeg) to a Synology surveillance station ...


edit:

Do you remember, how many time I wasted on the wrong system (Linux VM, OS X)?
Apparently the FlirOne G2 USB connection is tricky...
 
I played around with some time outs and found this as the best solution for my raspberry pi:
Code: [Select]
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.

if you see in the terminal this correct status string, then you know, that all chunks are correct stitched to a full frame without loosing bytes
(the status string is the end of a full frame)
Code: [Select]
#1309405 82/10 fps:{"shutterState":"ON","shutterTemperature":311.869995117188,"usbNotifiedTimestamp":1176080489.24421,"usbEnqueuedTimestamp":1176080489.24568,"ffcState":"FFC_VALID_RAD"}
« Last Edit: December 29, 2015, 05:32:14 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #103 on: December 29, 2015, 05:35:10 pm »
Hi tomas123,
I start the videoloopback module like this:

sudo modprobe v4l2loopback exclusive_caps=0,0 video_nr=0,1

then run flir8g, then guvcview.
THis then displays the thermal image.
I then go to video controls and select device 1.
Guvcview then gives an error that it can't start a video stream on that device... see attached screenshot.

I can certainly believe that the F1G2 USB is odd as I have continuous problems on Android with various apps not being able to claim the usb interface.
I believe all the chunks are being stiched as the screenshot shows the terminal output.

   ...ken...
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #104 on: December 29, 2015, 06:13:21 pm »
And, this is what I get with mplayer...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #105 on: December 30, 2015, 12:06:15 am »
hm, my mplayer also works fine

after first 400 frames (ignore the warnings):
Code: [Select]
$ mplayer tv:// -tv driver=v4l2:device=/dev/video1
MPlayer svn r34540 (Raspbian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: Dummy video device (0x0001)
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = loopback;
 Current input: 0
 Current format: MJPEG
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Inappropriate ioctl for device
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
Xlib:  extension "XFree86-VidModeExtension" missing on display "localhost:10.0".
[VO_XV] It seems there is no Xvideo support for your video card available.
[VO_XV] Run 'xvinfo' to verify its Xv support and read
[VO_XV] DOCS/HTML/en/video.html#xv!
[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.
[VO_XV] Try -vo x11.
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [gl_nosw] 640x480 => 640x480 Planar 422P
V:   0.0 399/399 ??% ??% ??,?% 0 0


Your screenshot shows bugless "full frames", therefore our code works fine.
It's possible, that you have trouble with your v4l2 drivers.

Please post your output from this commands:
Code: [Select]
$ ls -al /dev/video*
$ v4l2-ctl --list-devices
$ v4l2-ctl --all -d /dev/video0
$ v4l2-ctl --all -d /dev/video1

compare with my result
Code: [Select]
pi@raspberryLCD ~ $ ls -al /dev/video*
crw-rw---T+ 1 root video 81, 0 Dec 27 13:12 /dev/video0
crw-rw---T+ 1 root video 81, 1 Dec 27 13:12 /dev/video1

pi@raspberryLCD ~ $ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video0

Dummy video device (0x0001) (platform:v4l2loopback-001):
/dev/video1

pi@raspberryLCD ~ $ v4l2-ctl --all -d /dev/video0
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0000)
Bus info      : platform:v4l2loopback-000
Driver version: 3.18.13
Capabilities  : 0x85208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Video input : 0 (loopback: ok)
Format Video Capture:
Width/Height  : 160/120
Pixel Format  : 'GREY'
Field         : None
Bytes per Line: 160
Size Image    : 19200
Colorspace    : SRGB
Custom Info   : feedcafe
Format Video Output:
Width/Height  : 160/120
Pixel Format  : 'GREY'
Field         : None
Bytes per Line: 160
Size Image    : 19200
Colorspace    : SRGB
Custom Info   : feedcafe
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers    : 8

User Controls

                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0

pi@raspberryLCD ~ $ v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0001)
Bus info      : platform:v4l2loopback-001
Driver version: 3.18.13
Capabilities  : 0x85208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Video input : 0 (loopback: ok)
Format Video Capture:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Format Video Output:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers    : 8

User Controls

                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0
« Last Edit: December 30, 2015, 12:35:29 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #106 on: December 30, 2015, 12:31:48 am »
there are some interesting differences between our mplayer output lines

my mplayer:
Code: [Select]
Current format: MJPEG
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
...
VO: [gl_nosw] 640x480 => 640x480 Planar 422P

your mplayer shows another video format
Code: [Select]
Current format: BGR32
Opening video decoder: [raw] RAW uncompressed video
...
VO: [vdpau] 640x480 => 640x480 Planar YV12

maybe, there is a another video driver on your system
reboot, check it and try to write to another port (like video2) or change in our code video0<->video1


PS: another difference:
please note, you must load v4l2loopback with /dev/video0 and /dev/video1
Code: [Select]
// 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

Why do you needs the switch "exclusive_caps"?
I start the videoloopback module like this:

sudo modprobe v4l2loopback exclusive_caps=0,0 video_nr=0,1

https://github.com/umlaeute/v4l2loopback/blob/master/NEWS
Quote
v4l2loopback-0.7.0

  - experimental'exclusive_caps' mode that only reports CAPTURE/OUTPUT
    capabilities exclusively (support for Chromium/WebRTC)
see also https://github.com/umlaeute/v4l2loopback/issues/78
« Last Edit: December 30, 2015, 12:50:17 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #107 on: December 30, 2015, 01:29:12 am »
Hi tomas123,

Well, there are quite a few differences between our v4l2loopback stuff.

Code: [Select]
kenm@kenm-Studio-XPS-8000 ~/FLIR_ONE/thomas123/New_test/v4l $ ls -al /dev/video*
crw-rw----+ 1 root video 81, 0 Dec 29 10:44 /dev/video0
crw-rw----+ 1 root video 81, 1 Dec 29 10:44 /dev/video1
kenm@kenm-Studio-XPS-8000 ~/FLIR_ONE/thomas123/New_test/v4l $ v4l2-ctl --list-devices
Dummy video device (0x0000) (v4l2loopback:0):
/dev/video0

Dummy video device (0x0001) (v4l2loopback:1):
/dev/video1

kenm@kenm-Studio-XPS-8000 ~/FLIR_ONE/thomas123/New_test/v4l $ v4l2-ctl --all -d /dev/video0
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0000)
Bus info      : v4l2loopback:0
Driver version: 0.8.0
Capabilities  : 0x05000002
Video Output
Read/Write
Streaming
Video output: 0 (loopback in)
Format Video Output:
Width/Height  : 160/120
Pixel Format  : 'GREY'
Field         : None
Bytes per Line: 160
Size Image    : 19200
Colorspace    : SRGB
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers    : 8
                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0
kenm@kenm-Studio-XPS-8000 ~/FLIR_ONE/thomas123/New_test/v4l $  v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0001)
Bus info      : v4l2loopback:1
Driver version: 0.8.0
Capabilities  : 0x05000003
Video Capture
Video Output
Read/Write
Streaming
Video input : 0 (loopback: ok)
Video output: 0 (loopback in)
Format Video Capture:
Width/Height  : 640/480
Pixel Format  : 'BGR4'
Field         : None
Bytes per Line: 2560
Size Image    : 1228800
Colorspace    : SRGB
Format Video Output:
Width/Height  : 640/480
Pixel Format  : 'BGR4'
Field         : None
Bytes per Line: 2560
Size Image    : 1228800
Colorspace    : SRGB
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers    : 8
                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0

So it looks like maybe this is a versioning problem, because I am using what comes with Linux Mint17.3 and you are maybe using something compiled from source or at least a more recent version.

I think I'll try getting v4l2loopback from github and replace what comes with Mint17.3.

I've tried using /dev/video2 and it makes no difference.
I've tried with and without  "exclusive_caps", and it makes no difference.

"Driver version: 3.18.13"
vs my:
"Driver version: 0.8.0"
worries me.

As does my:
Current format: BGR32

   ...ken...

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #108 on: December 30, 2015, 02:10:10 am »
my suggest:

try to write the real video to /dev/video0 and thermal to /dev/video1 and see what happens
Code: [Select]
#define VIDEO_DEVICE0 "/dev/video1"
#define FRAME_WIDTH0  160
#define FRAME_HEIGHT0 120

#define VIDEO_DEVICE1 "/dev/video0"
#define FRAME_WIDTH1  640
#define FRAME_HEIGHT1 480

because we write
Code: [Select]
#define FRAME_FORMAT1 V4L2_PIX_FMT_MJPEGand you get
Code: [Select]
Pixel Format  : 'BGR4'instead
Code: [Select]
Pixel Format  : 'MJPG'

BGR4 = V4L2_PIX_FMT_BGR32



version 3.18.13 looks like my kernel version on raspberry   :-\
Code: [Select]
$ v4l2-ctl --info
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0000)
Bus info      : platform:v4l2loopback-000
Driver version: 3.18.13
Capabilities  : 0x85208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming

Code: [Select]
$ uname -a
Linux raspberryLCD 3.18.13-v7+ #784 SMP PREEMPT Sat May 9 15:57:36 BST 2015 armv7l GNU/Linux

I posted my installations steps here:

the next steps for installing v4l2loopback are simple
Code: [Select]
$ uname -a
Linux raspberryLCD 3.18.0-trunk-rpi2 #1 SMP PREEMPT Debian 3.18.5-1~exp1+rpi19 (2015-08-08) armv7l GNU/Linux

$ git clone https://github.com/umlaeute/v4l2loopback

$ cd v4l2loopback

$ make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback/v4l2loopback modules
make[1]: Entering directory '/usr/src/linux-headers-3.18.0-trunk-rpi2'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
  CC [M]  /home/pi/v4l2loopback/v4l2loopback/v4l2loopback.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/v4l2loopback/v4l2loopback/v4l2loopback.mod.o
  LD [M]  /home/pi/v4l2loopback/v4l2loopback/v4l2loopback.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.18.0-trunk-rpi2'

$ sudo su

# make install
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback/v4l2loopback modules_install
make[1]: Entering directory '/usr/src/linux-headers-3.18.0-trunk-rpi2'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
  INSTALL /home/pi/v4l2loopback/v4l2loopback/v4l2loopback.ko
  DEPMOD  3.18.0-trunk-rpi2
make[1]: Leaving directory '/usr/src/linux-headers-3.18.0-trunk-rpi2'
depmod -a  `uname -r`

$ sudo modprobe v4l2loopback

$ lsmod
Module                  Size  Used by
v4l2loopback           23372  0

...

« Last Edit: December 30, 2015, 02:31:21 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #109 on: December 30, 2015, 02:34:19 am »
Just changing

Code: [Select]
#define VIDEO_DEVICE0 "/dev/video1"
#define FRAME_WIDTH0  160
#define FRAME_HEIGHT0 120

#define VIDEO_DEVICE1 "/dev/video0"
#define FRAME_WIDTH1  640
#define FRAME_HEIGHT1 480

 video1 is recognized by Guvcview and mplayer displays the thermal image, video0 is garbage


...disregard the below screenshot...
« Last Edit: December 30, 2015, 02:41:28 am by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #110 on: December 30, 2015, 02:50:14 pm »
Hi cynfab,

2 hours work:
I installed a Linux Mint Image on a clean notebook and note all steps  ;)

(for another readers: Linux Mint as a Ubuntu fork)


$ uname -a
Linux mint-Lenovo-B50-70 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ inxi -S
System:    Host: mint-Lenovo-B50-70 Kernel: 3.19.0-32-generic x86_64 (64 bit) Desktop: N/A
           Distro: Linux Mint 17.3 Rosa

$ sudo apt-get install g++

// check pre-installed libusb versions
$ dpkg --get-selections | grep libusb
libusb-0.1-4:amd64install
libusb-1.0-0:amd64install
libusb-1.0-0:i386install
libusbmuxd2install

// we need the header file libusb.h
$ sudo apt-get install libusb-1.0-0-dev

// check the path of libusb.h for gcc command line below
$ find / -name libusb.h 2>/dev/zero
/usr/include/libusb-1.0/libusb.h

// I see my notebook webcam as device video0
$ ls /dev/video*
/dev/video0

// there is no v4l2loopback driver installed on clean Linux Mint
$ lsmod | grep v4l2
v4l2_common            16384  1 videobuf2_core
videodev              159744  3 uvcvideo,v4l2_common,videobuf2_core

$ sudo modprobe v4l2loopback
modprobe: FATAL: Module v4l2loopback not found.

// therefore me must compile the driver for our kernel
// first load kernel sources (try to skip this step)
$ sudo apt-get install linux-generic

// 271 MB later: I think this was to much.
// Better load only the kernel headers (as part of the packet linux-generic)
$ sudo apt-get install linux-headers-generic

// try to compile v4l2loopback with packet manager (skip this step)
$ sudo apt-get install v4l2loopback-dkms
...
Building initial module for 3.19.0-32-generic
Error! Bad return status for module build on kernel: 3.19.0-32-generic (x86_64)
Consult /var/lib/dkms/v4l2loopback/0.8.0/build/make.log for more information.

// Argh! We got an Error!!
$ cat /var/lib/dkms/v4l2loopback/0.8.0/build/make.log
..
/var/lib/dkms/v4l2loopback/0.8.0/build/v4l2loopback.c:486:2: error: implicit declaration of function ‘strict_strtoul’ [-Werror=implicit-function-declaration]
  if (strict_strtoul(buf, 0, &curr))
  ^
...
make: *** [v4l2loopback.ko] Error 2

// first remove the broken packet v4l2loopback-dkms...
$ sudo apt-get remove v4l2loopback-dkms
...
Entfernen von v4l2loopback-dkms (0.8.0-1) ...
------------------------------
Deleting module version: 0.8.0
completely from the DKMS tree.
------------------------------

// ... then do it yourself
$ sudo apt-get install git

$ git clone https://github.com/umlaeute/v4l2loopback

$ cd v4l2loopback/

$ make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/mint/Desktop/flir/v4l2loopback modules
make[1]: Verzeichnis »/usr/src/linux-headers-3.19.0-32-generic« wird betreten
  CC [M]  /home/mint/Desktop/flir/v4l2loopback/v4l2loopback.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/mint/Desktop/flir/v4l2loopback/v4l2loopback.mod.o
  LD [M]  /home/mint/Desktop/flir/v4l2loopback/v4l2loopback.ko

$ sudo make install
make -C /lib/modules/`uname -r`/build M=/home/mint/Desktop/flir/v4l2loopback modules_install
  INSTALL /home/mint/Desktop/flir/v4l2loopback/v4l2loopback.ko

// now load video1 and video2 (because my notebook cam is video0)
$ sudo modprobe v4l2loopback video_nr=1,2

// check it - all works fine
$ ls /dev/video*
/dev/video0  /dev/video1  /dev/video2

// edit /dev/video? in  flir8g-mint.c
#define VIDEO_DEVICE0 "/dev/video1"
#define FRAME_WIDTH0  160
#define FRAME_HEIGHT0 120

#define VIDEO_DEVICE1 "/dev/video2"
#define FRAME_WIDTH1  640
#define FRAME_HEIGHT1 480

// compile flir8g-mint.c from attachment
$ /usr/bin/gcc '-I/usr/include/libusb-1.0'  -o flir1 flir8g-mint.c -lusb-1.0 -lm

// and run the code
$ sudo ./flir
...
#000037 68/10 fps:{"shutterState":"ON","shutterTemperature":294.489990234375,"usbNotifiedTimestamp":1176135054.68748,"usbEnqueuedTimestamp":1176135054.68923,"ffcState":"FFC_RAD_APPROX"}
#000038 71/10 fps:{"shutterState":"ON","shutterTemperature":294.489990234375,"usbNotifiedTimestamp":1176135054.8017,"usbEnqueuedTimestamp":1176135054.80321,"ffcState":"FFC_RAD_APPROX"}
#000039 70/10 fps:{"shutterState":"ON","shutterTemperature":294.489990234375,"usbNotifiedTimestamp":1176135054.91573,"usbEnqueuedTimestamp":1176135054.91749,"ffcState":"FFC_RAD_APPROX"}
...

// another session
$ sudo apt-get install v4l-utils

$ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video1

Dummy video device (0x0001) (platform:v4l2loopback-001):
/dev/video2

Lenovo EasyCamera (usb-0000:00:14.0-6):
/dev/video0

// check correct formats
$ v4l2-ctl --list-formats-out -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Output
Pixel Format: 'GREY'
Name        : 8 bpp, Greyscale

$ v4l2-ctl --list-formats-out -d /dev/video2
ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Output
Pixel Format: 'MJPG'
Name        : Motion-JPEG

// install guvcview and mplayer
$ sudo apt-get install guvcview
$ sudo apt-get install mplayer


... and all works fine:


only for comparing the "Driver version":
Code: [Select]
$ v4l2-ctl --all -d /dev/video2
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0001)
Bus info      : platform:v4l2loopback-001
Driver version: 3.19.8
Capabilities  : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Video input : 0 (loopback: ok)
Video output: 0 (loopback in)
Format Video Capture:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Format Video Output:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers    : 8

User Controls

                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0
« Last Edit: December 30, 2015, 03:25:58 pm by tomas123 »
 
The following users thanked this post: Niels2

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #111 on: December 30, 2015, 03:06:19 pm »
Hi tomas123,
Nice job detailing all of that.

I believe that the issue I am having is the old version of v4l2loopback that comes with Mint17.3's v4l2loopback-dkms.
I'll get a chance to rebuild it later this morning.
I've got to deal with another 3-4" of new snow, so thermal imaging will have to wait a bit :)

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #112 on: December 30, 2015, 03:15:11 pm »
I was to curios about your error and thought that it's faster to try it self as write dozen posts in my broken english  :-+

Don't forget to clean your driver:

Code: [Select]
$ dpkg --get-selections | grep v4l2
$ sudo apt-get remove v4l2loopback-dkms


« Last Edit: December 30, 2015, 03:16:54 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #113 on: December 30, 2015, 05:09:55 pm »
Thanks,
I cleaned out the old v4l2loopback, but am having issues compiling the new one.
With just a plain make, somehow it thinks I want to cross compile for arm. |O
Just updated the kernel to 3.19.0-32, but that made no difference,

Code: [Select]
make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/kenm/FLIR_ONE/thomas123/v4l2loopback modules
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-32-generic'
  CC [M]  /home/kenm/FLIR_ONE/thomas123/v4l2loopback/v4l2loopback.o
In file included from include/asm-generic/int-ll64.h:10:0,
                 from ./arch/arm/include/asm/types.h:4,
                 from include/uapi/linux/types.h:4,
                 from include/linux/compiler.h:189,
                 from include/linux/linkage.h:4,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/vmalloc.h:4,
                 from /home/kenm/FLIR_ONE/thomas123/v4l2loopback/v4l2loopback.c:17:
include/uapi/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory
compilation terminated.

It's just one of those days.....

   ...ken...

|O
NOOB mistake... had something set in .profile ARCH=arm |O

And now flir8g works perfectly!!

« Last Edit: December 30, 2015, 05:25:21 pm by cynfab »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #114 on: December 30, 2015, 06:42:46 pm »
Nice work guys

RESPECT 👍
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #115 on: December 31, 2015, 01:44:15 am »
Hi tomas123,

For your thermal imaging pleasure, a version that does 3 video streams,
one is greyscale thermal
another is visual
and the third is a colorized version of the thermal image.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #116 on: January 02, 2016, 01:17:38 am »
Hi cynfab,

your lookup table works great.
But first edit your memory leak by freeing fb_proc2.
(Watch the growing virtual memory of process flir8h with top.)

flir8h.c 
Code: [Select]
...
326:   free(fb_proc);
327:   free(fb_proc2);
...


... but we cant select our frame format V4L2_PIX_FMT_GREY in motion.conf  :(
As nice side effect, we have now a V4L2 thermal stream, which motion can process.
http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

$ make
gcc -I/usr/include/libusb-1.0    -c -o flir8h.o flir8h.c
gcc -I/usr/include/libusb-1.0 -o flir8h Palettes.o flir8h.o -lusb-1.0 -lm -Wall

$ sudo ./flir8h

// install motion
$ sudo apt-get install motion

// edit config file
$ sudo nano /etc/motion/motion.conf

Code: [Select]
# Maximum framerate for webcam streams (default: 1)
webcam_maxrate 10

# Restrict webcam connections to localhost only (default: on)
webcam_localhost off

# thread config files.
thread /usr/local/etc/thread1.conf
thread /usr/local/etc/thread2.conf
; thread /usr/local/etc/thread3.conf
; thread /usr/local/etc/thread4.conf

// create two additional config files for /dev/video2 and /dev/video3
Code: [Select]
$ cat /usr/local/etc/thread1.conf
# V4L2_PIX_FMT_MJPEG   : 2  'MJPEG'
# V4L2_PIX_FMT_JPEG    : 3  'JPEG'
# V4L2_PIX_FMT_RGB24   : 4  'RGB3'
v4l2_palette 2
videodevice /dev/video2
target_dir /tmp/motion2
webcam_port 8081

$ cat /usr/local/etc/thread2.conf
# V4L2_PIX_FMT_MJPEG   : 2  'MJPEG'
# V4L2_PIX_FMT_JPEG    : 3  'JPEG'
# V4L2_PIX_FMT_RGB
v4l2_palette 4
videodevice /dev/video3
target_dir /tmp/motion3
webcam_port 8082

install apache2 and create a simple html file
(192.168.1.70 is the ip address from my raspberry pi)
Code: [Select]
$ cat /var/www/index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
text-align:center;
background-color:#000000;
}
.container {
width:100%;
}
.motion1 {
border: 0;
width: 40%;
height: auto;
}
.motion2 {
border: 0;
width: 40%;
height: auto;
}
.clear {
clear:both;
}
</style>
</head>
<body>
<a href="http://192.168.1.70:8081"><img class="motion1" src="http://192.168.1.70:8081" /></a>

<a href="http://192.168.1.70:8082"><img class="motion2" src="http://192.168.1.70:8082" /></a>
</body>
</html>

open URL of server in a browser
« Last Edit: January 02, 2016, 01:22:54 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #117 on: January 02, 2016, 04:41:40 am »
Hi tomas123,
Happy New Year....
Yep, I found and fixed the memory leak soon after my last post.

The motion stuff is cool, gotta find some time to play with it.
But, I need a way to combine the visual and thermal images as in your attachment but I don't need motion detection, just the side by side display.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #118 on: January 02, 2016, 12:04:14 pm »
Hi cynfab,

A Happy New Year from non snowy Germany ;)

I don't need motion detection, just the side by side display.

I tested last days some streaming tools for V4L2.
A good entry point are this samples:
https://github.com/umlaeute/v4l2loopback/wiki
For the side by side display you can use the html template from my last post.

Here are my raw notes. All samples for our mjpeg stream /dev/video2:



MJPG-Streamer works great on Raspberry Pi and requires only 2% of CPU, because this tool only move the jpeg image without decoding/encoding.

installation guide
http://www.steinvoorte.nl/mjpgstreamer/index.php?page=2

install
Code: [Select]
$ sudo apt-get install libjpeg8-dev imagemagick subversion libv4l-dev

$ ls /usr/include/linux/videodev*
/usr/include/linux/videodev2.h

$ sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip

$ unzip mjpg-streamer-code-182.zip

$ cd mjpg-streamer-code-182/mjpg-streamer

// select required plugin (i.e. input_file.so)
$ make USE_LIBV4L2=true mjpg_streamer input_uvc.so  output_http.so

// install (note, that apache2 use /var/www )
$ sudo cp -R www /usr/local/www
$ sudo cp mjpg_streamer /usr/local/bin
$ sudo cp output_http.so  input_uvc.so /usr/local/lib/

start (note LD_LIBRARY_PATH to input_uvc.so)
Code: [Select]
$ export LD_LIBRARY_PATH=/usr/local/lib
$ mjpg_streamer -i "input_uvc.so -d /dev/video2" -o "output_http.so -w /usr/local/www"
 i: Using V4L2 device.: /dev/video2
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
...
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

open the stream on a second Notebook
with GUI:  http://192.168.1.70:8080
Stream only: http://192.168.1.70:8080/?action=stream

unfortunately mjpg_streamer only eats mjpeg and not RGB24 /dev/video3



fswebcam is a nice tool for create (single) images with timestamps etc. from a V4L2 device

http://manpages.ubuntu.com/manpages/lucid/man1/fswebcam.1.html
Code: [Select]
$ sudo apt-get install fswebcam

$ fswebcam --device /dev/video3 1.jpg
--- Opening /dev/video3...
Trying source module v4l2...
/dev/video3 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 160x120.
--- Capturing frame...
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to '1.jpg'.
result:


Nice for a web site with a periodic refresh
Code: [Select]
<META HTTP-EQUIV="refresh" CONTENT="15">
more complex example:
Code: [Select]
fswebcam -D 3 -S 10 -F 10 -r 1280x720 -d /dev/video0 \  --font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf:12" \  --title "Kamera 1" --subtitle "Hallo World" \  --timestamp "%d.%m.%Y %H:%M" --info "info" $FILE


avconv / ffmpeg

my sample is for avconv
http://libav.org/avconv.html

Code: [Select]
sudo apt-get install libav-tools

CPU consumption on raspberry pi (top)
VGA 640x480 150% CPU
gray 160x120 25% CPU

ffmpeg/avconv can't work as really server but you can stream to a device (my notebook is 192.168.1.42):
Code: [Select]
$ avconv -f video4linux2 -i /dev/video2 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method epzs -b 2600k -bt 256k -f rtp rtp://192.168.1.42:1234
avconv version 9.14-6:9.14-1rpi1rpi1, Copyright (c) 2000-2014 the Libav developers
  built on Jul 22 2014 15:08:12 with gcc 4.6 (Debian 4.6.3-14+rpi1)
[video4linux2 @ 0xdc3740] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2, from '/dev/video2':
  Duration: N/A, start: 1451736986.645583, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 0 kb/s, 1000k tbn, 5 tbc
Output #0, rtp, to 'rtp://192.168.1.42:1234':
  Metadata:
    encoder         : Lavf54.20.4
    Stream #0.0: Video: mpeg2video, yuv420p, 640x480, q=2-31, 2600 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> mpeg2video)
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 192.168.1.42
t=0 0
a=tool:libavformat 54.20.4
m=video 1234 RTP/AVP 32
b=AS:2600

Press ctrl-c to stop encoding
frame=  437 fps= 24 q=4.2 size=    5613kB time=17.40 bitrate=2642.5kbits/s   

on client 192.168.1.42 open the stream on localhost ;-)
Code: [Select]
vlc / open network 
     rtp://@:1234


With VLC I received not good results.

Code: [Select]
$ cvlc v4l2:// :v4l2-dev=/dev/video2 :v4l2-width=640 :v4l2-height=480 --sout '#transcode{vcodec=mp4v,vb=128}:rtp{sdp=rtsp://:8554/live.ts}"' -I dummy
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x845c40] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[0x845c40] main interface error: no suitable interface module
[0x74e00a28] main interface error: no suitable interface module
[0x6d98f0] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x8495f0] dummy interface: using the dummy interface module...
[mpeg4 @ 0x730f80] removing common factors from framerate
[mjpeg @ 0x71ba20] error count: 65
[mjpeg @ 0x71ba20] error y=8 x=4
[mjpeg @ 0x71ba20] error count: 64
[mjpeg @ 0x71ba20] error y=10 x=29
[mjpeg @ 0x71ba20] mjpeg: unsupported coding type (c9)
[mjpeg @ 0x71ba20] error count: 66
[mjpeg @ 0x71ba20] error y=19 x=32
[mjpeg @ 0x71ba20] error count: 65
[mjpeg @ 0x71ba20] error y=20 x=31
[mjpeg @ 0x71ba20] only 8 bits/component accepted
[mpeg4 @ 0x7095a0] removing common factors from framerate
[mjpeg @ 0x71ba20] No JPEG data found in image
[mjpeg @ 0x71ba20] No JPEG data found in image

There is also the known feature/error
Code: [Select]
VLC is not supposed to be run as root. Sorry.
« Last Edit: January 02, 2016, 12:29:24 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #119 on: January 02, 2016, 03:10:33 pm »
Hi tomas123,
Thanks for the pointers,
I've used MJPG-Streamer on an NSLU2 for a long time  thanks to this site:

https://johnarthur.wordpress.com/2008/03/25/a-high-resolution-ip-webcam/

VLC is somewhat overkill as is ffmpeg, as they are both doing decode --> encode which gobbles up CPU cycles.
I have a pcduino nano lite which uses an Allwinner A20 as my current test system, but a single core iMX6 is the actual target. No local display though.
I guess I really need to get an iMX6 board to test with :P

   ...ken...
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #120 on: January 03, 2016, 06:07:29 pm »
Hi tomasw123,
Check this out:

https://github.com/ccrisan/motioneyeos/wiki

It is motion based, I have it running on a RPi orig B with a UVC webcam, it seems a bit slow, but the RPi is a real dog....

I'd bet they would be interested in integrating the flir8h driver... :)

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #121 on: January 03, 2016, 09:05:46 pm »
I know this project ;-)
and I hope that Flir sells more F1 to the community.

I've used MJPG-Streamer on an NSLU2 for a long time
My concept was, to start the mjpg_streamer for /dev/video2 and /dev/video3 and place the two streams side by side on a web front end.
As I wrote before, mjpg_streamer only accepts mjpeg and YUV streams as input.

For inspiration as attachment a new version which writes the colorized RGB Thermal Image as MJPEG to /dev/video3
It needs the libjpeg library with libjpeg-dev (my path is /usr/include/jpeglib.h).
Code: [Select]
$ sudo apt-get install  libjpeg-dev
The code works fine...
Code: [Select]
$ make
gcc -I/usr/include/libusb-1.0 -o flir8i Palettes.o flir8i.o -lusb-1.0 -ljpeg -lm -Wall

$ sudo ./flir8i
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
using output device: /dev/video1
     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   =20480
     vid_format->fmt.pix.field       =1
     vid_format->fmt.pix.bytesperline=160
     vid_format->fmt.pix.colorspace  =8
using output device: /dev/video2
     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
using output device: /dev/video3
     vid_format->type                =2
     vid_format->fmt.pix.width       =160
     vid_format->fmt.pix.height      =120
     vid_format->fmt.pix.pixelformat =1196444237
     vid_format->fmt.pix.sizeimage   =77824
     vid_format->fmt.pix.field       =1
     vid_format->fmt.pix.bytesperline=0
     vid_format->fmt.pix.colorspace  =8

... with gucview and mplayer:
Quote
$ mplayer tv:// -tv driver=v4l2:device=/dev/video3
MPlayer svn r34540 (Raspbian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: Dummy video device (0x0003)
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = loopback;
 Current input: 0
Current format: MJPEG
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [gl_nosw] 160x120 => 160x120 Planar YV12
V:   0.0 278/278 ??% ??% ??,?% 0 0

But unfortunately mjpg_streamer has a problem with a mjpeg stream 160x120.
I don't know why.
Quote
$ export LD_LIBRARY_PATH=/usr/local/lib

$ mjpg_streamer -i "input_uvc.so -d /dev/video3 -r 160x120" -o "output_http.so -w /usr/local/www"
MJPG Streamer Version: svn rev: Unversioned directory
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 160 x 120
 i: Frames Per Second.: 5
i: Format............: MJPEG
...
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
*** glibc detected *** mjpg_streamer: free(): invalid next size (normal): 0x01258910 ***
Aborted

with MJPEG on /dev/video2 it works fine
Code: [Select]
$ mjpg_streamer -i "input_uvc.so -d /dev/video2" -o "output_http.so -w /usr/local/www"
MJPG Streamer Version: svn rev: Unversioned directory
 i: Using V4L2 device.: /dev/video2
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
...
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled



PS: flir8i1.c is a working copy, which writes all colorized thermal frames as JPEGs to file with format #012345.jpg
« Last Edit: January 06, 2016, 10:20:50 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #122 on: January 03, 2016, 10:09:48 pm »
tomas123,
When I display the colorized jpeg stream with guvcview, the color palette is messed up. could this be part of the problem with mpeg-streamer?

But when I change the guvcview vid controls to RGB3 the colors are ok. Hmmmm..

   ...ken...
« Last Edit: January 03, 2016, 10:51:14 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #123 on: January 04, 2016, 09:11:02 am »
When I display the colorized jpeg stream with guvcview, the color palette is messed up. could this be part of the problem with mpeg-streamer?
do you mean with guvcview on /dev/video3
-  flir8h with RGB24 (=RGB3)
- or flir8i with MJPEG ?

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #124 on: January 04, 2016, 03:05:48 pm »
I believe it was a cockpit problem, I had the guvcview color controls set to MJPEG for /dev/video3 and the resulting stream was green. I changed it to RGB3 and it was ok.
This was flir8i streaming a mjpeg stream on /dev/video3.
« Last Edit: January 04, 2016, 03:08:02 pm by cynfab »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #125 on: January 04, 2016, 11:39:54 pm »
I can't confirm that.
On my raspberry pi guvcview color controls is automatic set to MJPEG for /dev/video2 and /dev/video3 and all works fine  :-//

flir8i2.c (see attachment) writes all jpg frames for /dev/video2 and /dev/video3 to file

the only ones differences I found in the .jpg files was the subsampling (v2=/dev/video2 and v3=/dev/video3)
Code: [Select]
$ exiftool -YCb* \#0000010-v*.jpg
======== #0000010-v2.jpg
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
======== #0000010-v3.jpg
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
    2 image files read
both subsamplings are valid for MJPEG
but nevertheless I changed the code for libjpeg at line 353 for YCbCr4:2:2 subsampling   
Code: [Select]
    // 4:2:2 (2x1 1x1 1x1) - CrH 50% - CbH 50% - CrV 100% - CbV 100%
    cinfo.comp_info[0].h_samp_factor = 2; // Y
    cinfo.comp_info[0].v_samp_factor = 1;
    cinfo.comp_info[1].h_samp_factor = 1; // Cb
    cinfo.comp_info[1].v_samp_factor = 1;
    cinfo.comp_info[2].h_samp_factor = 1; // Cr
    cinfo.comp_info[2].v_samp_factor = 1;

Now I can't see a difference.
Quote
$ exiftool  \#0000010-v*.jpg
======== #0000010-v2.jpg
ExifTool Version Number         : 10.02
File Name                       : #0000010-v2.jpg
File Size                       : 7.7 kB
Resource Fork Size              : 286 bytes
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Image Width                     : 640
Image Height                    : 480
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Image Size                      : 640x480
Megapixels                      : 0.307

======== #0000010-v3.jpg
ExifTool Version Number         : 10.02
File Name                       : #0000010-v3.jpg
File Size                       : 11 kB
Resource Fork Size              : 286 bytes
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 160
Image Height                    : 120
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Image Size                      : 160x120
Megapixels                      : 0.019
    2 image files read

... except the missing JFIF in /video2

Code: [Select]
$ hexdump -n32 -C #0000010-v2.jpg
00000000  ff d8 ff c0 00 11 08 01  e0 02 80 03 01 21 00 02  |.............!..|
00000010  11 01 03 11 01 ff dd 00  04 00 28 ff db 00 84 00  |..........(.....|

$ hexdump -n32 -C  #0000010-v3.jpg
00000000  ff d8 ff e0 00 10 4a 46  49 46 00 01 01 00 00 01  |......JFIF......|
00000010  00 01 00 00 ff db 00 43  00 03 02 02 03 02 02 03  |.......C........|

no differences in the announcements of the v4l2 loopback devices
Code: [Select]
$ v4l2-ctl --all -d /dev/video2
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0002)
Bus info      : platform:v4l2loopback-002
Driver version: 3.18.13
Capabilities  : 0x85208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Video input : 0 (loopback: ok)
Format Video Capture:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Format Video Output:
Width/Height  : 640/480
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 1228800
Colorspace    : SRGB
Custom Info   : feedcafe
Streaming Parameters Video Capture:
Frames per second: 5.000 (5/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 5.000 (5/1)
Write buffers    : 8

User Controls

                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0

$ v4l2-ctl --all -d /dev/video3
Driver Info (not using libv4l2):
Driver name   : v4l2 loopback
Card type     : Dummy video device (0x0003)
Bus info      : platform:v4l2loopback-003
Driver version: 3.18.13
Capabilities  : 0x85208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05208001
Video Capture
Video Memory-to-Memory
Read/Write
Streaming
Video input : 0 (loopback: ok)
Format Video Capture:
Width/Height  : 160/120
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 76800
Colorspace    : SRGB
Custom Info   : feedcafe
Format Video Output:
Width/Height  : 160/120
Pixel Format  : 'MJPG'
Field         : None
Bytes per Line: 0
Size Image    : 76800
Colorspace    : SRGB
Custom Info   : feedcafe
Streaming Parameters Video Capture:
Frames per second: 5.000 (5/1)
Read buffers     : 8
Streaming Parameters Video Output:
Frames per second: 5.000 (5/1)
Write buffers    : 8

User Controls

                    keep_format (bool)   : default=0 value=0
              sustain_framerate (bool)   : default=0 value=0
                        timeout (int)    : min=0 max=100000 step=1 default=0 value=0
               timeout_image_io (bool)   : default=0 value=0

But still mjpg_streamer has the same problem with the mjpeg stream 160x120.
Code: [Select]
$ export LD_LIBRARY_PATH=/usr/local/lib

$ mjpg_streamer -i "input_uvc.so -d /dev/video3 -r 160x120" -o "output_http.so -w /usr/local/www"
MJPG Streamer Version: svn rev: Unversioned directory
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 160 x 120
 i: Frames Per Second.: 5
i: Format............: MJPEG
...
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
*** glibc detected *** mjpg_streamer: free(): invalid next size (normal): 0x01258910 ***
Aborted

Is 160x120 to small for mjpg_streamer?
« Last Edit: January 04, 2016, 11:57:35 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #126 on: January 05, 2016, 01:13:33 am »
tomas123,
Maybe we should expanding the 160 x 120 image to 320 x 240. just a quick scaling by 2 should be enough to see if there is a minimum size issue.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #127 on: January 06, 2016, 11:43:42 pm »
Yes, with an upscaled image to 320 x 240 mjpg_streamer works fine without a buffer/pointer error.
Code: [Select]
./mjpg_streamer -i "./input_uvc.so -d /dev/video3" -o "output_http.so -w /usr/local/www"

I wasted many time for this bug  >:(

Quote
Open and edit the apporitate plugins (input_uvc) and the programs Makefile, and remove the hashmark befor the following row:
#CFLAGS +=  -DDEBUG
After debugging the mjpg_streamer source code  I know, that the error comes from the second (!) grabbed frame

Code: [Select]
$ ./mjpg_streamer -i "./input_uvc.so -d /dev/video3" -o "output_http.so -w /usr/local/www"
MJPG Streamer Version: svn rev: 3:172M
 DBG(input_uvc.c, input_init(), 107): argv[0]=UVC webcam grabber
 DBG(input_uvc.c, input_init(), 107): argv[1]=-d
 DBG(input_uvc.c, input_init(), 107): argv[2]=/dev/video3
 DBG(input_uvc.c, input_init(), 162): case 2,3
 DBG(input_uvc.c, input_init(), 245): input id: 0
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
 DBG(input_uvc.c, input_init(), 265): vdIn pn: 0
i: The format asked unavailable, so the width 160 height 120
 DBG(v4l2uvc.c, init_videoIn(), 94): Current size: 160x120
 DBG(v4l2uvc.c, init_videoIn(), 123): Supported format: [MJPG]
 DBG(v4l2uvc.c, init_videoIn(), 153): Supported size with the current format: 160x120
 DBG(v4l2uvc.c, init_videoIn(), 123): Supported format: RGB3
 DBG(v4l2uvc.c, init_videoIn(), 155): Supported size: 160x120
 DBG(v4l2uvc.c, init_videoIn(), 123): Supported format: BGR3
 DBG(v4l2uvc.c, init_videoIn(), 155): Supported size: 160x120
 DBG(v4l2uvc.c, init_videoIn(), 123): Supported format: YU12
 DBG(v4l2uvc.c, init_videoIn(), 155): Supported size: 160x120
 DBG(v4l2uvc.c, init_videoIn(), 123): Supported format: YV12
 DBG(v4l2uvc.c, init_videoIn(), 155): Supported size: 160x120
...
 DBG(v4l2uvc.c, enumerateControls(), 801): V4L2 API's V4L2_CTRL_FLAG_NEXT_CTRL is supported
 DBG(v4l2uvc.c, control_readed(), 705): V4L2 parameter found: User Controls value 2123345140 Class: USER
 DBG(v4l2uvc.c, control_readed(), 710): Unable to get the value of User Controls retcode: -1  Permission denied
 DBG(v4l2uvc.c, control_readed(), 705): V4L2 parameter found: keep_format value 0 Class: USER
 DBG(v4l2uvc.c, control_readed(), 705): V4L2 parameter found: sustain_framerate value 0 Class: USER
 DBG(v4l2uvc.c, control_readed(), 705): V4L2 parameter found: timeout value 0 Class: USER
 DBG(v4l2uvc.c, control_readed(), 705): V4L2 parameter found: timeout_image_io value 0 Class: USER
 DBG(v4l2uvc.c, enumerateControls(), 836): JPEG compression details:
 DBG(v4l2uvc.c, enumerateControls(), 837): Quality: 0
 DBG(v4l2uvc.c, enumerateControls(), 838): APPn: 0
 DBG(v4l2uvc.c, enumerateControls(), 839): APP length: 0
 DBG(v4l2uvc.c, enumerateControls(), 840): APP data:
 DBG(v4l2uvc.c, enumerateControls(), 841): COM length: 0
 DBG(v4l2uvc.c, enumerateControls(), 842): COM data:
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
 DBG(input_uvc.c, input_run(), 310): launching camera thread #00
,sizeof(struct v4l2_buffer) DBG(v4l2uvc.c, uvcGrab(), 431): X3
 DBG(input_uvc.c, cam_thread(), 382): received frame of size: 76800 from plugin: 0
 DBG(input_uvc.c, cam_thread(), 411): copying frame from input: 0
 DBG(input_uvc.c, cam_thread(), 436): waiting for next frame
*** glibc detected *** ./mjpg_streamer: free(): invalid next size (normal): 0x000ee9d8 ***
Aborted

the errors comes from this line:

input_uvc.c
Code: [Select]
             /* grab a frame */
377:        if(uvcGrab(pcontext->videoIn) < 0) {

this goes to V4l2 command VIDIOC_DQBUF
v4l2uvc.c
Code: [Select]
int uvcGrab(struct vdIn *vd)
{
430:     vd->buf.memory = V4L2_MEMORY_MMAP;
431:     ret = xioctl(vd->fd, VIDIOC_DQBUF, &vd->buf);

with

Code: [Select]
static int xioctl(int fh, int request, void *arg)
{
        int r;
        do
        {
            r = ioctl(fh, request, arg);
        } while (-1 == r && EINTR == errno);
        return r;
}

but I found no solution



only for information:


... except the missing JFIF in /video2

Code: [Select]
$ hexdump -n32 -C #0000010-v2.jpg
00000000  ff d8 ff c0 00 11 08 01  e0 02 80 03 01 21 00 02  |.............!..|
00000010  11 01 03 11 01 ff dd 00  04 00 28 ff db 00 84 00  |..........(.....|

$ hexdump -n32 -C  #0000010-v3.jpg
00000000  ff d8 ff e0 00 10 4a 46  49 46 00 01 01 00 00 01  |......JFIF......|
00000010  00 01 00 00 ff db 00 43  00 03 02 02 03 02 02 03  |.......C........|


Quote
Motion JPEG AVI files typically have an APP0 header (FF E0), with the tag 'AVI1' and not 'JFIF'.

remove a JFIF header from jpeg with
Code: [Select]
  cinfo.write_JFIF_header = FALSE;
  jpeg_start_compress(&cinfo, TRUE);
« Last Edit: January 06, 2016, 11:51:42 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #128 on: January 07, 2016, 08:09:52 am »
Hi cynfab,

have you ever tried mjpg_streamer on your Linux Mint?

Today I tested it the first time on a Linux Mint Notebook with our old code flir8i.c
Reverse:
- real video stream 640x480 on /dev/video2 goes to a memory error
- thermal video stream 160x120 on /dev/video3 works fine

In the german ubuntu forum
https://wiki.ubuntuusers.de/MJPG-Streamer/
they describe, that the old Rev. 182 (Date 2008-06-21) of /mjpg_streamer is buggy while reading MJPEG.

I can confirm it. |O

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #129 on: January 07, 2016, 02:20:22 pm »
Hi tomas123,
No I haven't tried mjpeg-streamer on Mint. been busy & now snowed in again :)
Trying to get a new kernel built for my pcduino, and having some toolchain problems. Once I get that working I'll be trying the various flir8x, v4l2 & loopback code on it.

   ...ken...
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #130 on: January 08, 2016, 08:34:43 am »
When is FLIR going to start selling 160x120 Lepton chips as standalone components. I just recently checked their website and they link to Digikey which is selling the old 80x60 chips still. How long until the old ones sell out, so they can start selling the new version? And when (if ever) is FLIR going to start making true 320x240 or 640x480 Lepton chips? It seems they must have in the past couple years discovered a better manufacturing process for making vanadium oxide microbolometer chips, because 160x120 thermal imagers used to sell for about $2500, but the FLIR One costs only $250. If this is how dramatic they have been able to reduce the cost on 160x120 thermal images, I'm expecting them to eventually expand their range of super-cheap thermal imagers to eventually include ones with super-cheap 320x240, or even 640x480, VOX microbolometer chips (maybe a Lepton v4 or v5). Have you guys heard any rumors about any plans from FLIR for future versions of the Lepton chip that have a higher resolution than 160x120?
 

Offline Lord of nothing

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: at
Re: Question about FLIR One for Android
« Reply #131 on: January 10, 2016, 01:24:10 pm »
are there any other company who make thermal sensors?
Made in Japan, destroyed in Sulz im Wienerwald.
 

Offline frenky

  • Supporter
  • ****
  • Posts: 1003
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #132 on: January 10, 2016, 02:50:37 pm »
Check out this two:
http://www.i3system.com/eng/
http://www.heimannsensor.com/products_imaging.php

Sent from my LG-D855 using Tapatalk

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #133 on: January 10, 2016, 04:44:17 pm »
a subforum for "Thermal Imaging"  :-+ :-+



Hi cynfab,

after terrible hours with a self compiled kernel driver (v4l2loopback.so) for ARM systems
Code: [Select]
$ find / -name v4l2loopback.ko 2>/dev/zero
/lib/modules/3.18.0-trunk-rpi2/extra/v4l2loopback.ko
/lib/modules/3.18.13-v7+/extra/v4l2loopback.ko

... I suggest new concept for using MJPEG Streamer with our Flir One:
Create a RAMDisk and use the input_file.so module of mjpg_streamer.
It works great with the low powered raspberry pi and you don't need the loopback devices /dev/videoX


(1) create a small ramdisk of 20MB

Code: [Select]
$ sudo mkdir /mnt/RAMDisk
$ sudo chmod 777 /mnt/RAMDisk

$ sudo mount -t tmpfs  -o size=20m none  /mnt/RAMDisk

$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
none               20480   20480         0 100% /mnt/RAMDisk


(2) compile the code flir8k.c from attachment


check your packages
Code: [Select]
$ sudo apt-get install libusb-1.0-0
$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install libjpeg-dev


Code: [Select]
$ make
gcc -I/usr/include/libusb-1.0    -c -o flir8k.o flir8k.c
gcc -I/usr/include/libusb-1.0 -o flir8k Palettes.o flir8k.o -lusb-1.0 -ljpeg -lm -Wall


(3) start the binary

now the binary writes the two images real.jpg and thermal.jpg to /mnt/RAMDisk/ with 8 fps

Code: [Select]
$ sudo ./flir8k
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

:xx Sun Jan 10 16:30:27 2016

: Sun Jan 10 16:30:27 2016
 bulk read EP 0x81, actual length 101
HEX:
 cc 01 00 00 01 00 00 00 55 00 00 00 30 73 8c df 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 31 37 30 30 30 30 30 37 36 32 39 33 39 35 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 30 30 7d 7d 00
STRING:
?U0s??{"type":"batteryVoltageUpdate","data":{"voltage":4.17000007629395,"percentage":100}}

: Sun Jan 10 16:30:27 2016
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83:-7 LIBUSB_ERROR_TIMEOUT

ask for CameraFiles.zip on EP 0x83:

: Sun Jan 10 16:30:28 2016

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}}

: Sun Jan 10 16:30:28 2016


Ask for video stream, start EP 0x85:

: Sun Jan 10 16:30:28 2016
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81:-7 LIBUSB_ERROR_TIMEOUT
#000001 0/10 fps:{"shutterState":"ON","shutterTemperature":310.179992675781,"usbNotifiedTimestamp":1177004833.33163,"usbEnqueuedTimestamp":1177004833.33369,"ffcState":"FFC_VALID_RAD"}
#000002 0/10 fps:{"shutterState":"FFC","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004852.00896,"usbEnqueuedTimestamp":1177004852.01061,"ffcState":"FFC_RAD_APPROX"}

: Sun Jan 10 16:30:47 2016
 bulk read EP 0x81, actual length 206
HEX:
 cc 01 00 00 01 00 00 00 55 00 00 00 30 73 8c df 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 31 37 30 30 30 30 30 37 36 32 39 33 39 35 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 30 30 7d 7d 00 cc 01 00 00 01 00 00 00 59 00 00 00 88 cc 5a 95 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 43 68 61 72 67 69 6e 67 53 6d 61 72 74 50 68 6f
STRING:
?U0s??{"type":"batteryVoltageUpdate","data":{"voltage":4.17000007629395,"percentage":100}}?Y??Z?{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateChargingSmartPho
#000003 0/10 fps:{"shutterState":"FFC","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004852.57983,"usbEnqueuedTimestamp":1177004852.58155,"ffcState":"FFC_RAD_APPROX"}
#000004 3/10 fps:{"shutterState":"FFC","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004852.69227,"usbEnqueuedTimestamp":1177004852.69411,"ffcState":"FFC_RAD_APPROX"}
#000005 8/10 fps:{"shutterState":"ON","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004852.80562,"usbEnqueuedTimestamp":1177004852.80794,"ffcState":"FFC_RAD_APPROX"}
#000006 11/10 fps:{"shutterState":"ON","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004852.91994,"usbEnqueuedTimestamp":1177004852.92159,"ffcState":"FFC_RAD_APPROX"}
#000007 14/10 fps:{"shutterState":"ON","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004853.03383,"usbEnqueuedTimestamp":1177004853.03595,"ffcState":"FFC_RAD_APPROX"}
#000008 18/10 fps:{"shutterState":"ON","shutterTemperature":308.640014648438,"usbNotifiedTimestamp":1177004853.14999,"usbEnqueuedTimestamp":1177004853.15202,"ffcState":"FFC_RAD_APPROX"}
#000009 20/10 fps:{"shutterState":"ON","shutterTemperature":308.75,"usbNotifiedTimestamp":1177004853.26203,"usbEnqueuedTimestamp":1177004853.26407,"ffcState":"FFC_RAD_APPROX"}
#000010 23/10 fps:{"shutterState":"ON","shutterTemperature":308.75,"usbNotifiedTimestamp":1177004853.37733,"usbEnqueuedTimestamp":1177004853.37923,"ffcState":"FFC_RAD_APPROX"}
#000011 26/10 fps:{"shutterState":"ON","shutterTemperature":308.75,"usbNotifiedTimestamp":1177004853.49003,"usbEnqueuedTimestamp":1177004853.49223,"ffcState":"FFC_RAD_APPROX"}
#000012 28/10 fps:{"shutterState":"ON","shutterTemperature":308.769989013672,"usbNotifiedTimestamp":1177004853.60389,"usbEnqueuedTimestamp":1177004853.60574,"ffcState":"FFC_RAD_APPROX"}
...
#003170 86/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004033.54082,"usbEnqueuedTimestamp":1177004033.542,"ffcState":"FFC_VALID_RAD"}
#003171 84/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004033.65724,"usbEnqueuedTimestamp":1177004033.6585,"ffcState":"FFC_VALID_RAD"}
#003172 83/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004033.76884,"usbEnqueuedTimestamp":1177004033.77,"ffcState":"FFC_VALID_RAD"}
#003173 83/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004033.88303,"usbEnqueuedTimestamp":1177004033.89359,"ffcState":"FFC_VALID_RAD"}
#003174 84/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004034.00084,"usbEnqueuedTimestamp":1177004034.00196,"ffcState":"FFC_VALID_RAD"}
#003175 84/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004034.11106,"usbEnqueuedTimestamp":1177004034.11261,"ffcState":"FFC_VALID_RAD"}
#003176 84/10 fps:{"shutterState":"ON","shutterTemperature":310.679992675781,"usbNotifiedTimestamp":1177004034.2256,"usbEnqueuedTimestamp":1177004034.22683,"ffcState":"FFC_VALID_RAD"}

(4) run a web server on /var/www/

- like apache
Code: [Select]
$ sudo apt-get install apache2
- link the two files real.jpg and thermal.jpg from RAMDISK to web folder
- check your web folder (current apache on raspi is /var/www/html/thermal.jpg
Code: [Select]
$ sudo ln -s /mnt/RAMDisk/thermal.jpg /var/www/thermal.jpg
$ sudo ln -s /mnt/RAMDisk/real.jpg /var/www/real.jpg
// don't forget the "sudo chmod 777 /mnt/RAMDisk" from (1)  ;)

now you can see the two images in your web browser
Code: [Select]
http://192.168.1.70/real.jpg
http://192.168.1.70/thermal.jpg
my raspberry pi has the address 192.168.1.70


(5) View video stream on an iDevice / Smartphone

 load from apple app store ore google play store the free app IP Cam Viewer Lite from NibblesnBits

http://elinux.org/RPi-Cam-Web-Interface#View_video_stream_on_an_iDevice_.2F_Smartphone
Quote
Select the menu icon
Press Manage Cameras
Select Add Camera then Generic URL
Give your cam a name
For Type choose Generic Video URL
Enter your URL, e.g. http://192.168.0.1:80/thermal.jpg
Press Test
If it works, press Save

You can to it twice for thermal.jpg and real.jpg and then you see the two streams parallel.
It's a little bit rough for the large image real.jpg with 9fps over WLAN, but thermal.jpg works fine


(6) create two MJPEG streams for real and thermal image

compile mjpg-streamer from source
mjpg-streamer needs imagemagick
Code: [Select]
$ sudo apt-get install imagemagick
Code: [Select]
$ sudo apt-get install subversion
$ svn co svn://svn.code.sf.net/p/mjpg-streamer/code/ mjpg-streamer
...
Checked out revision 182.
$ cd mjpg-streamer/mjpg-streamer
$ make
gcc -D'SVN_REV="3:172"' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o mjpg_streamer.o mjpg_streamer.c
gcc -D'SVN_REV="3:172"' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o utils.o utils.c
gcc -D'SVN_REV="3:172"' -O2 -DLINUX -D_GNU_SOURCE -Wall  mjpg_streamer.o utils.o -lpthread -ldl -o mjpg_streamer
chmod 755 mjpg_streamer
make -C plugins/input_uvc all
...
cp plugins/input_file/input_file.so

$ ls -al
total 412
drwxr-xr-x  5 pi pi   4096 Jan 10 17:24 .
drwxr-xr-x 10 pi pi   4096 Jan 10 17:22 ..
-rw-r--r--  1 pi pi    102 Jan 10 17:22 CHANGELOG
-rwxr-xr-x  1 pi pi  14331 Jan 10 17:24 input_file.so
-rwxr-xr-x  1 pi pi 168606 Jan 10 17:24 input_testpicture.so
-rwxr-xr-x  1 pi pi  30905 Jan 10 17:24 input_uvc.so
-rw-r--r--  1 pi pi  17987 Jan 10 17:22 LICENSE
-rw-r--r--  1 pi pi   5107 Jan 10 17:22 Makefile
-rwxr-xr-x  1 pi pi  16104 Jan 10 17:24 mjpg_streamer
-rw-r--r--  1 pi pi  15738 Jan 10 17:22 mjpg_streamer.c
-rw-r--r--  1 pi pi   3617 Jan 10 17:22 mjpg_streamer.h
-rw-r--r--  1 pi pi   9800 Jan 10 17:24 mjpg_streamer.o
-rwxr-xr-x  1 pi pi  20284 Jan 10 17:24 output_file.so
-rwxr-xr-x  1 pi pi  32436 Jan 10 17:24 output_http.so
-rwxr-xr-x  1 pi pi  14891 Jan 10 17:24 output_udp.so
drwxr-xr-x 13 pi pi   4096 Jan 10 17:22 plugins
-rw-r--r--  1 pi pi   2631 Jan 10 17:22 README
drwxr-xr-x  2 pi pi   4096 Jan 10 17:22 scripts
-rwxr-xr-x  1 pi pi   4630 Jan 10 17:22 start.sh
-rw-r--r--  1 pi pi    285 Jan 10 17:22 TODO
-rw-r--r--  1 pi pi   2866 Jan 10 17:22 utils.c
-rw-r--r--  1 pi pi   2399 Jan 10 17:22 utils.h
-rw-r--r--  1 pi pi   1804 Jan 10 17:24 utils.o
drwxr-xr-x  2 pi pi   4096 Jan 10 17:22 www

You don't need a "sudo make install". Stay in current folder, the are all required binaries included.

test the mjpg_streamer and get the help

Code: [Select]
$ LD_LIBRARY_PATH=./ ./mjpg_streamer -i "input_file.so -h"
MJPG Streamer Version: svn rev: 3:172
 ---------------------------------------------------------------
 Help for input plugin..: FILE input plugin
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:

 [-d | --delay ]........: delay to pause between frames
 [-f | --folder ].......: folder to watch for new JPEG files
 [-r | --remove ].......: remove/delete JPEG file after reading
 [-n | --name ].........: ignore changes unless filename matches
 ---------------------------------------------------------------

$ LD_LIBRARY_PATH=./ ./mjpg_streamer -o "output_http.so -h"
MJPG Streamer Version: svn rev: 3:172
 ---------------------------------------------------------------
 Help for output plugin..: HTTP output plugin
 ---------------------------------------------------------------
 The following parameters can be passed to this plugin:

 [-w | --www ]...........: folder that contains webpages in
                           flat hierarchy (no subfolders)
 [-p | --port ]..........: TCP port for this HTTP server
 [-c | --credentials ]...: ask for "username:password" on connect
 [-n | --nocommands ]....: disable execution of commands
 ---------------------------------------------------------------

write a start script start1.sh (there is already a start.sh)
Code: [Select]
$ cat ./start1.sh
export LD_LIBRARY_PATH=./
./mjpg_streamer -i "input_file.so -f /mnt/RAMDisk/ -n thermal.jpg" -o "output_http.so -p 8080 -w /usr/local/www" &
./mjpg_streamer -i "input_file.so -d 250 -f /mnt/RAMDisk/ -n real.jpg"    -o "output_http.so -p 8081 -w /usr/local/www"

Please note, that I reduced with "-d 250"ms the frame rate of the visible image to 4 fps, to reduce the WLAN bandwidth

and start the script
Code: [Select]
$ ./start1.sh
MJPG Streamer Version: svn rev: 3:172M
 i: folder to watch...: /mnt/RAMDisk/
 i: forced delay......: 250
 i: delete file.......: no, do not delete
 i: filename must be..: real.jpg
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8081

MJPG Streamer Version: svn rev: 3:172M
 o: username:password.: disabled
 o: commands..........: enabled
 i: folder to watch...: /mnt/RAMDisk/
 i: forced delay......: 0
 i: delete file.......: no, do not delete
 i: filename must be..: thermal.jpg
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

now we have two MJPEG live streams

see the two web front ends for informations
Quote
http://192.168.1.70:8080
http://192.168.1.70:8081

test it with VLC or mplayer etc.
Code: [Select]
http://192.168.1.70:8080/?action=stream
http://192.168.1.70:8081/?action=stream

(7) a simple html web front end

create a index.html in your web folder /var/www
Code: [Select]
$ cat /var/www/index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
text-align:center;
background-color:#000000;
}
.container {
width:100%;
}
.motion1 {
border: 0;
width: 40%;
height: auto;
}
.motion2 {
border: 0;
width: 40%;
height: auto;
}
.clear {
clear:both;
}
</style>
</head>
<body>
<a href="http://192.168.1.70:8080"><img class="motion1" src="http://192.168.1.70:8080/?action=stream" /></a>

<a href="http://192.168.1.70:8081"><img class="motion2" src="http://192.168.1.70:8081/?action=stream" /></a>
</body>
</html>

load the site:
Code: [Select]
http://192.168.1.70
« Last Edit: December 06, 2016, 02:39:37 pm by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #134 on: January 10, 2016, 06:55:27 pm »
Hi tomas123,
Wow, you have been busy... :-+
Yea... Thermal Imaging section. :-+
Well I got my new kernel 4.3.3 for the pcduino building with buildroot, I was going to add the v4l2 kernel module, but after your recent experiments, maybe that's
not a good idea to waste any more time on.... I'd much rather a userland solution.

I'll try and replicate your system soon. Busy week ahead.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #135 on: January 10, 2016, 11:14:07 pm »
I'd much rather a userland solution.

I read something about the interesting UV4L "User space Video4Linux collection"
http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=16
but I have no idea, how to implement this in our code.

The workaround over the RAMDisk has advantages and disadvantages.
mjpg-streamer waits patiently for the next jpg image.
Therefore you can restart the flir binary without stopping the mjpeg stream!  // edit: restart works with v4l2 driver also  ;)
Otherwise you have more random lags as with /dev/videoX.

For a surveillance camera with a low frame rate is the RAMDisk workaround acceptable.
If you want a nice live stream without lags, than is v4l2 the better solution.
 
The cutted source code flir8k contains a better error correction and a filter for FFC frames.
Code: [Select]
// freeze thermal image if "shutterState"="FFC"
  if (strncmp (&buf85[28+ThermalSize+JpgSize+17],"FFC",3)!=0)
  {

 
I added a nice restart sequence, because sometimes the code doesn't correct start the USB flir camera
Quote

$ sudo ./flir8k
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO
...
: Sun Jan 10 14:57:54 2016
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81:-1 LIBUSB_ERROR_IO
EP 0x83 LIBUSB_ERROR_NO_DEVICE -> reset USB
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
stop interface 2 FRAME
stop interface 1 FILEIO

start interface 1 FILEIO

....
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!


« Last Edit: January 13, 2016, 10:01:49 pm by tomas123 »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Question about FLIR One for Android
« Reply #136 on: January 11, 2016, 02:30:00 am »
a subforum for "Thermal Imaging"  :-+ :-+

+1  :-+ :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #137 on: January 11, 2016, 11:55:35 pm »
...
flir8i2.c (see attachment) writes all jpg frames for /dev/video2 and /dev/video3 to file
...
But still mjpg_streamer has the same problem with the mjpeg stream 160x120.
Code: [Select]
$ export LD_LIBRARY_PATH=/usr/local/lib

$ mjpg_streamer -i "input_uvc.so -d /dev/video3 -r 160x120" -o "output_http.so -w /usr/local/www"
MJPG Streamer Version: svn rev: Unversioned directory
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 160 x 120
 i: Frames Per Second.: 5
i: Format............: MJPEG
...
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
*** glibc detected *** mjpg_streamer: free(): invalid next size (normal): 0x01258910 ***
Aborted

Is 160x120 to small for mjpg_streamer?

I found a nice workaround for mjpg_streamer with the v4l2 input modul and 160x120 frame size.  :)

only enlarge the initialisation frame size of the v4l2 device from 160x120 to:
Code: [Select]
#define VIDEO_DEVICE2 "/dev/video3" // colorized thermal image
#define FRAME_WIDTH2  320
#define FRAME_HEIGHT2 240

than you can write a smaller jpeg of 160x120 to VIDEO_DEVICE2
Code: [Select]
  // write frame as jpg to fdwr2         
...
  int image_width=160; /* Number of columns in image */
  int image_height=120; /* Number of rows in image */
  int quality=90;

and mjpg_streamer works fine with v4l2 loopback device (also VLC etc.)

Code: [Select]
./mjpg_streamer -i "./input_uvc.so -d /dev/video2" -o "./output_http.so -p 8080 -w /usr/local/www" &
./mjpg_streamer -i "./input_uvc.so -d /dev/video3" -o "./output_http.so -p 8081 -w /usr/local/www"

 :palm:



Trying to get a new kernel built for my pcduino, and having some toolchain problems.

I know this point from my early cross compile experiences for embedded devices like router, NAS etc.
Last years I'm lazy and I mostly load a ready image for the raspberry pi.
Unfortunately currently there are no 100% corresponding kernel sources for the last raspberry pi image. It's a pain for compiling kernel drivers.   :-\
« Last Edit: January 12, 2016, 12:08:55 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #138 on: January 12, 2016, 01:57:34 am »
tomas123,
Been there done that.... Cross compiling kernel drivers is a PITA.....
I used to be better at it than I am now... been lazy lately too,  :palm:
Fixed the toolchain problems, cockpit problem again, kernel now compiling and running...
Then Linus releases 4.4 LTS so I need to repeat it all again with the new kernel code. |O

   ...ken...


 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #139 on: January 12, 2016, 08:43:51 am »
http://www.linksprite.com/linksprite-pcduino/

What are the advantages of the pcduino, which do you need versus a raspberry pi?
Flash?

for other readers: on the right side is a pcDuino3


« Last Edit: January 12, 2016, 08:48:45 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #140 on: January 12, 2016, 03:00:11 pm »
tomas123,
A bit off topic for the FlirOne Android thread but not tooooo far off.
I have several sbc's, and am always looking for a better "bang for the buck".
Prices keep falling and capabilities keep getting better.
I bought the pcduino3 nano lite just before Xmas, at $US15 delivered from Amazon.
Unfortunately that was some sort of promotion, and the real price is more like $US40. :(
So it is not as good a deal as first thought. Oh well... I'll buy one of almost any SBC if I think it's worth evaluating.
My collection of SBC's is like Frasers collection of thermal cameras (see not quite off topic :) )
It is still a nice board with fairly good kernel support.
I also have 2 RPi model B boards which I got in the early days of the RPi.
IMHO their USB core in the SOC stinks. Their USB power system on the board stinks.
This may have improved a bit in later versions RPi2.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #141 on: January 12, 2016, 05:28:17 pm »
Hi cynfab,

I also have 2 RPi model B boards which I got in the early days of the RPi.
IMHO their USB core in the SOC stinks. Their USB power system on the board stinks.
This may have improved a bit in later versions RPi2.

I have also a "nice" collection of RPi A, RPi B and now RPi 2.
The USB power of RPi 2 is noticeable more better. We get no more low power resets after plug in a 300mA USB device.




I found a nice workaround for mjpg_streamer with the v4l2 input modul and 160x120 frame size.  :)

only enlarge the initialisation frame size of the v4l2 device from 160x120 to:
Code: [Select]
#define VIDEO_DEVICE2 "/dev/video3" // colorized thermal image
#define FRAME_WIDTH2  320
#define FRAME_HEIGHT2 240

as alternative for the RAMdisk version flir8k.c https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg839518/#msg839518

I uploaded as attachment the last version flir8k.c for v4l2 loopback devices with the better error correction, FFC filter etc.

Code: [Select]
$ make
gcc -I/usr/include/libusb-1.0    -c -o flir8l.o flir8l.c
gcc -I/usr/include/libusb-1.0 -o flir8l Palettes.o flir8l.o -lusb-1.0 -ljpeg -lm -Wall

$ sudo ./flir8l
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
using output device: /dev/video1
     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   =20480
     vid_format->fmt.pix.field       =1
     vid_format->fmt.pix.bytesperline=160
     vid_format->fmt.pix.colorspace  =8
using output device: /dev/video2
     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
using output device: /dev/video3
     vid_format->type                =2
     vid_format->fmt.pix.width       =320
     vid_format->fmt.pix.height      =240
     vid_format->fmt.pix.pixelformat =1196444237
     vid_format->fmt.pix.sizeimage   =307200
     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
...

use second terminal to start twice mjpg-streamers
Code: [Select]
~/MJPG-Streamer/test/mjpg-streamer/mjpg-streamer $ cat ./start1.sh
./mjpg_streamer -i "./input_uvc.so -d /dev/video2" -o "./output_http.so -p 8080 -w /usr/local/www"&
./mjpg_streamer -i "./input_uvc.so -d /dev/video3" -o "./output_http.so -p 8081 -w /usr/local/www"

~/MJPG-Streamer/test/mjpg-streamer/mjpg-streamer $ ls
CHANGELOG      input_testpicture.so  LICENSE   mjpg_streamer    mjpg_streamer.h  output_file.so  output_udp.so  README   start1.sh  TODO     utils.h  www
input_file.so  input_uvc.so          Makefile  mjpg_streamer.c  mjpg_streamer.o  output_http.so  plugins        scripts  start.sh   utils.c  utils.o

~/MJPG-Streamer/test/mjpg-streamer/mjpg-streamer $ ./start1.sh
MJPG Streamer Version: svn rev: 3:172
 i: Using V4L2 device.: /dev/video2
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
 
MJPG Streamer Version: svn rev: 3:172
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
 i: The format asked unavailable, so the width 320 height 240
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8081
 o: username:password.: disabled
 o: commands..........: enabled

next step like here


now we have two MJPEG live streams

see the two web front ends for informations
Quote
http://192.168.1.70:8080
http://192.168.1.70:8081

test it with VLC or mplayer etc.
Code: [Select]
http://192.168.1.70:8080/?action=stream
http://192.168.1.70:8081/?action=stream

(7) a simple html web front end

create a index.html in your web folder /var/www
Code: [Select]
$ cat /var/www/index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
text-align:center;
background-color:#000000;
}
.container {
width:100%;
}
.motion1 {
border: 0;
width: 40%;
height: auto;
}
.motion2 {
border: 0;
width: 40%;
height: auto;
}
.clear {
clear:both;
}
</style>
</head>
<body>
<a href="http://192.168.1.70:8080"><img class="motion1" src="http://192.168.1.70:8080/?action=stream" /></a>

<a href="http://192.168.1.70:8081"><img class="motion2" src="http://192.168.1.70:8081/?action=stream" /></a>
</body>
</html>

load the site:
Code: [Select]
http://192.168.1.70
« Last Edit: January 13, 2016, 02:22:55 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #142 on: January 16, 2016, 01:31:39 am »
Hi cynfab,

the next version for v4l2:
I extend the thermal image with 8 lines to 128x160 pixel.
Now is the height divisible by 16 (avoid video error: "not multiples of 16") and we have place for an information line.

With knowledge of the formulas in my excel sheet RAW2Temp.xls
(attachment of https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/msg342072/#msg342072)
I calculated the min/max temperature from the image and wrote some nice hot spot markers on the edges.
( thanks to tmbinc for the font.h the the code snippet  :-+ ,  see https://www.eevblog.com/forum/thermal-imaging/flir-ex-realtime-raw-radiometric-data-streaming-via-uvc/msg736344/#msg736344 )

For calculating the correct temperature you need the calibration values from your Flir One.
You can extract it from your CameraFiles.zip at EP 0x83, but more simply is to use an jpg image from the FlirOne.app and feed exiftool:
Code: [Select]
$ exiftool  -plan*  FLIROne-2015-11-30-17-26-48+0100.jpg
Planck R1                       : 16438.1
Planck B                        : 1416.5
Planck F                        : 1
Planck O                        : -1315
Planck R2                       : 0.0123569

and write it to the c source code
Code: [Select]
// -- define Flir calibration values ---------------
// exiftool -plan* FLIROne-2015-11-30-17-26-48+0100.jpg
#define  PlanckR1  16438.1
#define  PlanckB  1416.5
#define  PlanckF  1.0
#define  PlanckO  -1315.0
#define  PlanckR2  0.0123569
please note that I wrote always a decimal point, to avoid some unwanted integer castings in c

I wrote here dozens of post about the flir formulas, therefore only the code without comments:
Code: [Select]
double raw2temperature(unsigned short RAW)
{
 // mystery correction factor
 RAW *=4;
 // calc amount of radiance of reflected objects ( Emissivity < 1 )
 double RAWrefl=PlanckR1/(PlanckR2*(exp(PlanckB/(TempReflected+273.15))-PlanckF))-PlanckO;
 // get displayed object temp max/min
 double RAWobj=(RAW-(1-Emissivity)*RAWrefl)/Emissivity;
 // calc object temperature
 return PlanckB/log(PlanckR1/(PlanckR2*(RAWobj+PlanckO))+PlanckF)-273.15; 
}

There is a uncleared issue. With the FlirOne.App we get the correct Flir RAW values for the Excel Sheet above.
But over USB the RAW values seems divided by factor 4.
I'm unsure and will further check it with some temperature measurements.


Currently the string with min/max temperature is only for temperature below 100°C  because I forgot to truncate the strings to 20 chars   :o
« Last Edit: January 16, 2016, 01:55:08 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #143 on: January 16, 2016, 05:18:10 am »
Hi tomas123,
Nice :-+

I moved the plank constants to a header file so that the flir8xx.c code can be clean of individual F1 G2 characteristics.

Have you been able to view the video stream with guvcview, or mplayer?  .. see attached.
mplayer looks similar.

   ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #144 on: January 16, 2016, 11:46:54 am »
this is only a side effect of the mjpeg streamer workaround

I found a nice workaround for mjpg_streamer with the v4l2 input modul and 160x120 frame size.  :)

only enlarge the initialisation frame size of the v4l2 device from 160x120 to:
Code: [Select]
#define VIDEO_DEVICE2 "/dev/video3" // colorized thermal image
#define FRAME_WIDTH2  320
#define FRAME_HEIGHT2 240

than you can write a smaller jpeg of 160x120 to VIDEO_DEVICE2


the solution for guvcview or mplayer:

unload and reload the v4l2loopback kernel driver
Code: [Select]
// unload
$ sudo modprobe -r v4l2loopback
// load
$ sudo modprobe v4l2loopback devices=5

change code to the exact image size
Code: [Select]
#define VIDEO_DEVICE2 "/dev/video3" // colorized thermal image
#define FRAME_WIDTH2   160 //320
#define FRAME_HEIGHT2  128 //240

compile and guvcview / mplayer works fine




in all your screenshots I see, that your frame rate is around 8.2 fps
I have a later FlirOne hardware version. My frame rate ist mostly around 7.9fps  :(
Code: [Select]
#00007305 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.42668,"usbEnqueuedTimestamp":1177508916.4285,"ffcState":"FFC_VALID_RAD"}
#00007306 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.5428,"usbEnqueuedTimestamp":1177508916.54466,"ffcState":"FFC_VALID_RAD"}
#00007307 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.65624,"usbEnqueuedTimestamp":1177508916.65782,"ffcState":"FFC_VALID_RAD"}
#00007308 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.76904,"usbEnqueuedTimestamp":1177508916.77088,"ffcState":"FFC_VALID_RAD"}
#00007309 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.88276,"usbEnqueuedTimestamp":1177508916.88477,"ffcState":"FFC_VALID_RAD"}
#00007310 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508916.99627,"usbEnqueuedTimestamp":1177508916.99783,"ffcState":"FFC_VALID_RAD"}
#00007311 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.11095,"usbEnqueuedTimestamp":1177508917.11306,"ffcState":"FFC_VALID_RAD"}
#00007312 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.22461,"usbEnqueuedTimestamp":1177508917.22623,"ffcState":"FFC_VALID_RAD"}
#00007313 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.34107,"usbEnqueuedTimestamp":1177508917.3429,"ffcState":"FFC_VALID_RAD"}
#00007314 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.4537,"usbEnqueuedTimestamp":1177508917.45972,"ffcState":"FFC_VALID_RAD"}
#00007315 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.56661,"usbEnqueuedTimestamp":1177508917.56837,"ffcState":"FFC_VALID_RAD"}
#00007316 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.68063,"usbEnqueuedTimestamp":1177508917.6869,"ffcState":"FFC_VALID_RAD"}
#00007317 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.79463,"usbEnqueuedTimestamp":1177508917.79671,"ffcState":"FFC_VALID_RAD"}
#00007318 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508917.91498,"usbEnqueuedTimestamp":1177508917.91678,"ffcState":"FFC_VALID_RAD"}
#00007319 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.0219,"usbEnqueuedTimestamp":1177508918.02369,"ffcState":"FFC_VALID_RAD"}
#00007320 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.13852,"usbEnqueuedTimestamp":1177508918.14039,"ffcState":"FFC_VALID_RAD"}
#00007321 81/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.25196,"usbEnqueuedTimestamp":1177508918.25356,"ffcState":"FFC_VALID_RAD"}
#00007322 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.36496,"usbEnqueuedTimestamp":1177508918.3667,"ffcState":"FFC_VALID_RAD"}
#00007323 81/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.4781,"usbEnqueuedTimestamp":1177508918.48,"ffcState":"FFC_VALID_RAD"}
#00007324 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.59206,"usbEnqueuedTimestamp":1177508918.59365,"ffcState":"FFC_VALID_RAD"}
#00007325 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.70655,"usbEnqueuedTimestamp":1177508918.70863,"ffcState":"FFC_VALID_RAD"}
#00007326 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.82,"usbEnqueuedTimestamp":1177508918.82159,"ffcState":"FFC_VALID_RAD"}
#00007327 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508918.93411,"usbEnqueuedTimestamp":1177508918.93615,"ffcState":"FFC_VALID_RAD"}
#00007328 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.04937,"usbEnqueuedTimestamp":1177508919.05093,"ffcState":"FFC_VALID_RAD"}
#00007329 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.16221,"usbEnqueuedTimestamp":1177508919.16431,"ffcState":"FFC_VALID_RAD"}
#00007330 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.27651,"usbEnqueuedTimestamp":1177508919.28135,"ffcState":"FFC_VALID_RAD"}
#00007331 81/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.38965,"usbEnqueuedTimestamp":1177508919.39117,"ffcState":"FFC_VALID_RAD"}
#00007332 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.50482,"usbEnqueuedTimestamp":1177508919.50864,"ffcState":"FFC_VALID_RAD"}
#00007333 81/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.61759,"usbEnqueuedTimestamp":1177508919.61911,"ffcState":"FFC_VALID_RAD"}
#00007334 81/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.73212,"usbEnqueuedTimestamp":1177508919.73392,"ffcState":"FFC_VALID_RAD"}
#00007335 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.8459,"usbEnqueuedTimestamp":1177508919.84773,"ffcState":"FFC_VALID_RAD"}
#00007336 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508919.96018,"usbEnqueuedTimestamp":1177508919.96197,"ffcState":"FFC_VALID_RAD"}
#00007337 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.07373,"usbEnqueuedTimestamp":1177508920.07574,"ffcState":"FFC_VALID_RAD"}
#00007338 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.18741,"usbEnqueuedTimestamp":1177508920.18898,"ffcState":"FFC_VALID_RAD"}
#00007339 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.30213,"usbEnqueuedTimestamp":1177508920.30423,"ffcState":"FFC_VALID_RAD"}
#00007340 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.41558,"usbEnqueuedTimestamp":1177508920.41705,"ffcState":"FFC_VALID_RAD"}
#00007341 80/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.52954,"usbEnqueuedTimestamp":1177508920.53154,"ffcState":"FFC_VALID_RAD"}
#00007342 79/10 fps:{"shutterState":"ON","shutterTemperature":310.799987792969,"usbNotifiedTimestamp":1177508920.64426,"usbEnqueuedTimestamp":1177508920.6458,"ffcState":"FFC_VALID_RAD"}
« Last Edit: January 16, 2016, 11:56:27 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #145 on: January 17, 2016, 04:01:13 am »
Hi tomas123,

Your latest code is now cross compiled and running with mjpg-streamer on my pcduino3 nano lite. kernel 4.3.3
Wow, there are a lot of forks of mpg-streamer... close to 150!!
https://github.com/jacksonliam/mjpg-streamer   146 forks
https://github.com/oliv3r/mjpg-streamer    2 forks
and maybe more...

I'm getting 7.9-8.1 fps on the pcduino3.
And the occasional reset buffer because of bad Magic Byte.
The original 160 x 120 for video3 works with guvcview and mplayer.

  ...ken...
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #146 on: January 18, 2016, 08:05:37 am »
 :-+
if we debug the 160x120 resolution bug, than we can fork #151  :)

Code: [Select]
// mystery correction factor
 RAW *=4;

I checked it in my kitchen from -20°C to +100°C (boiling water). Tricky is to compare the temperature from our display (hottest point) with Flir crosshair (Flir One App) as medium of 4x4 pixel.
But it seems, that the correction factor works fine.
Please make own tests with your calibration values.

Maybe this is a effect of the conversion factor from 14 Bit (Sensor) to 16 Bit (2 Byte RAW)
« Last Edit: January 18, 2016, 11:26:06 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #147 on: January 18, 2016, 10:16:23 am »
I found a simple solution to check the factor 4 between "Lepton RAW" and "Flir radiometric jpg RAW":

The tea bag simulator of Flir SDK use real Lepton sensor values. You found it in the SDK file sampleframes.zip (6MB).
I made with the SDK App a shot from the (random) tea bag frame 00051.
Thereby we got a Flir radiometric jpg with an embedded calibrated RawThermalImage with a good temperature range from min/max=34°C/65°C ;)
(the unrealistic min temperature is a result of bad calibration values for the simulator)

first some image magick steps with the lepton sensor values of frame 00051 (file 00051-lep) from SDK sampleframes.zip
("-chop 2x0+0+0 -chop 2x0+80+0" removes the 4 additional vertical lines with extra unknown informations)
Code: [Select]
// convert sample frame 00051 from SDK
> convert -depth 16 -size 164x120 gray:00051-lep gray:- | convert -depth 16 -endian lsb -size 164x120 gray:- -chop 2x0+0+0 -chop 2x0+80+0 -rotate 90 00051-lep.png
// multiply with factor 4
> convert 00051-lep.png -fx "4*u" 00051-lep4x.png
// get channel statistics
> identify -verbose 00051-lep4x.png
  Channel statistics:
    Pixels: 19200
    Gray:
      min: 14220 (0.216983)
      max: 20840 (0.317998)
      mean: 15014.9 (0.229113)
      standard deviation: 1218.95 (0.0186)
      kurtosis: 5.54453
      skewness: 2.30479

and now compare the statistics with the "real" Flir radiometric image from the SDK app
Code: [Select]
// extract RawThermalImage from a Flir radiometric image
> exiftool -b -RawThermalImage FLIROne-2016-01-18-10-33-07+0100.jpg > 00051exif.png
// image is postprocessed and resized to 320x240
> convert 00051exif.png -resize 160x FlirAppRAW120x160.png
// get channel statistics
>identify -verbose FlirAppRAW120x160.png
...
  Channel statistics:
    Pixels: 19200
    Gray:
      min: 14266 (0.217685)
      max: 20831 (0.317861)
      mean: 15021.4 (0.229212)
      standard deviation: 1221.27 (0.0186354)
      kurtosis: 5.44004
      skewness: 2.28451

By deducting the Flir post processing steps to the original RAW values (see patterns below) we got a great result!
A sample:

max-min=65-34=31°C
max-min=20831-14266=6565 digits
-> 1 digit = 31/6565=0.0047 Kelvin
The difference between mean in this images is:
(15021.4-15014.9)*0.0047 Kelvin= 0.031 Kelvin
  :-+

You also see, that the last digit ADC "resolution" of Lepton in this range is > 0.0047*4 = 19mK (useless because of strong noise, see second image below with 4 Kelvin scale)

here is a real live sample from Flir One G2 (shot after a small warm up time of about 2 minutes):

I saved with the SDK.app simultaneously a upscaled Flir Radiometric JPG  and a real Lepton ThermalLinearFlux14BitImage.

Afterwards I rebuild with my old panorama script (see my footer) a real size 160x120 Lepton radiometric jpg (a Flir format).
You can load this sample jpg images in Flir Tools and compare the quality.


First a original image shot with the Flir App.
The App crop  >:(  the Lepton sensor to about 120x90 Pixel.
Please note the artefacts/patterns!
Flir makes a nice lens distortion correction of the Lepton sensor for best MSX overlaying  ;)





real  Lepton sensor 160x120 (no image postprocessing and with noise/grain because the temperature spread is only 4 Kelvin)


« Last Edit: January 18, 2016, 11:24:13 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #148 on: January 19, 2016, 11:26:11 pm »
minor update:

- a smaller font 5x7 for more chars in information line
- better filtering FFC frames
- crosshair for medium temperature of 2x2 "center" pixels
- info line with temperature  min/crosshair/max

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #149 on: January 20, 2016, 12:10:48 am »
tomas123,

Very nice :-+
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #150 on: January 20, 2016, 03:19:27 am »
Looking very good. Excellent work. 👍
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #151 on: January 20, 2016, 08:53:05 am »
Thank You!

Unfortunately we are only two F1G2 hackers  :(

The internet is full with crazy projects using a Lepton 60x80.

https://store.groupgets.com/#!/p/52239877
- $210 FLIR Lepton Dev Kit
- with Raspberry Pi 2 Model B and a Raspberry Pi 5 MP Camera Board
- Requires FLIR Lepton (sold separately)

  :-DD



And don't forget, the Flir One is the only Lepton module with (calibrated) temperature measurement
http://www.flir.com/cvs/cores/knowledgebase/index.cfm?CFTREEITEMKEY=914&view=67485
« Last Edit: January 20, 2016, 08:59:27 am by tomas123 »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #152 on: January 20, 2016, 05:59:38 pm »
Yes it is a pity that there are not more people working on F1G2 development. Sadly my skill set does not include coding and the LEPTON 3 hardware is pretty well formed for many tasks. When I find time I will make a close up lens holder for the unit that will utilise a 12mm ZnSe lens. Sadly the MSX tends to be detrimental to close up performance even if the visible light camera is blinded.

I appreciate your work and efforts though. I thought the other day that the F1G2 has not made the splash that I had expected. When compared to the SEEK camera release, the FLIR F1G2 has received a very muted response for no reason that I can identify. It is certainly selling well as FLIR continue to have trouble meeting demand. Maybe the Budget thermal camera is old news now and of less interest to the forum membership ?

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #153 on: January 20, 2016, 09:12:38 pm »
Sadly the MSX tends to be detrimental to close up performance even if the visible light camera is blinded.

try the SDK apk, there you can disable MSX
I uploaded the self compiled SDK app for Android.
Try the "Thermal Linear Flux 14 Bit Image" mode:

http://www.file-upload.net/download-11032220/FlirOneSDK.apk.html


Maybe the Budget thermal camera is old news now and of less interest to the forum membership ?
I think also. Furthermore most retailer can't deliver Flir One G2 for Android.
We have a delay of 6 weeks in Europe.

Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #154 on: January 30, 2016, 06:52:47 pm »
what hardware are you connecting the F2G2 to?
Is it running some plain Linux or an android firmware?
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #155 on: January 30, 2016, 07:17:11 pm »
Both tomas123 and I have the F1G2 running under linux (various distros) on x86 and ARM hardware.
RPi2, pcduino nano lite, Dell i7 desktop, hardkernel XU4, Amazon Fire 2015 tablet, Motorola Moto E, Google Nexus 7 2012
We also have each built Android apps from the FlirOne SDK.
« Last Edit: January 30, 2016, 07:19:50 pm by cynfab »
 

Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #156 on: January 30, 2016, 07:26:59 pm »
is the howto and source code organized in some place or do one need to scavenge the whole thread for bits and pieces?

F1G2 on a x86 tablet would be awesome for me :D
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #157 on: January 30, 2016, 08:32:53 pm »
It's all in this thread.
 


Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #159 on: February 03, 2016, 06:58:44 pm »
I read in another thread that flir is deliberetly degrading the quality of teh f1g2 images, is that solved by the custom software or is it done in firmware ?
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #160 on: February 03, 2016, 10:10:19 pm »
The camera sends over USB full resolution images.
"Downgrade" or MSX works in user software.
With free SDK you also can process 160x120 images.

Offline in.Vitro

  • Regular Contributor
  • *
  • Posts: 50
  • Country: de
Re: Question about FLIR One for Android
« Reply #161 on: February 10, 2016, 11:23:05 am »
i have a dumb question... is there any way to get any data from the micro USB port or is just for charging? has anyone "backtraced" the USB port?
 

Offline frenky

  • Supporter
  • ****
  • Posts: 1003
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #162 on: February 10, 2016, 11:33:45 am »
It looks like only the Vcc pin is connected to bottom layer... (and ground of course)



http://hardtechlife.com/teardown-flir-one-for-android/
« Last Edit: February 10, 2016, 11:38:25 am by frenky »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #163 on: February 11, 2016, 06:59:00 am »
I think also, but it's a multi layer circuit board. Therefore I can't see any details on this images.
 
Sharper images from disassembly you find here:
https://www.eevblog.com/forum/thermal-imaging/new-flir-products/msg750181/#msg750181
     
« Last Edit: February 11, 2016, 07:06:11 am by tomas123 »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #164 on: February 12, 2016, 03:45:23 am »
I'm pretty sure I rang out the D+ & D- lines on the charging connector and they don't go anywhere.
But, you can charge the camera while operating. The charging messages tell you the state.
I have had some wierd things happen if left on charge too long. The power button turns red and flashes. I haven't seen any description of what that
means but I can guess it is not good.
I'd bet is one of the bad ones below, probably FAULT_HEAT.

From the SDK docs:

BAD
Indicates that a valid battery charging state was not available.
CHARGING_SMART_PHONE_FAULT_HEAT
Indicates that a charging fault exists but the iPhone is being charged
CHARGING_SMART_PHONE_ONLY
Indicates that the device is in phone-charging-only mode
FAULT
Indicates that an unexpected charging fault occurred (bad battery, etc.)
FAULT_BAD_CHARGER
Indicates that a charging fault occurred due to low current from the charging source
FAULT_HEAT
Indicates that a charging heat fault occurred
MANAGED_CHARGING
Indicates that the battery is charging from external power.
MANAGED_CHARGING_ONLY
Indicates that the device is in charge-only mode
NO_CHARGING
Indicates that the battery is not charging because the device is not connected to an external power supply.

 

Offline nitroxide

  • Contributor
  • Posts: 26
Re: Question about FLIR One for Android
« Reply #165 on: March 12, 2016, 03:37:30 am »
Tomas123, you rock! Great work.

If you (or others) feel like customising the F1G2 software as well:

      As you may well know already there's a UART interface (3.3V level; 3 pads on the corner of SoC - GND RX TX) on the F1G2 PCB that allows serial console access to the Linux running on the SoC.
     However it's password protected and simple bootargs tricks from uboot would not work (bootargs env. variables are simply ignored).

     I've dumped the NAND from uboot and done some poking around with binwalk and recovered the root password.

     If anyone wants to check it out login with (root:indigo):

Code: [Select]
U-Boot> run boot_op
boot operational

Loading from nand0, offset 0xe00000
   Image Name:   Linux-2.6.39+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3358884 Bytes = 3.2 MiB
   Load Address: 20008000
   Entry Point:  20008000
Automatic boot of image at addr 0x22000000 ...
## Booting kernel from Legacy Image at 22000000 ...
   Image Name:   Linux-2.6.39+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3358884 Bytes = 3.2 MiB
   Load Address: 20008000
   Entry Point:  20008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.025000] AT91: CM rev B and higher
[    0.037000] AT91: EK rev B and higher
[    0.401000] AT91SAM9 Watchdog: sorry, watchdog is disabled
Starting watchdog...done
mounting jffs2 READ-ONLY...done
start battery charge control
Starting battery_charge: OK
done
Formatting /tmp/versions: OK
[    1.677000] lepton_init
[    1.685000] lepton_probe: using 16-bit SPI width

Welcome to Rosebud (Operational)
(none) login: root
Password:
login[315]: root login on 'ttyS0'
-sh: id: not found
sh: bad number
-sh: id: not found
-sh: /bin/hostname: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
$ cd /
$ ls
bin          home         linuxrc      proc         sys          var
dev          init         mnt          root         tmp          version.txt
etc          lib          opt          sbin         usr
$ cd /
$ uname -a
Linux (none) 2.6.39+ #5 Fri Sep 4 16:01:23 PDT 2015 armv5tejl GNU/Linux

Cheers!
Nitro
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #166 on: March 12, 2016, 11:23:52 am »
@Nitroxide,

Nice work. The name  'Rosebud' has been seen before in FLIR cameras. The password on many FLIR cameras was a Swedish word but 'Indigo' is a nod to the company, Indigo Systems that FLIR bought in 2003.

Indigo Systems were a specialist in compact thermal cameras and experts in microbolometers, image processing and novel camera design. FLIR wanted that specialist knowledge, so bought them.

http://www.flir.com/corporate/display/?id=55679

Fraser
« Last Edit: March 12, 2016, 11:28:49 am by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline nitroxide

  • Contributor
  • Posts: 26
Re: Question about FLIR One for Android
« Reply #167 on: March 12, 2016, 11:36:39 am »
@Fraser Yep, definitely not without reason

In case anyone was curious, here's a dmesg output:

Code: [Select]
$ dmesg
[    0.000000] Linux version 2.6.39+ (nightly@rosebud-dev) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #5 Fri Sep 4 16:01:23 PDT 2015
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Atmel AT91SAM9X5-EK
[    0.000000] Ignoring tag cmdline (using the default kernel command line)
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat c071ada8, node_mem_map c0729000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16256 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: mem=64M mtdparts=atmel_nand:50M(rosebud),14M(shared_files),12M(kernel),37M(rootfs),14M(shared_files2) rw atmel_nand.use_dma=0 quiet
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 64MB = 64MB total
[    0.000000] Memory: 57600k/57600k available, 7936k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     DMA     : 0xff000000 - 0xffe00000   (  14 MB)
[    0.000000]     vmalloc : 0xc4800000 - 0xfee00000   ( 934 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .init : 0xc0008000 - 0xc0482000   (4584 kB)
[    0.000000]       .text : 0xc0482000 - 0xc06fe508   (2546 kB)
[    0.000000]       .data : 0xc0700000 - 0xc071b4a0   ( 110 kB)
[    0.000000] NR_IRQS:192
[    0.000000] AT91: 128 gpio irqs in 4 banks
[    0.000000] AT91: Disabled rtc irq
[    0.000000] console [ttyS0] enabled
[    0.000000] Calibrating delay loop... 197.88 BogoMIPS (lpj=98944)
[    0.011000] pid_max: default: 32768 minimum: 301
[    0.011000] Mount-cache hash table entries: 512
[    0.012000] CPU: Testing write buffer coherency: ok
[    0.019000] NET: Registered protocol family 16
[    0.025000] AT91: CM rev B and higher
[    0.029000] AT91: Configured PCK0 clock output to 25000000 Hz
[    0.029000] BT: PCK0 on PB10 = 74
[    0.037000] BT: gpios initialized
[    0.037000] AT91: pin-mux CS0
[    0.037000] AT91: pin-mux CS2
[    0.037000] AT91: EK rev B and higher
[    0.044000] AT91: Power Management (with slow clock mode)
[    0.044000] AT91: Starting after general reset
[    0.045000] tcb_clksrc: tc0 at 16.166 MHz
[    0.068000] bio: create slab <bio-0> at 0
[    0.070000] usbcore: registered new interface driver usbfs
[    0.071000] usbcore: registered new interface driver hub
[    0.072000] usbcore: registered new device driver usb
[    0.075000] i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL)
[    0.075000] at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels
[    0.080000] at_hdmac at_hdmac.1: Atmel AHB DMA Controller ( cpy slave ), 8 channels
[    0.086000] Switching to clocksource tcb_clksrc
[    0.092000] NET: Registered protocol family 1
[    0.206000] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.206000] msgmni has been set to 112
[    0.207000] io scheduler noop registered (default)
[    0.217000] atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
[    0.224000] brd: module loaded
[    0.236000] atmel_nand atmel_nand: No DMA support for NAND access.
[    0.236000] ONFI flash detected
[    0.237000] ONFI param page 0 valid
[    0.237000] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xa1 (Micron MT29F1G08ABBEA3W)
[    0.237000] atmel_pmecc_init_params
[    0.237000] nand_chip->ecc.bytes 28
[    0.237000] nand_chip->ecc.steps 1
[    0.237000] nand_chip->ecc.layout = pmecc_oobinfo_2048
[    0.237000] host->mm 13
[    0.237000] host->nn 8191
[    0.237000] host->tt 4
[    0.237000] host->sector_size 512
[    0.237000] host->sector_number 4
[    0.237000] host->ecc_bytes_per_sector 7
[    0.237000] host->alpha_to -996098048
[    0.237000] host->index_of -996114432
[    0.237000] Scanning device for bad blocks
[    0.297000] 5 cmdlinepart partitions found on MTD device atmel_nand
[    0.297000] Creating 5 MTD partitions on "atmel_nand":
[    0.297000] 0x000000000000-0x000003200000 : "rosebud"
[    0.301000] 0x000003200000-0x000004000000 : "shared_files"
[    0.304000] 0x000004000000-0x000004c00000 : "kernel"
[    0.307000] 0x000004c00000-0x000007100000 : "rootfs"
[    0.311000] 0x000007100000-0x000007f00000 : "shared_files2"
[    0.316000] SPI MR: 0x33
[    0.317000] atmel_spi atmel_spi.0: Using dma0chan0 (tx) and  dma0chan1 (rx) for DMA transfers
[    0.317000] atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13, SR 0x00010202)
[    0.317000] SPI turning on CSAAT
[    0.318000] setup: 22222222 Hz bpw 8 mode 0x3 -> csr0 00000609
[    0.319000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.319000] ehci_hcd: block sizes: qh 60 qtd 96 itd 160 sitd 96
[    0.319000] Initializing Atmel-SoC USB Host Controller
[    0.319000] atmel-ehci atmel-ehci: start
[    0.320000] atmel-ehci atmel-ehci: Atmel EHCI UHP HS
[    0.320000] atmel-ehci atmel-ehci: new USB bus registered, assigned bus number 1
[    0.320000] atmel-ehci atmel-ehci: reset hcs_params 0x1303 dbg=0 cc=1 pcc=3 ordered !ppc ports=3
[    0.320000] atmel-ehci atmel-ehci: reset hcc_params 0026 thresh 2 uframes 256/512/1024 park
[    0.320000] atmel-ehci atmel-ehci: park 0
[    0.320000] atmel-ehci atmel-ehci: reset command 0080b02  park=3 ithresh=8 period=1024 Reset HALT
[    0.320000] atmel-ehci atmel-ehci: irq 22, io mem 0x00700000
[    0.320000] atmel-ehci atmel-ehci: reset command 0080b02  park=3 ithresh=8 period=1024 Reset HALT
[    0.321000] atmel-ehci atmel-ehci: init command 0010005 (park)=0 ithresh=1 period=512 RUN
[    0.327000] atmel-ehci atmel-ehci: USB 2.0 started, EHCI 1.00
[    0.327000] usb usb1: default language 0x0409
[    0.327000] usb usb1: udev 1, busnum 1, minor = 0
[    0.327000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.327000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.327000] usb usb1: Product: Atmel EHCI UHP HS
[    0.327000] usb usb1: Manufacturer: Linux 2.6.39+ ehci_hcd
[    0.327000] usb usb1: SerialNumber: atmel-ehci
[    0.328000] usb usb1: usb_probe_device
[    0.328000] usb usb1: configuration #1 chosen from 1 choice
[    0.328000] usb usb1: adding 1-0:1.0 (config #1, interface 0)
[    0.329000] hub 1-0:1.0: usb_probe_interface
[    0.329000] hub 1-0:1.0: usb_probe_interface - got id
[    0.329000] hub 1-0:1.0: USB hub found
[    0.329000] hub 1-0:1.0: 3 ports detected
[    0.329000] hub 1-0:1.0: standalone hub
[    0.329000] hub 1-0:1.0: no power switching (usb 1.0)
[    0.329000] hub 1-0:1.0: individual port over-current protection
[    0.329000] hub 1-0:1.0: power on to power good time: 20ms
[    0.329000] hub 1-0:1.0: local power source is good
[    0.330000] hub 1-0:1.0: trying to enable port power on non-switchable hub
[    0.331000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.331000] ohci_hcd: block sizes: ed 64 td 64
[    0.332000] at91_ohci at91_ohci: start
[    0.332000] at91_ohci at91_ohci: AT91 OHCI
[    0.332000] at91_ohci at91_ohci: new USB bus registered, assigned bus number 2
[    0.332000] at91_ohci at91_ohci: supports USB remote wakeup
[    0.332000] at91_ohci at91_ohci: irq 22, io mem 0x00600000
[    0.332000] at91_ohci at91_ohci: created debug files
[    0.387000] at91_ohci at91_ohci: OHCI controller state
[    0.387000] at91_ohci at91_ohci: OHCI 1.0, NO legacy support registers
[    0.387000] at91_ohci at91_ohci: control 0x083 HCFS=operational CBSR=3
[    0.387000] at91_ohci at91_ohci: cmdstatus 0x00000 SOC=0
[    0.387000] at91_ohci at91_ohci: intrstatus 0x00000004 SF
[    0.387000] at91_ohci at91_ohci: intrenable 0x8000005a MIE RHSC UE RD WDH
[    0.387000] at91_ohci at91_ohci: hcca frame #0005
[    0.387000] at91_ohci at91_ohci: roothub.a 02000203 POTPGT=2 NPS NDP=3(3)
[    0.387000] at91_ohci at91_ohci: roothub.b 00000000 PPCM=0000 DR=0000
[    0.387000] at91_ohci at91_ohci: roothub.status 00008000 DRWE
[    0.387000] at91_ohci at91_ohci: roothub.portstatus [0] 0x00000100 PPS
[    0.387000] at91_ohci at91_ohci: roothub.portstatus [1] 0x00000100 PPS
[    0.387000] at91_ohci at91_ohci: roothub.portstatus [2] 0x00000100 PPS
[    0.387000] usb usb2: default language 0x0409
[    0.387000] usb usb2: udev 1, busnum 2, minor = 128
[    0.387000] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    0.387000] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.387000] usb usb2: Product: AT91 OHCI
[    0.387000] usb usb2: Manufacturer: Linux 2.6.39+ ohci_hcd
[    0.387000] usb usb2: SerialNumber: at91
[    0.389000] usb usb2: usb_probe_device
[    0.389000] usb usb2: configuration #1 chosen from 1 choice
[    0.389000] usb usb2: adding 2-0:1.0 (config #1, interface 0)
[    0.390000] hub 2-0:1.0: usb_probe_interface
[    0.390000] hub 2-0:1.0: usb_probe_interface - got id
[    0.390000] hub 2-0:1.0: USB hub found
[    0.390000] hub 2-0:1.0: 3 ports detected
[    0.390000] hub 2-0:1.0: standalone hub
[    0.390000] hub 2-0:1.0: no power switching (usb 1.0)
[    0.390000] hub 2-0:1.0: global over-current protection
[    0.390000] hub 2-0:1.0: power on to power good time: 4ms
[    0.390000] hub 2-0:1.0: local power source is good
[    0.390000] hub 2-0:1.0: no over-current condition exists
[    0.390000] hub 2-0:1.0: trying to enable port power on non-switchable hub
[    0.392000] atmel_usba_udc atmel_usba_udc: MMIO registers at 0xf803c000 mapped at c4876000
[    0.392000] atmel_usba_udc atmel_usba_udc: FIFO at 0x00500000 mapped at c4900000
[    0.393000] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
[    0.394000] at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
[    0.394000] AT91 Real Time Clock driver.
[    0.394000] i2c /dev entries driver
[    0.395000] Linux media interface: v0.10
[    0.396000] Linux video capture interface: v2.00
[    0.401000] usbcore: registered new interface driver uvcvideo
[    0.402000] USB Video Class driver (v1.0.0)
[    0.402000] AT91SAM9 Watchdog: sorry, watchdog is disabled
[    0.407000] at91_wdt: probe of at91_wdt failed with error -5
[    0.410000] at91_rtc at91_rtc: setting system clock to 2007-01-01 00:00:17 UTC (1167609617)
[    0.413000] Freeing init memory: 4584K
[    0.430000] atmel-ehci atmel-ehci: GetStatus port:2 status 001803 0  ACK POWER sig=j CSC CONNECT
[    0.430000] hub 1-0:1.0: port 2: status 0501 change 0001
[    0.490000] hub 2-0:1.0: state 7 ports 3 chg 0000 evt 0000
[    0.530000] hub 1-0:1.0: state 7 ports 3 chg 0004 evt 0000
[    0.530000] hub 1-0:1.0: port 2, status 0501, change 0000, 480 Mb/s
[    0.555000] Empty flash at 0x000001b0 ends at 0x00000800
[    0.581000] atmel-ehci atmel-ehci: port 2 high speed
[    0.581000] atmel-ehci atmel-ehci: GetStatus port:2 status 001005 0  ACK POWER sig=se0 PE CONNECT
[    0.632000] usb 1-2: new high speed USB device number 2 using atmel-ehci
[    0.680000] Major: 252; minor: 0
[    0.680000] Registered device at91_adc.
[    0.684000] atmel-ehci atmel-ehci: port 2 high speed
[    0.684000] atmel-ehci atmel-ehci: GetStatus port:2 status 001005 0  ACK POWER sig=se0 PE CONNECT
[    0.788000] usb 1-2: skipped 1 descriptor after configuration
[    0.788000] usb 1-2: skipped 6 descriptors after interface
[    0.788000] usb 1-2: skipped 1 descriptor after endpoint
[    0.788000] usb 1-2: skipped 9 descriptors after interface
[    0.789000] usb 1-2: default language 0x0409
[    0.795000] usb 1-2: udev 2, busnum 1, minor = 1
[    0.795000] usb 1-2: New USB device found, idVendor=0c45, idProduct=6369
[    0.795000] usb 1-2: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[    0.795000] usb 1-2: Product: USB 2.0 Camera
[    0.795000] usb 1-2: Manufacturer: Sonix Technology Co., Ltd.
[    0.802000] usb 1-2: usb_probe_device
[    0.802000] usb 1-2: configuration #1 chosen from 1 choice
[    0.802000] usb 1-2: adding 1-2:1.0 (config #1, interface 0)
[    0.807000] uvcvideo 1-2:1.0: usb_probe_interface
[    0.807000] uvcvideo 1-2:1.0: usb_probe_interface - got id
[    0.807000] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45:6369)
[    0.842000] usb 1-2: adding 1-2:1.1 (config #1, interface 1)
[    1.454000] at91_ohci at91_ohci: auto-stop root hub
[    1.594000] usb 1-2: link qh4-0001/c32407a0 start 1 [1/0 us]
[    1.695000] lepton_init
[    1.698000] tx_buf = c3328000 rx_buf = c3330000, frames = bf006f74
[    1.703000] lepton_probe: using 16-bit SPI width
[    1.708000] SPI turning on CSAAT
[    1.708000] setup: 22222222 Hz bpw 16 mode 0x3 -> csr0 00000689
[    1.714000] VSYNC [4294669010]
[    1.718000] lepton: bad line index, last line index 255 != expected index 60
[    1.718000] lepton status = 3 xfer 4 [4294669014]
[    8.156000] usb 1-2: unlink qh4-0001/c32407a0 start 1 [1/0 us]
[    8.156000] atmel-ehci atmel-ehci: shutdown urb c320cac0 ep3in-intr
$
 

Offline Bill W

  • Super Contributor
  • ***
  • Posts: 1102
  • Country: gb
    • Fire TICS
Re: Question about FLIR One for Android
« Reply #168 on: March 12, 2016, 05:44:43 pm »
I wonder how many folks from Indigo are now with SEEK ?  Far too much of a coincidence I reckon.

Fired up an old Indigo Alpha core the other day, surprisingly poor for a VOx with a lot of column structure, how far they have come.  Even then it was very compact though.  The oddest feature of that was the external shutter.
A 2005 paper about early VOX bolometers :
http://www.flir.com/uploadedFiles/CBI/Documents/Technical_Publications/2005SPIE/techpub_2_Photon_SPIE_2005.pdf
It must be early, they were still being honest about NETD's  >:D

Bill

www.fire-tics.co.uk



Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #169 on: March 12, 2016, 08:10:23 pm »
FLIR were certainly annoyed when the two ex Indigo staff started SEEK Thermal. A complex situation that ended in court.

I was always interested that FLIR enforced disablement of every 15th pixel on the SEEK 12um microbolometer. At the time I suspected the FLIR & SEEK 12um microbolometers were likely the product of a single research work  stream within FLIR.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #170 on: March 13, 2016, 01:13:56 pm »
     I've dumped the NAND from uboot and done some poking around with binwalk and recovered the root password.

     If anyone wants to check it out login with (root:indigo):

interesting :-+
In the Flir One SDK library I can't find the strings root:indigo.
There is only the well known Flir login root:3vlig
Code: [Select]
$ strings FLIRONEExampleApplication/app/src/main/libs/armeabi-v7a/libjnidevicewrapper.so  | grep -Fx -A1 root
root
3vlig

In the FlirOneApp the functions of the "SDK library libjnidevicewrapper.so" is splittet in a libjnidevicewrapper.so and a libsystemimage.so.
The FlirOneApp handles also the firmware updates of the Flir One.
Code: [Select]
$ strings FlirOne/apk/FlirOne/lib/armeabi-v7a/libsystemimage.so | grep -Fx -A1 root
root
3vlig

Offline nitroxide

  • Contributor
  • Posts: 26
Re: Question about FLIR One for Android
« Reply #171 on: March 13, 2016, 06:50:07 pm »
@tomas123 Could be something left out in their SDK? I don't think the smartphones handling the updates do any logging in on the F1G2..

There's a separate kernel image for the updater but I've checked now with 3vlig and the password for that one is indigo as well.
Fun fact: the indigo password was hashed but unsalted so it only took John the Ripper a few seconds to crack :)

I may do a dump of all folders from both images if I get some time next week but that'll need some fiddling around with serial file transfer.

Nitro
 

Offline eren

  • Newbie
  • Posts: 4
  • Country: tr
Re: Question about FLIR One for Android
« Reply #172 on: March 15, 2016, 05:41:49 pm »
Hi all,

amazing work on this thread! I am continually blown away by the casually colossal magnitude of work done here  :-+   

I'm just catching up with the capabilities, and running the F1 on Raspbian. Every once in a while I'm getting these stretches of rainbow frames where the FFC apparently gets in a bad state, and I have to wait until the next automatic FFC to clear it up. There is nothing coming from the 0x81, 0x83 or 0x85 endpoints to indicate we're entering a bad state. I'd like to try inducing an FFC state, at first periodically, any maybe later when I detect this state by pixel standard deviation etc. I can see manual FFC commands in the SDK, but no way to do that manually using libusb. Anybody have any ideas on how to manually trigger FFC by writing to USB endpoints?

Cheers
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #173 on: March 16, 2016, 09:48:53 pm »
There is nothing coming from the 0x81, 0x83 or 0x85 endpoints to indicate we're entering a bad state.
The stretches of of rainbow frames are reflections of the temperature of warm lepton on the shutter ;)
I wrote here something about trigger the FFC:
...The blue line is the average temperature of 2x2=4 center pixels. The measured temperature was a wall with a constant temperature over the hour.
The F1 G2 needs 10 minutes until stabilization.
The vertical green lines mark the FFC shutter movements.

The shutter interval is constant 135 seconds after 5 minutes runtime.

watch for combination of "shutterState" AND "ffcState" on EP 0x85
Code: [Select]
#000373 77/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.09764,"usbEnqueuedTimestamp":1176999451.09942,"ffcState":"FFC_VALID_RAD"}
#000374 77/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.2123,"usbEnqueuedTimestamp":1176999451.21411,"ffcState":"FFC_VALID_RAD"}
#000375 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.32683,"usbEnqueuedTimestamp":1176999451.32872,"ffcState":"FFC_VALID_RAD"}
#000376 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.43988,"usbEnqueuedTimestamp":1176999451.44173,"ffcState":"FFC_VALID_RAD"}
#000377 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.55378,"usbEnqueuedTimestamp":1176999451.55576,"ffcState":"FFC_VALID_IMG"}
#000378 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.66878,"usbEnqueuedTimestamp":1176999451.67105,"ffcState":"FFC_VALID_IMG"}
#000379 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.7818,"usbEnqueuedTimestamp":1176999451.78388,"ffcState":"FFC_DESIRED"}
#000380 79/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.8954,"usbEnqueuedTimestamp":1176999451.89716,"ffcState":"FFC_DESIRED"}
#000381 78/10 fps:{"shutterState":"ON","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.01968,"usbEnqueuedTimestamp":1176999452.0214,"ffcState":"FFC_PROGRESS"}
#000382 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.35303,"usbEnqueuedTimestamp":1176999452.35494,"ffcState":"FFC_VALID_RAD"}
#000383 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.46615,"usbEnqueuedTimestamp":1176999452.46842,"ffcState":"FFC_VALID_RAD"}
#000384 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.57972,"usbEnqueuedTimestamp":1176999452.58159,"ffcState":"FFC_VALID_RAD"}
#000385 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999452.69317,"usbEnqueuedTimestamp":1176999452.6951,"ffcState":"FFC_VALID_RAD"}
#000386 72/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.16082,"usbEnqueuedTimestamp":1176999453.16271,"ffcState":"FFC_VALID_RAD"}
#000387 70/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.37775,"usbEnqueuedTimestamp":1176999453.38077,"ffcState":"FFC_VALID_RAD"}
#000388 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.49103,"usbEnqueuedTimestamp":1176999453.4927,"ffcState":"FFC_VALID_RAD"}
#000389 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.60539,"usbEnqueuedTimestamp":1176999453.60742,"ffcState":"FFC_VALID_RAD"}
#000390 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.71995,"usbEnqueuedTimestamp":1176999453.72604,"ffcState":"FFC_VALID_RAD"}



Anybody have any ideas on how to manually trigger FFC by writing to USB endpoints?

You can simple debug all USB commands with the Flir SDK by using the extracted flir java.class.
Set a breakpoint in FLIROneSDKBundle/FLIRONEExampleApplication/app/src/main/java/com/flir/flironesdk/usb/UsbCommunicator.java
in function    public void sendDataToDevice(byte[] data, ProtocolType protocolType)
on             sendData(destinationEndpoint, data, data.length);
and watch for array "data"


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

as sample the tune command
{"type":"setOption","data":{"option":"doFFC","value":true}}
Code: [Select]
data = {byte[60]@21045}
0 = 123 (0x7B)
1 = 34 (0x22)
2 = 116 (0x74)
3 = 121 (0x79)
4 = 112 (0x70)
5 = 101 (0x65)
6 = 34 (0x22)
7 = 58 (0x3A)
8 = 34 (0x22)
9 = 115 (0x73)
10 = 101 (0x65)
11 = 116 (0x74)
12 = 79 (0x4F)
13 = 112 (0x70)
14 = 116 (0x74)
15 = 105 (0x69)
16 = 111 (0x6F)
17 = 110 (0x6E)
18 = 34 (0x22)
19 = 44 (0x2C)
20 = 34 (0x22)
21 = 100 (0x64)
22 = 97 (0x61)
23 = 116 (0x74)
24 = 97 (0x61)
25 = 34 (0x22)
26 = 58 (0x3A)
27 = 123 (0x7B)
28 = 34 (0x22)
29 = 111 (0x6F)
30 = 112 (0x70)
31 = 116 (0x74)
32 = 105 (0x69)
33 = 111 (0x6F)
34 = 110 (0x6E)
35 = 34 (0x22)
36 = 58 (0x3A)
37 = 34 (0x22)
38 = 100 (0x64)
39 = 111 (0x6F)
40 = 70 (0x46)
41 = 70 (0x46)
42 = 67 (0x43)
43 = 34 (0x22)
44 = 44 (0x2C)
45 = 34 (0x22)
46 = 118 (0x76)
47 = 97 (0x61)
48 = 108 (0x6C)
49 = 117 (0x75)
50 = 101 (0x65)
51 = 34 (0x22)
52 = 58 (0x3A)
53 = 116 (0x74)
54 = 114 (0x72)
55 = 117 (0x75)
56 = 101 (0x65)
57 = 125 (0x7D)
58 = 125 (0x7D)
59 = 0 (0x0)
protocolType = {UsbCommunicator$ProtocolType@20949} "CONFIGURATION"

PS: Please don't forget to post your knowledge here!

Offline eren

  • Newbie
  • Posts: 4
  • Country: tr
Re: Question about FLIR One for Android
« Reply #174 on: March 18, 2016, 05:31:24 pm »
Hi Tomas,

thanks a bunch for your suggestion -- it worked!  :-+  after dumping the data argument of sendDataToDevice and tinkering with the app, I got the following code to trigger FFC frames:

Code: [Select]
unsigned char my_string2[16]={0xcc,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xb9,0xcb,0xa2,0x99};

                r = libusb_bulk_transfer(devh, 2, my_string2, length, &transferred, 0);
                if(r == 0 && transferred == length)
                    printf("\nWrite successful!");
                else
                    printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

                char my_string[128];
                transferred = 0;

                strcpy(my_string, "{\"type\":\"setOption\",\"data\":{\"option\":\"doFFC\",\"value\":true}}");
                length = strlen(my_string)+1;

                unsigned char *my_string1 = (unsigned char*)my_string;

                transferred = 0;

                r = libusb_bulk_transfer(devh, 2, my_string1, length, &transferred, 0);
                if(r == 0 && transferred == length)
                {
                    printf("\nWrite successful!");
                    printf("\nSent %d bytes with string: %s\n", transferred, my_string);
                }
                else
                    printf("\nError in write! res = %d and transferred = %d\n", r, transferred);
* note that I'm sending two messages -- the clear string doesn't work without the binary "pre-message"  ???


unfortunately, this didn't clear up the "rainbow frames", which sort of look like the attached image.

Even after I remove FFC frames, I also see the "wavy" pixel intensity behavior you see (also attached graph). You can also see the "rainbow frames" where the frame max/mean go up  by a few hundred intensity values and stay up for a few hundred frames.

This behavior persists even if I uplug and restart the camera. I'm guessing it has to do with overheating -- I'm using the camera on continual charge, and while I don't always get the flashing red light I do sooner or later always end up with rainbow frames. Seeing as how reboots don't help I'm guessing it might be a hardware issue, so it'll probably be with us until FLIR find a firmware workaround.

Thanks a bunch! Didn't solve the immediate issue, but learned a lot  ;D
Eren

« Last Edit: March 18, 2016, 05:33:53 pm by eren »
 

Offline Clay

  • Newbie
  • Posts: 1
  • Country: us
Re: Question about FLIR One for Android
« Reply #175 on: March 18, 2016, 07:15:20 pm »
I'm guessing it has to do with overheating -- I'm using the camera on continual charge, and while I don't always get the flashing red light I do sooner or later always end up with rainbow frames.

It may be caused by the battery heating up.

Attached is an image I took after triggering the shutter a bunch of times in a short time span.
You can see a thermal gradient across the image.  I am guessing that the motor for the shutter is near the corner of the sensor and that it is heating up.
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Question about FLIR One for Android
« Reply #176 on: March 18, 2016, 09:22:25 pm »
Bookmarking because I've finally given up waiting for F1G2 to be in stock and backordered. Hopefully I get one the first week of April  :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #177 on: March 19, 2016, 12:33:44 am »
I can't confirm the temperature gradient (rainbow).
My F1G2 runs several days by continuous battery charging at 20°C room temperature without problems, but I noticed a really battery heating like a fast charging smartphone.



I'm worried about the duration of the shutter mechanism (640 movements daily)

Offline eren

  • Newbie
  • Posts: 4
  • Country: tr
Re: Question about FLIR One for Android
« Reply #178 on: March 21, 2016, 10:50:28 am »
Interesting -- what's your shutter temperature after a full days run? Is your LED indicator blinking red at any point? I will get the red blinking every time after I run it for 3-5 hours, and start seeing something like Clay's sample frame fairly regularly. I also see that the FFC process starts taking longer -- I'm guessing that when I see the rainbow frames, the FFC has failed.

The shutter motor heating up sounds like a likely scenario, but I'd also suspect the battery overheating during charging. If only there were a way to disengage the battery entirely when plugged into DC power...  ???
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #179 on: March 21, 2016, 09:55:53 pm »
Interesting -- what's your shutter temperature after a full days run? Is your LED indicator blinking red at any point?

yes, the LED is blinking red :(

I can't give a better answer for shutter temperature as described here
https://www.eevblog.com/forum/thermal-imaging/flir-one-thermal-imaging-camera-teardown-and-hacks/msg848878/#msg848878

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #180 on: April 04, 2016, 09:25:49 pm »
Hello, I have a problem saving different types of files, I did this code:

Code: [Select]
                    try {

                            lastSavedPath = path + "/" + "Thermal+" + fileName;
                            renderedImage.getFrame().save(new File(lastSavedPath), RenderedImage.Palette.Iron, RenderedImage.ImageType.ThermalRGBA8888Image);


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


                                        }

                                    });

                    }catch (Exception e){
                        e.printStackTrace();
                    }

                    try{

                            lastSavedPath = path + "/" + "RGB+" + fileName;
                            renderedImage.getFrame().save(new File(lastSavedPath), RenderedImage.Palette.Iron, RenderedImage.ImageType.VisualYCbCr888Image);

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

                                        }

                                    });

                    }catch (Exception e){
                        e.printStackTrace();
                    }


But I don't know why one time save the RGB photo, another time save the thermal photo and another time save the both files  :wtf:
« Last Edit: April 04, 2016, 10:09:08 pm by sadae »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #181 on: April 04, 2016, 10:15:56 pm »
Ah, now you found the *.raw files in your folder /pictures?
You must switch to the 14 Bit View  ;)

A better forum for questions about the Flir SDK is
http://developer.flir.com/forums/forum/flir-one-developer-community/general-discussion/

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #182 on: April 05, 2016, 07:10:19 am »
Ah, now you found the *.raw files in your folder /pictures?
You must switch to the 14 Bit View  ;)

A better forum for questions about the Flir SDK is
http://developer.flir.com/forums/forum/flir-one-developer-community/general-discussion/

Yes, finally I installed a raw viewer, this was my problem. But about save the other images do you know any idea? Thanks!

Edit: I discovered that I have to change the image mode in the Change View to save the raw, for example if I choose the Thermal Linear 14Bit in the Change View the App take a photo with this image mode. But if the view is Blended the app doesn't take any Thermal Linear photo. Someone know how to fix it?

Edit2: Now when I take a Thrmal Linear 14Bit image appear the raw empty, with a size of only 35kB...  :'(
« Last Edit: April 05, 2016, 07:43:12 am by sadae »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #183 on: April 05, 2016, 10:04:48 am »
the RAW is not empty:
160x120x2=38.400 Byte

use ImageMagick (Q16 = 16 Bit) and convert the RAW to a real image
Code: [Select]
convert -size 120x160  -depth 16 gray:ir.raw 120x160.png
see my signature for more informations

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #184 on: April 05, 2016, 12:01:43 pm »
the RAW is not empty:
160x120x2=38.400 Byte

use ImageMagick (Q16 = 16 Bit) and convert the RAW to a real image
Code: [Select]
convert -size 120x160  -depth 16 gray:ir.raw 120x160.png
see my signature for more informations

Oh, thanks!  :palm: One question more, I'm trying to use this raw image in Flir Tools, I converted the image to .jpg and the software can read it, but can't do nothing with the image because all the metadata disappear. Is this maybe related with my conversor?

And one doubt more, I saw that the Flir E8 do multispectral images, could the Flir One do it? Someone know how to create a multispectral .jpg using the RGB camera and the Thermal camera of the FLir One?

Do you know a visualizer app to visualize the .raw file in Android?
« Last Edit: April 05, 2016, 12:22:22 pm by sadae »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #185 on: April 05, 2016, 12:33:19 pm »
You must rebuild a Flir thermal jpg.
See my signature: "Flir panorama images"

I saw that the Flir E8 do multispectral images, could the Flir One do it? Someone know how to create a multispectral .jpg using the RGB camera and the Thermal camera of the FLir One?
I don't understand the question. The Flir One App can only makes this MSX images...

If you want make own MSX images with Imagemagick see my signature "Flir images with Exiftool+ImageMagick"
Code: [Select]
--msx               Flir MSX Mode for PiP
--shade             Flir MSX Mode for PiP with amboss effect

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #186 on: April 05, 2016, 01:52:52 pm »
You must rebuild a Flir thermal jpg.
See my signature: "Flir panorama images"

I saw that the Flir E8 do multispectral images, could the Flir One do it? Someone know how to create a multispectral .jpg using the RGB camera and the Thermal camera of the FLir One?
I don't understand the question. The Flir One App can only makes this MSX images...

If you want make own MSX images with Imagemagick see my signature "Flir images with Exiftool+ImageMagick"
Code: [Select]
--msx               Flir MSX Mode for PiP
--shade             Flir MSX Mode for PiP with amboss effect

Yes, the Flir One App do this MSX images, but my objective is change the Blended MSX for the 14-Bit Linear image, and then load this image with Flir Tools as the MSX image. Is that possible?

Edit: I continue with my develop and I found that using the ThermalRadiometricKelvinImage can to know the temperature of one pixel of the image, as the Flir One App. In the EditorActivity.java I have this code:

Code: [Select]
else if (renderedImage.imageType() == RenderedImage.ImageType.ThermalRadiometricKelvinImage) {
                    double averageTemp = 0;
                    short[] shortPixels = new short[renderedImage.pixelData().length / 2];
                    ByteBuffer.wrap(renderedImage.pixelData()).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shortPixels);
                    for (int i = 0; i < shortPixels.length; i++) {
                        averageTemp += (((int)shortPixels[i]) - averageTemp) / ((double) i + 1);
                    }
                    final double averageC = (averageTemp / 100) - 273.15;
                    Log.i("Tempera", String.valueOf(averageC));
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Log.i("Tempera", String.valueOf(averageC));
                            Toast.makeText(getApplicationContext(), "Average Temperature = " + averageC + "ºC", Toast.LENGTH_LONG).show();
                        }
                    });

But in any moment I get a Log or a Toast of this function. Do you know if I have to change something to get the average temperature in this case?
« Last Edit: April 05, 2016, 02:46:51 pm by sadae »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #187 on: April 05, 2016, 02:48:47 pm »

Yes, the Flir One App do this MSX images, but my objective is change the Blended MSX for the 14-Bit Linear image, and then load this image with Flir Tools as the MSX image. Is that possible?

YES!!

You are a hard nut  ;)
I give you all necessary links and you ask the same question.

todo list:
- get a vga image
- get a thermal 14 bit image
- get a real Flir Thermal Image
- inject vga and 14Bit image in Flir Thermal Image
- edit the ratio factor between real/thermal and the offset for best fit
Code: [Select]
>exiftool -Real* -Offset* ir.jpg
Real 2 IR                       : 1.23121082782745
Offset X                        : +5
Offset Y                        : -35

Thats all.
Now you can open this new thermal image with Flir Tools.

clarification: enlarge the border of the vga image for uncropped FOV (field of view) of the thermal image

You need some changes in my panorama script for additional injection of the real image.
Read the exiftool source code
http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-10.10/lib/Image/ExifTool/FLIR.pm

simplification:
If you take the FlirThermal jpg and the 14Bit RAW frome the same scene, then you must only inject the 14Bit image.
But don't delete the embedded real image (FLIR Record 0x2a and 0x0e)
Code: [Select]
>exiftool -v2  ir.jpg | grep -A1 Record
  | | FLIR Record 0x20, offset 0x0200, length 0x09ac
  | | 0)  CameraInfo (SubDirectory) -->
--
  | | FLIR Record 0x22, offset 0x0bac, length 0x0310
  | | 1)  PaletteInfo (SubDirectory) -->
--
  | | FLIR Record 0x21, offset 0x0ebc, length 0x0038
  | | 2)  MeasurementInfo (SubDirectory) -->
--
  | | FLIR Record 0x01, offset 0x0ef4, length 0x25820
  | | 3)  RawData (SubDirectory) -->
--
  | | FLIR Record 0x2a, offset 0x26714, length 0x0060
  | | 4)  PiP (SubDirectory) -->
--
  | | FLIR Record 0x2b, offset 0x26774, length 0x00b8
  | | 5)  GPSInfo (SubDirectory) -->
--
  | | FLIR Record 0x0e, offset 0x2682c, length 0xe1020
  | | 6)  EmbeddedImage (SubDirectory) -->

Please post your result here.

Now make your homeworks... :-+

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #188 on: April 24, 2016, 10:39:40 pm »
Finally got my F1G2 attached to my 3DR Solo drone. Still a WIP but it works....



   ...ken...
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #189 on: April 25, 2016, 12:31:06 am »
I took a look at the FLIR Twitter page today.
https://mobile.twitter.com/flir
They attended a large Fire Fighting exhibition and were demonstrating their new K2 camera....... Of more interest to me, there are pictures of an F1G2 attached to a phone and suspended underneath a drone. They included pictures captured during a flight above people.

Now all we need is a really compact and light weight smart phone to mate with the F1G2 and a means to extract the image data in real time  :)

It is good to see people being innovative with this technology.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #190 on: April 25, 2016, 12:48:57 am »
What Flir doesn't want to acknowledge is that the Flir F1G2 can be used WITHOUT ANDROID or their app or a phone.

Here's a screen shot from a video I just took out in our horse coral, using my drone and F1G2 attached to a PcDuino running linux and the driver tomas123 & I developed.

No MSX either.
Sure, a Bozon or a Vue/Vue Pro would be nice but you can actually afford a F1G2.
« Last Edit: April 25, 2016, 01:06:03 am by cynfab »
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #191 on: April 25, 2016, 03:02:46 am »
What Flir doesn't want to acknowledge is that the Flir F1G2 can be used WITHOUT ANDROID or their app or a phone.

As far as I know, there's no way to use it on a regular PC yet (sorry if I missed anything that might indicate otherwise, there's a TON of posts here so I skipped to the last one to see the latest news, but may have missed something else along the way).
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #192 on: April 25, 2016, 03:18:28 am »
tomas123 & I used "regular pc's" to develop the code.
I do all my testing on a Dell XPS 8900 with the F1G2 plugged into the USB port. Just like I did with my Seek.
linux kernel, libusb, v4l2loopback, gstreamer. All run on my embedded platforms like they do on my desktop.
Oh... did you mean Windoze? sorry, I don't do Windoze, so wouldn't have the slightest clue where to begin.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #193 on: April 25, 2016, 03:59:43 am »
tomas123 & I used "regular pc's" to develop the code.
I do all my testing on a Dell XPS 8900 with the F1G2 plugged into the USB port. Just like I did with my Seek.
linux kernel, libusb, v4l2loopback, gstreamer. All run on my embedded platforms like they do on my desktop.
Oh... did you mean Windoze? sorry, I don't do Windoze, so wouldn't have the slightest clue where to begin.

So you used Linux? Any possibility that you could take what you learned from your experiments, and have a friend who's familiar with programming device drivers for Windows, go ahead and write a Windows driver for the FLIR One? I'd LOVE to get to use it as a LWIR webcam, but I don't know the first thing about using Linux.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #194 on: April 25, 2016, 10:13:39 am »
Hi cynfab,

a great job  :-+ :-+

I see, that you used the 3DR Solo app.
https://play.google.com/store/apps/details?id=com.o3dr.solo.android

3DR Solo only supports GoPro cameras
https://3dr.com/kb/solo-user-manual/ (page 10)

Can you post some details, how do you connect the Flir One G2 as GoPro camera (hardware and software)?

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #195 on: April 25, 2016, 12:11:28 pm »
Hi tomas123,

You remember my PcDuino3 nano experiments, well this is just an extension of that.
The 3DR Solo's "companion computer" has an HDMI input and an ADV7610 HDMI decoder. It accepts all sorts of HDMI input formats.
The Solo can only "control" a GoPro, but it happily accepts the 1280x720p output from my PcDuino3 nano.
The Solo run a Yocto headless distro on an iMx6S. My first thought was to use its USB to connect the Flir One.
Alas, 3DR's source release isn't quite in sync with what they are running. That's another story.
So I strapped the PcDuino to the bottom of the Solo, plugged the HDMI out into where the GoPro connected. A DC-DC converter powers the PcDuino.
I run my own custom 4.3.3 kernel as well as v4l2loopback and our flir8x driver. A gstreamer pipeline takes the visual and thermal images and composits them together.
I built all this with buildroot.
It still has lots and lots of issues, not turn key by any means yet.
   ...ken...
 

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #196 on: April 29, 2016, 09:25:05 am »
Hello, I have more questions  ;D Someone knows how from a MSX image delete the FLIR logo and modify the range temperature of the thermal image to for example 10ºC to 20ºC?

But all this without use the Flir Tools because I only want the thermal image modified, and not the different graphics that it draw in the image  :rant:
 

Offline OrBy

  • Regular Contributor
  • *
  • Posts: 220
Re: Question about FLIR One for Android
« Reply #197 on: April 29, 2016, 07:41:43 pm »
Hello, I have more questions  ;D Someone knows how from a MSX image delete the FLIR logo and modify the range temperature of the thermal image to for example 10ºC to 20ºC?

But all this without use the Flir Tools because I only want the thermal image modified, and not the different graphics that it draw in the image  :rant:

tomas123's wonderful PHP script or one of the directives based off it like BFIC come to mind as having the ability to do such things to FLIR's images.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #198 on: April 30, 2016, 09:17:52 am »
a quick-and-dirty method is to make a (cropped) screenshot from Flir Tools for PC.
Then you have a great image resolution with color scale etc. and without the Flir Logo!
For the php scripts see my footer

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #199 on: April 30, 2016, 09:47:53 am »
a quick-and-dirty method is to make a (cropped) screenshot from Flir Tools for PC.
Then you have a great image resolution with color scale etc. and without the Flir Logo!
For the php scripts see my footer

My first idea was to use the first method  ;D But the problem is that I have more than 1000 MSX images to unify the range temperature  (I'm trying to create a 3D thermal model of an object) and I only need the thermal image with a palette and without the Flir logo and the scale. For this reason I'm trying your php script and execute a loop using this line:

flir.php --rmin 20 --rmax 30 --clut --scale -i flir.jpg -o test1.jpg

But I think that something is wrong because it doesn't create the test1.jpg file.

Thanks for all!
 

Offline faboaic

  • Newbie
  • Posts: 2
  • Country: de
Re: Question about FLIR One for Android
« Reply #200 on: May 30, 2016, 04:38:00 pm »
Hello,
tomas123 and cynfab, thank you so much!
I now have my Cheerson CX-20 ready for flying with flir one and raspberry pi 2.
Different from ken's solution on the solo I do not have an included hdmi video transmitter.
But raspberry pi has video out 'cvbs' that can be connected to a standard 5,8 GHz video transmitter, used e.g. for FPV.
I received that video with 5,8 GHz video receiver, displayed and recorded it with an old Sony DCR-TRV820E Digital8 camcorder.

Here is a YouTube video with the cropped and cut video:

https://youtu.be/ugQJUSyidRg

So the solution is up and running.
But some things might make it even better.

@tomas123
is it possible or would it make sense to stop flir one from calibration all the time repeatedly?
so that color temperature scale is fixed all the time, for example to 10 - 30 degree Celsius or configurable range?
Use case is flying over the field and searching for Bambi that would be hurt or killed while mowing the hay.
with fixed scale I think we would see Bambi more easily.

thanks and regards,
Fabian
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #201 on: May 30, 2016, 07:09:41 pm »
Hi Fabian,
Nice job, glad to see someone else flying with a Flir One.
Here is my latest version of the driver, it has a few "improvements" over the last one posted here.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #202 on: May 30, 2016, 10:05:28 pm »

@tomas123
is it possible or would it make sense to stop flir one from calibration all the time repeatedly?
so that color temperature scale is fixed all the time, for example to 10 - 30 degree Celsius or configurable range?

you can stop the FFC with this (java) command from SDK
SDK/documentation-FLIR-One-Android-1.0.1-HTML/com/flir/flironesdk/Device.html
Quote
setAutomaticTuning
public void setAutomaticTuning(boolean shouldAutomaticallyTune)

Disable or enable the automatic tuning feature of the device. The device defaults to automatic tuning being enabled.
Parameters:
shouldAutomaticallyTune - Set to false to keep the automatic tuning function from being performed. Set to true to re-enable.
this command is converted to this string and send over USB
Code: [Select]
{"type":"setOption","data":{"option":"autoFFC","value":false}}but you need some hex bytes around (i.e. 16 Bytes prequel which begins with "cc 01 00 00 01 00 00 00", checksum etc.).

Best way to get this hex code is to debug the function sendDataToDevice() in the SDK sample code and call a setAutomaticTuning(false). I described it here:

...The blue line is the average temperature of 2x2=4 center pixels. The measured temperature was a wall with a constant temperature over the hour.
The F1 G2 needs 10 minutes until stabilization.
The vertical green lines mark the FFC shutter movements.

The shutter interval is constant 135 seconds after 5 minutes runtime.

watch for combination of "shutterState" AND "ffcState" on EP 0x85
Code: [Select]
#000373 77/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.09764,"usbEnqueuedTimestamp":1176999451.09942,"ffcState":"FFC_VALID_RAD"}
#000374 77/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.2123,"usbEnqueuedTimestamp":1176999451.21411,"ffcState":"FFC_VALID_RAD"}
#000375 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.32683,"usbEnqueuedTimestamp":1176999451.32872,"ffcState":"FFC_VALID_RAD"}
#000376 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.43988,"usbEnqueuedTimestamp":1176999451.44173,"ffcState":"FFC_VALID_RAD"}
#000377 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.55378,"usbEnqueuedTimestamp":1176999451.55576,"ffcState":"FFC_VALID_IMG"}
#000378 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.66878,"usbEnqueuedTimestamp":1176999451.67105,"ffcState":"FFC_VALID_IMG"}
#000379 78/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.7818,"usbEnqueuedTimestamp":1176999451.78388,"ffcState":"FFC_DESIRED"}
#000380 79/10 fps:{"shutterState":"ON","shutterTemperature":310.040008544922,"usbNotifiedTimestamp":1176999451.8954,"usbEnqueuedTimestamp":1176999451.89716,"ffcState":"FFC_DESIRED"}
#000381 78/10 fps:{"shutterState":"ON","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.01968,"usbEnqueuedTimestamp":1176999452.0214,"ffcState":"FFC_PROGRESS"}
#000382 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.35303,"usbEnqueuedTimestamp":1176999452.35494,"ffcState":"FFC_VALID_RAD"}
#000383 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.46615,"usbEnqueuedTimestamp":1176999452.46842,"ffcState":"FFC_VALID_RAD"}
#000384 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.940002441406,"usbNotifiedTimestamp":1176999452.57972,"usbEnqueuedTimestamp":1176999452.58159,"ffcState":"FFC_VALID_RAD"}
#000385 75/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999452.69317,"usbEnqueuedTimestamp":1176999452.6951,"ffcState":"FFC_VALID_RAD"}
#000386 72/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.16082,"usbEnqueuedTimestamp":1176999453.16271,"ffcState":"FFC_VALID_RAD"}
#000387 70/10 fps:{"shutterState":"FFC","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.37775,"usbEnqueuedTimestamp":1176999453.38077,"ffcState":"FFC_VALID_RAD"}
#000388 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.49103,"usbEnqueuedTimestamp":1176999453.4927,"ffcState":"FFC_VALID_RAD"}
#000389 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.60539,"usbEnqueuedTimestamp":1176999453.60742,"ffcState":"FFC_VALID_RAD"}
#000390 71/10 fps:{"shutterState":"ON","shutterTemperature":309.950012207031,"usbNotifiedTimestamp":1176999453.71995,"usbEnqueuedTimestamp":1176999453.72604,"ffcState":"FFC_VALID_RAD"}



Anybody have any ideas on how to manually trigger FFC by writing to USB endpoints?

You can simple debug all USB commands with the Flir SDK by using the extracted flir java.class.
Set a breakpoint in FLIROneSDKBundle/FLIRONEExampleApplication/app/src/main/java/com/flir/flironesdk/usb/UsbCommunicator.java
in function    public void sendDataToDevice(byte[] data, ProtocolType protocolType)
on             sendData(destinationEndpoint, data, data.length);
and watch for array "data"


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

as sample the tune command
{"type":"setOption","data":{"option":"doFFC","value":true}}
Code: [Select]
data = {byte[60]@21045}
0 = 123 (0x7B)
1 = 34 (0x22)
2 = 116 (0x74)
3 = 121 (0x79)
4 = 112 (0x70)
5 = 101 (0x65)
6 = 34 (0x22)
7 = 58 (0x3A)
8 = 34 (0x22)
9 = 115 (0x73)
10 = 101 (0x65)
11 = 116 (0x74)
12 = 79 (0x4F)
13 = 112 (0x70)
14 = 116 (0x74)
15 = 105 (0x69)
16 = 111 (0x6F)
17 = 110 (0x6E)
18 = 34 (0x22)
19 = 44 (0x2C)
20 = 34 (0x22)
21 = 100 (0x64)
22 = 97 (0x61)
23 = 116 (0x74)
24 = 97 (0x61)
25 = 34 (0x22)
26 = 58 (0x3A)
27 = 123 (0x7B)
28 = 34 (0x22)
29 = 111 (0x6F)
30 = 112 (0x70)
31 = 116 (0x74)
32 = 105 (0x69)
33 = 111 (0x6F)
34 = 110 (0x6E)
35 = 34 (0x22)
36 = 58 (0x3A)
37 = 34 (0x22)
38 = 100 (0x64)
39 = 111 (0x6F)
40 = 70 (0x46)
41 = 70 (0x46)
42 = 67 (0x43)
43 = 34 (0x22)
44 = 44 (0x2C)
45 = 34 (0x22)
46 = 118 (0x76)
47 = 97 (0x61)
48 = 108 (0x6C)
49 = 117 (0x75)
50 = 101 (0x65)
51 = 34 (0x22)
52 = 58 (0x3A)
53 = 116 (0x74)
54 = 114 (0x72)
55 = 117 (0x75)
56 = 101 (0x65)
57 = 125 (0x7D)
58 = 125 (0x7D)
59 = 0 (0x0)
protocolType = {UsbCommunicator$ProtocolType@20949} "CONFIGURATION"

PS: Please don't forget to post your knowledge here!


But if you look at the diagram above, you see that there is a large temperature drift, which is compensated by FFC.
I think without autoFFC you have not better conditions for a fixed scale.
I would enlarge the FFC interval from 135 seconds to 10 minutes...

Use case is flying over the field and searching for Bambi that would be hurt or killed while mowing the hay.
:-+ :-+

Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #203 on: July 02, 2016, 08:18:06 am »
is it compatible with a "Sony Xperia Z3+"
 

Offline encryptededdy

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nz
Re: Question about FLIR One for Android
« Reply #204 on: July 02, 2016, 08:45:12 am »
is it compatible with a "Sony Xperia Z3+"
OS: Android 5.0 :)
SoC: Snapdragon 810 :)
USB Port direction: Short side towards screen :)
USB-OTG support: Yes :)
USB Port side: Bottom :)

I'm 99% sure it'll work; I don't see why it wouldn't.
 

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #205 on: July 13, 2016, 09:09:11 am »
Hi to all! I'm trying to get a same range of temperatures (18º to 30º, for example) from the .RAW images of the Flir One.

In this moment I'm executing this code in Windows, installing ImageMagick 6.9.3.-Q16 and exiftool:

for /l %%x in (1, 1, 167) do (
   echo %%x
   convert -size 120x160  -depth 16 gray:%%x.raw %%x.png
   convert %%x.png -auto-level %%x.png
)

//Coloring the images:

exiftool FLIR0080.jpg -b -Palette > pal.raw
convert -size 224X1 -depth 8 YCbCr:pal.raw -separate -swap 1,2 -set colorspace YCbCr -combine -colorspace sRGB pal.png

for /l %%x in (1, 1, 167) do (
   echo %%x
   convert -size 224X1 -depth 8 YCbCr:pal.raw -separate -swap 1,2 -set colorspace YCbCr -combine -colorspace sRGB -auto-level pals.png
   convert %%x.png pals.png -clut ColorBetter%%x.png
)

//Applying the same range of temperatures for all the images:

for /l %%x in (1, 1, 167) do (
   echo %%x
   convert ColorBetter%%x.png -resize 480x -sharpen 0x1 -level 14000,16000 NormColor%%x.png

)


The problem is that whit this code, I continue without have the same range of temperatures in the images, as to do Flir Tools, choosing the real temperature of the images and modifying the palette to show this range of temperatures. Due to this problem MS ICE can't do any type of panorama...

I upload some files to this .rar:
*.RAW images from the Flir One
*.PNG from .RAW images
* Color images applying a color table
* Normalized images with a determinate range of temperature (it doesn't work)
* .BAT of all the process

https://mega.nz/#!BER2ASBK!NuQrYnl9TR97JTmQMEsPAiCPzloNAcQariA4QWO3f6s

PD: You can see in the images NormColor4 and NormColor5 the problem, it is the same wall and change totally the image temperature.
Thanks again!
« Last Edit: July 13, 2016, 09:11:38 am by sadae »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #206 on: July 13, 2016, 09:32:28 am »
Hi sadae,

a great post :-+

I think, your problem is, that your first step is an auto-level of RAW images:
Code: [Select]
convert %%x.png -auto-level %%x.pngcomment it out

The next step is finding your upper and lower level in your images (you use -level 14000,16000, see my footer for more informations)
Then expand your level and feed the MS ICE with 16 bit gray scale images.

Colorize your images after panorama stitchung!

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #207 on: July 13, 2016, 09:45:23 am »
A sample with your 10 RAW images.
I used GnuWin to simulate your windows system  ;)
http://sourceforge.net/projects/gnuwin32/files/

Code: [Select]
>for /l %x in (1, 1, 10) do (convert -size 120x160  -depth 16 gray:%x.raw %xr.png)
(convert -size 120x160  -depth 16 gray:1.raw 1r.png )
(convert -size 120x160  -depth 16 gray:2.raw 2r.png )
(convert -size 120x160  -depth 16 gray:3.raw 3r.png )
...
(convert -size 120x160  -depth 16 gray:7.raw 7r.png )
(convert -size 120x160  -depth 16 gray:8.raw 8r.png )
(convert -size 120x160  -depth 16 gray:9.raw 9r.png )

>identify -verbose *r.png | grep -n5 statist | grep -e "max\|min" | sort -k3 -n | awk "{ if (NR ==1) print} END {print}"
17-      min: 11548 (0.176211)
1976-      max: 18040 (0.275273)

select min/max = 11500 / 18100

a hint:
awk only print the first and last line. You can drop it:

>identify -verbose *r.png | grep -n5 statist | grep -e "max\|min" | sort -k3 -n
17-      min: 11548 (0.176211)
1269-      min: 11640 (0.177615)
698-      min: 11688 (0.178347)
...
3636-      max: 17080 (0.260624)
3033-      max: 17200 (0.262455)
2475-      max: 17908 (0.273259)
1976-      max: 18040 (0.275273)


edit:
I see, that MS ICE has serious trouble to stitch the F1 RAW images with the large distortion of the flir one lens.
Maybe, you need only more overlapping images.




Whats's that?

Offline sadae

  • Newbie
  • Posts: 8
  • Country: es
Re: Question about FLIR One for Android
« Reply #208 on: July 13, 2016, 04:39:11 pm »
Thanks again tomas123 for your great help! I did it!

I had some errors in my code, as you said, and this is my final code:

Code: [Select]

exiftool FLIR0080.jpg -b -Palette > pal.raw
convert -size 224X1 -depth 8 YCbCr:pal.raw -separate -swap 1,2 -set colorspace YCbCr -combine -colorspace sRGB -auto-level pals.png

for /l %%x in (1, 1, 167) do (
echo %%x
convert -size 120x160  -depth 16 gray:%%x.raw %%x.png
convert %%x.png -resize 480x -sharpen 0x1 -level 11500,18100 %%x.png
convert %%x.png pals.png -clut ColorBetter%%x.png
)


Whats's that?

In 1 month I will upload to the forum the results of my thesis in the HSKA  ;) This is a part of a silo, and MS ICE doesn't work for the perspective of the data collection because my idea isn't create a panorama. Now, the only problem that I have is the low resolution of the Flir One and the lack of photos. As you said, I have should taken the photos with more overlap, even repeating photos...

But well, I know it for the next job, I have all my job did it with the Blended MSX photos, but I wanted do the same only with the thermal images from the Flir One.
 

Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #209 on: July 15, 2016, 06:58:51 am »
Does anyone used the flir one already with a OnePlus 3 phone?
 

Offline Trax

  • Regular Contributor
  • *
  • Posts: 124
  • Country: at
Re: Question about FLIR One for Android
« Reply #210 on: July 16, 2016, 10:23:57 am »
I know the plug is mechanically not compatible, but other than a adapter cable all should be fine, right?
 

Online trevwhite

  • Frequent Contributor
  • **
  • Posts: 930
  • Country: gb
Re: Question about FLIR One for Android
« Reply #211 on: July 16, 2016, 12:09:16 pm »
Checking the specs, I reckon it will easily handle it.
 

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #212 on: August 02, 2016, 06:27:40 am »
Hi @all,

It would bee cool to get this work ower usbip!
I try to explain what i want to do.
Right,

I have a drone "Phantom 3 Pro"
now i would connect my Android mini pc with my Flir One "G2" and mount this to my drone.
Then i tested VirtualHere Server https://www.virtualhere.com/android_usb_server and give a try to connect to Raspberry pi 3 linux  client.
Ref: https://www.virtualhere.com/sites/default/files/usbclient/vhclientarmhf

What i want to do with this, i want to controll my Android "Flir One G2 " cam on Linux tablet or raspberry pi via wifi.

I can connect both, but if i start ./flir8p1 xxxx.raw it hangs...

I am not devlopper, so if you need informations on this, please dont hesitate to ask.

Greatings from Luxemburg
Jeng

Edit: i add some screenshots:
« Last Edit: August 02, 2016, 09:17:27 am by jeng »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #213 on: August 02, 2016, 09:13:43 am »
I see use use the last driver from cynfab
Here is my latest version of the driver, it has a few "improvements" over the last one posted here.
flir8p1.zip

Is this pipe correct?
"Phantom 3 Pro" with Android mini pc (Raspberry pi 3) running a "VirtualHere USB Server"  -> wifi ->   Linux tablet with flir8p1 software and VirtualHere USB Client

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #214 on: August 02, 2016, 09:18:52 am »
@tomas123

I just modified my  previous post.
Attached some screenshots.

Here the correct pipe,

"Phantom 3 Pro" with Android mini pc running a "VirtualHere USB Server"  -> wifi ->   Linux tablet or raspberry pi with flir8p1 software and VirtualHere USB Client.
« Last Edit: August 02, 2016, 09:30:09 am by jeng »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #215 on: August 02, 2016, 09:39:50 am »
the flir F1 USB interface it's extreme time critical

As I posted above in this thread, I have not success with connecting a Flir F1 to my Macbook running a virtual linux machine in vmware fusion (some hours of useless work :palm:)

the best way is to run the Flir One  software direct on your "Phantom 3 Pro"

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #216 on: August 02, 2016, 09:45:30 am »
the flir F1 USB interface it's extreme time critical

As I posted above in this thread, I have not success with connecting a Flir F1 to my Macbook running a virtual linux machine in vmware fusion (some hours of useless work :palm:)

Ok, so no way to get this work.
But thank you anyway!

edit: just fyi,
Android server log.
--------- beginning of /dev/log/main
I/vhusbd-boot( 5655): Starting server daemon...
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_INFO    >>> Starting VirtualHere USB Server v2.9.8 (Built: Jul 15 2016, 13:54:35)<<<
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_INFO    Using configuration /data/data/com.virtualhere.androidserver/config.ini
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_INFO    Server licensed to=unlicensed max_devices=1
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_INFO    Using large URB's
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_DEBUG   TCPServer starting...
I/vhusbd  ( 5655): Tue Aug  2 09:35:30 2016 LOG_INFO    Listening on all network interfaces at port 7575
I/vhusbd  ( 5655): VirtualHere USB Server is running...press CTRL-C to stop
D/dalvikvm( 5655): GC_CONCURRENT freed 307K, 12% free 2870K/3240K, paused 3ms+2ms, total 24ms
I/vhusbd  ( 5655): Tue Aug  2 09:35:32 2016 LOG_DEBUG   Not a device .
I/vhusbd  ( 5655): Tue Aug  2 09:35:32 2016 LOG_DEBUG   Not a device ..
I/vhusbd  ( 5655): Tue Aug  2 09:35:32 2016 LOG_DEBUG   Found /dev/bus/usb/003/008 in /sys/bus/usb/devices/3-1 (bus/usb/003/008)
I/vhusbd  ( 5655): Tue Aug  2 09:35:32 2016 LOG_INFO    Found High speed device [09cb:1996] "FLIR Systems, FLIR ONE Camera" at address 31
I/dalvikvm( 5655): Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.n.onProvideKeyboardShortcuts
W/dalvikvm( 5655): VFY: unable to resolve interface method 6832: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
D/dalvikvm( 5655): VFY: replacing opcode 0x72 at 0x0002
W/dalvikvm( 5655): VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
I/dalvikvm( 5655): Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.n.onSearchRequested
W/dalvikvm( 5655): VFY: unable to resolve interface method 6834: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
D/dalvikvm( 5655): VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm( 5655): Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.n.onWindowStartingActionMode
W/dalvikvm( 5655): VFY: unable to resolve interface method 6838: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm( 5655): VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm( 5655): Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.cr.getDrawable
W/dalvikvm( 5655): VFY: unable to resolve virtual method 201: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm( 5655): Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.cr.getDrawableForDensity
W/dalvikvm( 5655): VFY: unable to resolve virtual method 203: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm( 5655): Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.c.a.b.a
W/dalvikvm( 5655): VFY: unable to resolve virtual method 98: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x0006
D/OpenGLRenderer( 5655): Enabling debug mode 0
E/dalvikvm( 5655): Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.aw.a
W/dalvikvm( 5655): VFY: unable to resolve instanceof 108 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/aw;
D/dalvikvm( 5655): VFY: replacing opcode 0x20 at 0x000c
D/dalvikvm( 5655): GC_CONCURRENT freed 223K, 9% free 3035K/3324K, paused 2ms+1ms, total 14ms
I/dalvikvm( 5655): Could not find method android.widget.PopupWindow.setEnterTransition, referenced from method android.support.v7.widget.cp.a
W/dalvikvm( 5655): VFY: unable to resolve virtual method 7153: Landroid/widget/PopupWindow;.setEnterTransition (Landroid/transition/Transition;)V
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x000a
I/dalvikvm( 5655): Could not find method android.widget.PopupWindow.setExitTransition, referenced from method android.support.v7.widget.cp.b
W/dalvikvm( 5655): VFY: unable to resolve virtual method 7154: Landroid/widget/PopupWindow;.setExitTransition (Landroid/transition/Transition;)V
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x000a
I/ListPopupWindow( 5655): Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.
I/dalvikvm( 5655): Could not find method android.support.v7.widget.bu.drawableHotspotChanged, referenced from method android.support.v7.widget.bu.a
W/dalvikvm( 5655): VFY: unable to resolve virtual method 5656: Landroid/support/v7/widget/bu;.drawableHotspotChanged (FF)V
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x000a
I/dalvikvm( 5655): Could not find method android.view.View.drawableHotspotChanged, referenced from method android.support.v7.widget.bu.a
W/dalvikvm( 5655): VFY: unable to resolve virtual method 6624: Landroid/view/View;.drawableHotspotChanged (FF)V
D/dalvikvm( 5655): VFY: replacing opcode 0x6e at 0x004a
D/dalvikvm( 5655): GC_FOR_ALLOC freed 57K, 8% free 3113K/3352K, paused 13ms, total 13ms
D/dalvikvm( 5655): GC_CONCURRENT freed 28K, 5% free 3482K/3628K, paused 2ms+2ms, total 17ms
« Last Edit: August 02, 2016, 09:55:22 am by jeng »
 

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #217 on: August 02, 2016, 10:07:53 am »
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg819919/?topicseen#msg819919
This would be an alternativ,
but i can´t get the driver to compile on Linux raspberrypi 4.4.16-v7+ #899 SMP Thu Jul 28 12:40:33 BST 2016 armv7l GNU/Linux

I got smartcam app compiled and working on raspberry...

 
« Last Edit: August 02, 2016, 10:11:00 am by jeng »
 

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #218 on: August 02, 2016, 10:40:33 am »
the best way is to run the Flir One  software direct on your "Phantom 3 Pro"

Huhh, how can i do that?
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Question about FLIR One for Android
« Reply #219 on: August 02, 2016, 12:33:34 pm »
Well for example an android phone mounted on the P3 with the camera on and that directly runs the Flir app, and some kind of screen sharing /video streaming software that allows to view it remotely from another device... or just the solution from a few posts above.
« Last Edit: August 02, 2016, 12:36:40 pm by Kilrah »
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Question about FLIR One for Android
« Reply #220 on: August 02, 2016, 10:46:56 pm »
the flir F1 USB interface it's extreme time critical
As I posted above in this thread, I have not success with connecting a Flir F1 to my Macbook running a virtual linux machine in vmware fusion (some hours of useless work :palm:)
Interesting... the VirtualHere USB solution works a treat with the Thermal Expert cam! Thanks for the heads up, had never heard of it!

https://www.eevblog.com/forum/thermal-imaging/another-smartphone-thermal-imager-from-i3/msg996374/#msg996374
« Last Edit: August 02, 2016, 11:09:32 pm by Kilrah »
 

Offline jeng

  • Newbie
  • Posts: 9
  • Country: lu
Re: Question about FLIR One for Android
« Reply #221 on: August 02, 2016, 10:56:31 pm »
Well for example an android phone mounted on the P3 with the camera on and that directly runs the Flir app, and some kind of screen sharing /video streaming software that allows to view it remotely from another device... or just the solution from a few posts above.

ok
but thats not the solution for me.

Thanks anyway.
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Question about FLIR One for Android
« Reply #222 on: August 03, 2016, 07:22:07 am »
Why not? Would be hard to do any simpler.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #223 on: August 03, 2016, 07:55:28 pm »
the best way is to run the Flir One  software direct on your "Phantom 3 Pro"

Huhh, how can i do that?

I don't understand your problem.
You know, that there are some solutions for a drone in this threat.
for instance
Finally got my F1G2 attached to my 3DR Solo drone. Still a WIP but it works....
and
I now have my Cheerson CX-20 ready for flying with flir one and raspberry pi 2.

Offline Champal

  • Newbie
  • Posts: 1
  • Country: fr
Re: Question about FLIR One for Android
« Reply #224 on: September 02, 2016, 11:23:42 am »
Hi,

First thank you to tomas123 and cynfab for your work  :-+
I now can use the FlirOne from a PC and this is easier than with a smartphone.

I have read all this thread and test almost all version (g, h, i, k, l1, l2, l3 and p1)
Thanks for your details steps and explanations.

Hi Fabian,
Nice job, glad to see someone else flying with a Flir One.
Here is my latest version of the driver, it has a few "improvements" over the last one posted here.

With this version p1 the "colorized thermal image" is in "RGB24"  instead of "MJPEG" => mjpg-streamer can't read this
I do a fusion between version l3 and p1 to encode the "colorized thermal image" in MJPEG and it's work !

There is 2 scripts "gst5" and "gst6" that use gst-launch-1.0 but after installing it, it doesn't work. What are they supposed to do ?

Code: [Select]
$ gst-launch-1.0 --version
gst-launch-1.0 version 1.2.4
GStreamer 1.2.4
https://launchpad.net/distros/ubuntu/+source/gstreamer1.0
$ sudo ./gst5
WARNING: erroneous pipeline: could not link videoscale0 to autovideosink0
$ sudo ./gst6
WARNING: erroneous pipeline: no element "compositor"

Next steps for me : autostart when the cam is plug/power on and run on a raspberry pi.

Some ideas for the future :
* Mesure of the temperature anywhere in the image
* Mask and/or Area of mesurements
* Block/Modify the range for the "palette"
* Changing "palette" in live
* ...


Again, thanks.  :clap:
Champal
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #225 on: September 02, 2016, 02:02:29 pm »
With this version p1 the "colorized thermal image" is in "RGB24"  instead of "MJPEG" => mjpg-streamer can't read this

if you dont like use V4L with
Code: [Select]
#define FRAME_FORMAT2 V4L2_PIX_FMT_RGB24
then test the initial variant flir8k.zip with jpg files from a RAMDISK
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg839518/#msg839518

mjpg-streamer works great with jpg input files
Code: [Select]
./mjpg_streamer -i "input_file.so -f /mnt/RAMDisk/ -n thermal.jpg" -o "output_http.so -p 8080 -w /usr/local/www"




Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #226 on: September 20, 2016, 10:11:40 pm »
the flir F1 USB interface it's extreme time critical

As I posted above in this thread, I have not success with connecting a Flir F1 to my Macbook running a virtual linux machine in vmware fusion (some hours of useless work :palm:)

Please note on EP 0x81 I got allways a answer on OSX and in VM
see
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg816972/#msg816972

The challange is EP 0x83 and EP 0x85
« Last Edit: September 20, 2016, 10:21:37 pm by tomas123 »
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #227 on: September 21, 2016, 07:38:00 pm »
the flir F1 USB interface it's extreme time critical
...
The challange is EP 0x83 and EP 0x85
Why FLIR... why... :palm:

thank you for the info, i will try later more with the FLIR One  :-/O
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline TheError

  • Newbie
  • Posts: 1
  • Country: us
Re: Question about FLIR One for Android
« Reply #228 on: September 22, 2016, 08:29:44 am »
the flir F1 USB interface it's extreme time critical
...
The challange is EP 0x83 and EP 0x85
Why FLIR... why... :palm:

thank you for the info, i will try later more with the FLIR One  :-/O

I'm so ready for this, the Android app isn't very stable and your software looks perfect for what im trying to do.
 

Offline Stereo

  • Contributor
  • Posts: 16
  • Country: ua
Re: Question about FLIR One for Android
« Reply #229 on: October 02, 2016, 04:44:31 am »
Hi all.

My Flir One Android often freezing image after calibration "click" need touch calibration button again then it may unfreezing or even need reconnect device.
Please advise.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #230 on: October 02, 2016, 03:41:39 pm »
This is unfortunately a feature of the F1G2.

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #231 on: October 03, 2016, 12:36:22 pm »


Quote from: joe-c on September 21, 2016, 06:44:35 AM
Hey Guys,
I want to use the Flir One on Windows with .NET (like the Seek Thermal).
i was able to connect to the Flir One with Zadig Driver:
1. Plung in Flir One, the Device manager note "could not start"
2. install standard driver for "unknown device"
3. reinstall zadig for the unknown Device "Flir One Camera"
Now the Device could be found and accessed.

now I try to implant the initialization routine for linux, made by cynfab and tomas123. but i get no response on the Endpoints 0x81,0x83 and 0x85.
I don't know what I am doing wrong... :-//
Any suggestions?



joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #232 on: October 03, 2016, 05:14:48 pm »
please give use more details about your host machine and linux version

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #233 on: October 03, 2016, 05:58:55 pm »
please give use more details about your host machine and linux version

tomas123 - was this question intended for me? If so, firstly it would be interesting to know if you managed to connect it to PC at all in any conditions.

I can give you my machine specs, its windows 10 build 1607 on laptop, on tablet windows 10 build 1501. I saw in some thread that someone used some driver and PC saw Flir One as a device, not sure which device.

Anyway, if its possible to connect to windows - great, I will be able to take from there. If from linux - I can install linux and try out it that way, maybe do dual boot on my tablet. Though I would prefer windows. Not sure if recognising the device and sending correct challenge is the same - it was 10+ years ago I wrote any driver in C++, I now mostly code in java.

Anyway, I scanned through all the threads and I am, simply, confused from all the information. I will be getting Flir One in a week maybe, so I thought I will begin reading :) Maybe I need to scan all the Flir One related threads one more time, not sure yet.
« Last Edit: October 03, 2016, 06:01:33 pm by allstone »
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #234 on: October 03, 2016, 09:01:14 pm »
joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?
Connection yes, but not ready for stream.

i was able to read the Descriptors, write some data, but i can't get the FLIR into the Frame Stream mode.
tomas123 give me great help but sadly i had no success yet.

The Problem seems to be at the Initialization step 2 (sending some magic Byte sequences followed by a string command sequence.)
My device often disconnects at this point, sometimes it run to Step 3 and has an error while ControlTransferOut, sometimes it passed this point and poll 0x85 without a response.

from my point of view its a low priority project. if i have a little bit time i try some things.
i think now about buying a better logic analyzer... and if i was able to "see the transmissions" it will be maybe more possible to make this thing working under windows.

For now, the application has only 2 Steps... fist "Connect and Stream" should be hit and green, this indicates, the FLIR was found and respond to a control request.
than the Button "Get 1 Frame (Byte array)" tries a initialization routine and returns, if more 10 bytes was read from EP 0x85... this never happen until now.
i tried sometimes the FLIR One G2 on my Smartphone to be sure, it still works.

if somebody will try, here is the Project file and the way to get this thing installed on windows.

Additional Note: i have a iOS version too, it was internal connected over 4 Wires (i suggest USB, like the Seek Thermal) but sadly this device is not recognized on the PC or Smartphone. Not sure if its defect or it has just another communications way. My Andoid PCB have less components.
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #235 on: October 04, 2016, 07:11:25 am »
joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?
Connection yes, but not ready for stream.

i was able to read the Descriptors, write some data, but i can't get the FLIR into the Frame Stream mode.
tomas123 give me great help but sadly i had no success yet.

The Problem seems to be at the Initialization step 2 (sending some magic Byte sequences followed by a string command sequence.)
My device often disconnects at this point, sometimes it run to Step 3 and has an error while ControlTransferOut, sometimes it passed this point and poll 0x85 without a response.

from my point of view its a low priority project. if i have a little bit time i try some things.
i think now about buying a better logic analyzer... and if i was able to "see the transmissions" it will be maybe more possible to make this thing working under windows.

For now, the application has only 2 Steps... fist "Connect and Stream" should be hit and green, this indicates, the FLIR was found and respond to a control request.
than the Button "Get 1 Frame (Byte array)" tries a initialization routine and returns, if more 10 bytes was read from EP 0x85... this never happen until now.
i tried sometimes the FLIR One G2 on my Smartphone to be sure, it still works.

if somebody will try, here is the Project file and the way to get this thing installed on windows.

Additional Note: i have a iOS version too, it was internal connected over 4 Wires (i suggest USB, like the Seek Thermal) but sadly this device is not recognized on the PC or Smartphone. Not sure if its defect or it has just another communications way. My Andoid PCB have less components.

Thanks joe-c, thats great start for me!

So it seems this still needs a bit of reverse engineering, I will take a look when I get my camera. The main reason I bought Flir One G2, but not Seek Compact, was because of the more accurate thermal data coming from the sensor and less bleeding (at least from the images others has posted). But we will see.

Joe-c, when you say "and the way to get this thing installed on windows." do you mean it is working with streaming on Linux? Have you also got some try-out project for that? I know it works on Android though, because I see there is a custom app. Would be great to get something working on Linux and Android, it would be easier to spot the differences. I like meddling with with firmware through wireshark and disassemblers, might get it working just to be able to connect it to my tablet for easier home inspection, as this is my primary usage for the camera. I already see a lot of information regarding the protocol, I think you all were very close, maybe some bad byte orders, bad timing, bad encoding or something like that.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #236 on: October 04, 2016, 07:51:56 am »
... do you mean it is working with streaming on Linux? Have you also got some try-out project for that?
look at page 2 of this thread, thomas123 and cynfab get it working under linux mint. they provide a working linux sample.

they made it working under linux, i just used there working code as base for a windows application.

maybe its just a tiny change...
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 
The following users thanked this post: allstone

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #237 on: October 04, 2016, 08:08:14 am »
tomas123 - was this question intended for me? If so, firstly it would be interesting to know if you managed to connect it to PC at all in any conditions.
Sorry for misunderstanding, I would know, if you are using some variants of virtual machines.

I've made the experience, that my libusb code only opens the EP 0x81 on VM and OSX. ( no EP 0x83 etc., see my post to cynfab above).
I think, there are some timing issues...

So it seems this still needs a bit of reverse engineering

yes,
therefore I built the driver code "byte for byte" from the usb dump (thanks to cynfab) and the java code from the Flir One Android App ( https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg798258/#msg798258 ).
see  http://www.beyondlogic.org/usbnutshell/usb5.shtml

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #238 on: October 04, 2016, 08:14:39 am »
Thanks guys, I see it. Plenty of info, now the big picture is already in my head. I believe we will do it - I always succeed when I put enough effort :p and it seems interesting enough for me to invest some time ;).
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #239 on: October 04, 2016, 08:21:48 am »
and with this running code, you can debug the java communication between the Flir One App (Android) anf the F1G2
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

a sample for getting the configuration file CameraFiles.zip from the camera
(set a breakpoint in "public void sendDataToDevice")
{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
Code: [Select]
data = {byte[16]@20956}
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)
protocolType = {UsbCommunicator$ProtocolType@20957} "CONFIGURATION"


{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
data = {byte[65]@20984}
0 = 123 (0x7B)
1 = 34 (0x22)
2 = 116 (0x74)
3 = 121 (0x79)
4 = 112 (0x70)
5 = 101 (0x65)
6 = 34 (0x22)
7 = 58 (0x3A)
8 = 34 (0x22)
9 = 111 (0x6F)
10 = 112 (0x70)
11 = 101 (0x65)
12 = 110 (0x6E)
13 = 70 (0x46)
14 = 105 (0x69)
15 = 108 (0x6C)
16 = 101 (0x65)
17 = 34 (0x22)
18 = 44 (0x2C)
19 = 34 (0x22)
20 = 100 (0x64)
21 = 97 (0x61)
22 = 116 (0x74)
23 = 97 (0x61)
24 = 34 (0x22)
25 = 58 (0x3A)
26 = 123 (0x7B)
27 = 34 (0x22)
28 = 109 (0x6D)
29 = 111 (0x6F)
30 = 100 (0x64)
31 = 101 (0x65)
32 = 34 (0x22)
33 = 58 (0x3A)
34 = 34 (0x22)
35 = 114 (0x72)
36 = 34 (0x22)
37 = 44 (0x2C)
38 = 34 (0x22)
39 = 112 (0x70)
40 = 97 (0x61)
41 = 116 (0x74)
42 = 104 (0x68)
43 = 34 (0x22)
44 = 58 (0x3A)
45 = 34 (0x22)
46 = 67 (0x43)
47 = 97 (0x61)
48 = 109 (0x6D)
49 = 101 (0x65)
50 = 114 (0x72)
51 = 97 (0x61)
52 = 70 (0x46)
53 = 105 (0x69)
54 = 108 (0x6C)
55 = 101 (0x65)
56 = 115 (0x73)
57 = 46 (0x2E)
58 = 122 (0x7A)
59 = 105 (0x69)
60 = 112 (0x70)
61 = 34 (0x22)
62 = 125 (0x7D)
63 = 125 (0x7D)
64 = 0 (0x0)
protocolType = {UsbCommunicator$ProtocolType@20957} "CONFIGURATION"

and here the tune command "doFFC" (Flat-field correction)
{"type":"setOption","data":{"option":"doFFC","value":true}}
Code: [Select]
data = {byte[16]@21106}
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 = 60 (0x3C)
9 = 0 (0x0)
10 = 0 (0x0)
11 = 0 (0x0)
12 = -71 (0xB9)
13 = -53 (0xCB)
14 = -94 (0xA2)
15 = -103 (0x99)
protocolType = {UsbCommunicator$ProtocolType@20957} "CONFIGURATION"

{"type":"setOption","data":{"option":"doFFC","value":true}}
data = {byte[60]@21045}
0 = 123 (0x7B)
1 = 34 (0x22)
2 = 116 (0x74)
3 = 121 (0x79)
4 = 112 (0x70)
5 = 101 (0x65)
6 = 34 (0x22)
7 = 58 (0x3A)
8 = 34 (0x22)
9 = 115 (0x73)
10 = 101 (0x65)
11 = 116 (0x74)
12 = 79 (0x4F)
13 = 112 (0x70)
14 = 116 (0x74)
15 = 105 (0x69)
16 = 111 (0x6F)
17 = 110 (0x6E)
18 = 34 (0x22)
19 = 44 (0x2C)
20 = 34 (0x22)
21 = 100 (0x64)
22 = 97 (0x61)
23 = 116 (0x74)
24 = 97 (0x61)
25 = 34 (0x22)
26 = 58 (0x3A)
27 = 123 (0x7B)
28 = 34 (0x22)
29 = 111 (0x6F)
30 = 112 (0x70)
31 = 116 (0x74)
32 = 105 (0x69)
33 = 111 (0x6F)
34 = 110 (0x6E)
35 = 34 (0x22)
36 = 58 (0x3A)
37 = 34 (0x22)
38 = 100 (0x64)
39 = 111 (0x6F)
40 = 70 (0x46)
41 = 70 (0x46)
42 = 67 (0x43)
43 = 34 (0x22)
44 = 44 (0x2C)
45 = 34 (0x22)
46 = 118 (0x76)
47 = 97 (0x61)
48 = 108 (0x6C)
49 = 117 (0x75)
50 = 101 (0x65)
51 = 34 (0x22)
52 = 58 (0x3A)
53 = 116 (0x74)
54 = 114 (0x72)
55 = 117 (0x75)
56 = 101 (0x65)
57 = 125 (0x7D)
58 = 125 (0x7D)
59 = 0 (0x0)
protocolType = {UsbCommunicator$ProtocolType@20949} "CONFIGURATION"

« Last Edit: October 04, 2016, 08:51:11 am by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #240 on: October 04, 2016, 08:47:08 am »
@allstone
@joe-c

I forgot the make a documentation of the FlirOne control commands (see my last post) while debugging the SDK App.
If you get some new informations, please post it here

The deactivation of the automatic shutter maybe a  interesting feature, because the 135 seconds intervall generates a absurd drift of 1.5 Kelvin:
I made a Flir One G2 run down test as answer to this seek post:

with the source code from
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg846130/#msg846130
I wrote all logs to file and generated a excel sheet.

This was a cold start of the Flir One and the log begins 1 minute after shutting on.
The battery reaches only 57 minutes, but it's more as expected:
Quote
The FLIR One houses its own battery source that can power the device for more than 45 minutes of continuous use.

The blue line is the average temperature of 2x2=4 center pixels. The measured temperature was a wall with a constant temperature over the hour.
The F1 G2 needs 10 minutes until stabilization.
The vertical green lines mark the FFC shutter movements.

The shutter interval is constant 135 seconds after 5 minutes runtime.

After FFC the temperature needs 30 seconds to settle (2 sec down + 10 sec up + 20 seconds to stabilize)   >:(
a sample at 00:25:50
Code: [Select]
Time    Spot FFC
0:25:50 19,6
0:25:51 19,6 Shutter
0:25:52 19,3 Shutter
0:25:53 19,1
0:25:54 19,0
0:25:55 19,1
0:25:56 19,3
0:25:57 19,5
0:25:58 19,7
0:25:59 19,9
0:26:00 20,1
0:26:01 20,2
0:26:02 20,3
0:26:03 20,3
0:26:04 20,3
0:26:05 20,3
0:26:06 20,3
0:26:07 20,3
0:26:08 20,3
0:26:09 20,2
0:26:10 20,2
0:26:11 20,1
0:26:12 20,0
0:26:13 20,0
0:26:14 19,9
0:26:15 19,9
0:26:16 19,8
0:26:17 19,7
0:26:18 19,7
0:26:19 19,7
0:26:20 19,7
0:26:21 19,6
0:26:22 19,6
0:26:23 19,6
0:26:24 19,6
0:26:25 19,6
0:26:26 19,6
0:26:27 19,5
0:26:28 19,5
0:26:29 19,5
0:26:30 19,4
0:26:31 19,4
0:26:32 19,4
0:26:33 19,4
0:26:34 19,4
0:26:35 19,4
0:26:36 19,4
0:26:37 19,4
0:26:38 19,4
0:26:39 19,5
0:26:40 19,5
0:26:41 19,5
0:26:42 19,4
0:26:43 19,5
0:26:44 19,4
0:26:45 19,4
0:26:46 19,3
0:26:47 19,3
0:26:48 19,5
0:26:49 19,4
0:26:50 19,5
0:26:51 19,5
0:26:52 19,4
0:26:53 19,4
0:26:54 19,5
0:26:55 19,4
0:26:56 19,4
0:26:57 19,5
0:26:58 19,5
0:26:59 19,5
0:27:00 19,5
0:27:01 19,4
0:27:02 19,4
0:27:03 19,5
0:27:04 19,5
0:27:05 19,5
0:27:06 19,5
0:27:07 19,5
0:27:08 19,6
0:27:09 19,6
0:27:10 19,6
0:27:11 19,6
0:27:12 19,7
0:27:13 19,7
0:27:14 19,6
0:27:15 19,6
0:27:16 19,6
0:27:17 19,7
0:27:18 19,6
0:27:19 19,6
0:27:20 19,6
0:27:21 19,6
0:27:22 19,7
0:27:23 19,7
0:27:24 19,7
0:27:25 19,7
0:27:26 19,7
0:27:27 19,7
0:27:28 19,6
0:27:29 19,6
0:27:30 19,6
0:27:31 19,8
0:27:32 19,7
0:27:33 19,7
0:27:34 19,7
0:27:35 19,7
0:27:36 19,7
0:27:37 19,6
0:27:38 19,6
0:27:39 19,6
0:27:40 19,5
0:27:41 19,6
0:27:42 19,6
0:27:43 19,6
0:27:44 19,7
0:27:45 19,7
0:27:46 19,6
0:27:47 19,6
0:27:48 19,6
0:27:49 19,6
0:27:50 19,6
0:27:51 19,6
0:27:52 19,6
0:27:53 19,6
0:27:54 19,6
0:27:55 19,7
0:27:56 19,7
0:27:57 19,6
0:27:58 19,7
0:27:59 19,6
0:28:00 19,6
0:28:01 19,7
0:28:02 19,7
0:28:03 19,7
0:28:04 19,7
0:28:05 19,7
0:28:06 19,7
0:28:07 19,6 Shutter
0:28:08 19,4 Shutter
0:28:09 19,0
0:28:10 18,9

the corresponding battery diagram: 


PS: all described effects (shutter interval, temperature drift) you also get with the Flir One Ap from google play store



Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #241 on: October 04, 2016, 11:35:12 am »
The deactivation of the automatic shutter maybe a  interesting feature, because the 135 seconds intervall generates a absurd drift of 1.5 Kelvin:

Hm, sorry for asking, but does that mean that even with original app you cannot achieve real 0.1C temperature measurement changes, and they are more like 1-2K because of the shutter/FFC intervals? Or it means real temperature can differ from shown in Flir app 1-2C/1-2K ?

The F1 G2 needs 10 minutes until stabilization.

Oh wait, did you notice if it was calibrated for starting (up to 10 minutes) or for the stabilized (after 10min) in Flir One. Or maybe FFC and other calibration data already accounts for this and correct the shown temperature values accordingly ? I though this was done in other Flir devices at least when I were reading on documents on FFC to account for the heating up. Because noone wants either of two things: wait for heatup or see real values at once (but see them drifting over-time). So if calibration data was not correcting this temperature as seeing from the logs, then maybe Flir App is doing that then.

Either way, I saw that Lepton 3 microbolometer is able to detect even 0.005C differences. That brings another question that I did not see answered: can Leptop 3 detect temperatures outside -20 to 150C (advertised as 120C, but I saw mentioning 150C in some posts who reads raw data) ? I wonder if Lepton just sees in that range but is more accurate on each pixel in regard of Raytheon in Seek which seems to be not as accurate for each pixel, but having wider range, or its something else like firmware limiting the temperatures.

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #242 on: October 04, 2016, 01:08:44 pm »
yes, also with original Flir One App the temperature drifts like shown in the diagramm (20,0°C -> shutter -> immediately 19,2°C -> after 20  seconds 20,5°C -> one minute later you get the old value 20,0°C)
It's better to reduce the shutter frequence after the warm up phase.
The "real" temperature is another question.

Oh wait, did you notice if it was calibrated for starting (up to 10 minutes) or for the stabilized (after 10min) in Flir One.
Look at the diagram above. It shows a cold start of a switched off camera.
This drift is a problem of the low cost Flir One. With my Flir E4 and Flir E40  this effect is significant lower.

edit:
Datasheet: Flir Lepton 3 thermal sensitivity <50 mK =0,050 K.
This is a realistic value, but not so good like a upgraded E4. You see the difference ;-)

Quote
can Leptop 3 detect temperatures outside -20 to 150C
Try Georgs Thermal Camera App. There is no temperature limit (but limited by SDK).
« Last Edit: October 04, 2016, 01:19:21 pm by tomas123 »
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #243 on: October 04, 2016, 03:01:24 pm »
Look at the diagram above. It shows a cold start of a switched off camera.
This drift is a problem of the low cost Flir One. With my Flir E4 and Flir E40  this effect is significant lower.

Yes but it does not make sense not to calibrate for cold start. If the sensor reacts this way, it should be calibrated to work from the start and to show correct values. Hm, will do some testing, mines already shipped, not long to wait.

Here is Lepton 3 datasheet http://www.file-upload.net/download-11989243/Lepton_Datasheet.pdf.html. There are some interesting points. For example, page 21, "Lepton 3 automatically prohibits the shutter from operating when it detects the temperature to be outside the range -10° C to +65° C. For example, if the camera is operating at a temperature of 70° C, no automatic FFC will be performed, and the camera will ignore any commanded FFC if the FFC mode is “automatic” or “manual.” ". Meaning if you want shutter control, there of course is another way - heat the thing up. Ok, do not listen to me, you can burn it. Just saying. Maybe E4 has heating element? Anyway, on page 57 Maximum Operating Temperature is -40 to +80C. Over that it shuts after some seconds has passed.

Datasheet: Flir Lepton 3 thermal sensitivity <50 mK =0,050 K.
This is a realistic value, but not so good like a upgraded E4. You see the difference ;-)

Yup, NETD is rated <50 mK (20 mK typical) according to datasheet at page 52.

But temperature is rated 0 K to >400 K at the same page 52. Hm, that means realy -273.15 C to >+126.85 C , meaning this sensor can actually sense that temperature. Ok, maybe over 120C it is not as accurate (or it just dies and sees same values for any higher?), but I believe Seek over 120C is not very acccurate too. You think Flir SDK let us see this whole range really?

Ok, I do not want to resurrect old discussions about the f. rate limit here, and firmware, etc, heck I do not even have the product in hands yet, well but being still careful, even though page 36 states that 26 frames are @8mhz, max @20mhz could be 60 or smth, and at page 42 you can see interesting statement "For each unique frame, two duplicates follow in the VoSPI stream", so this may as well be something different, but anyway what I am trying to say you know where the limit is (could be) implemented, so I wonder if temperature range is not limited there too.

Try Georgs Thermal Camera App. There is no temperature limit (but limited by SDK).

Definitely. I think I will buy it anyway, need to support the community ;)
« Last Edit: October 04, 2016, 03:03:27 pm by allstone »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #244 on: October 04, 2016, 03:53:08 pm »
Don't forget, that you have with the Flir One not a direct communication with the Lepton 3 sensor.
And the FFC has (almost) nothing to do with it the "calibrated" radiometric mode.

Try Georgs App and use your camera outside the regular temperature range.
This is all what you can get with Windows software if you self decode the usb data stream of the Flir One.

This is limited by the internal calculations around the "calibrated" radiometric mode.
You can't read out the native SPI interface of the Flir One...

Believe me, 20mK is impossible for the Flir One.
50mK it's a lot. See this sample:
real  Lepton sensor 160x120 (no image postprocessing and with noise/grain because the temperature spread is only 4 Kelvin)


« Last Edit: October 04, 2016, 03:55:27 pm by tomas123 »
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #245 on: October 04, 2016, 05:15:04 pm »
Don't forget, that you have with the Flir One not a direct communication with the Lepton 3 sensor.
You can't read out the native SPI interface of the Flir One...

Is this a hardware limitation? Cause I have no problem connecting to the chip legs directly, but.. that is not my intention with Flir One, I could have bought just the sensor instead then. But I dont believe that there is a chip inside which would decode the original firmware at runtime, and that the firmware is inside unreadable EEPROM. Its just too small for such device.. with 2 cameras in it.

Thanks. Enough information for starters. Dont get me wrong, I am not the professional in this field, I used PRO Flir device maybe once or twice, nothing fancy. My intention to use this at two of my houses to find insulation problems, see if cracks in a wall has any effect on it, also on the wires to see if they do not get too hot, find shorts maybe or bad connections early on before any real damage, then when testing laptops to see if they are not getting too hot somewhere and are not in need of better cooling or just cleaning, and lastly maybe on some electronics, but just 4fun (if I manage to buy ZnSe lenses for example). But I am a programmer so I will definitely meddle with it at some degree, as I meddle with any chip on my quadcopters, laptop EC/BIOS, car ECU, etc.
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #246 on: October 10, 2016, 05:28:55 pm »
Well I got Flir One G2 today. Works with my older micro USB Android 4.4.2 phone (I needed to root it and write OTG file to enable OTG functionality though). Still waiting for several micro usb to type-c otg adapters (or Ill solder my own otg adapter otherwise if they will not work) for my newer phone.

Anyways, first impression is good. Although I tried it on my heated floor several times in the dark. Sometimes, tubes could be clearly visible, other times image was blurry. After some time it was again visible. Not sure, maybe together with internal clicking it is also re-focusing or something. Also I used it for 10-15 minutes, noticed temperatures were 2C lower than should be. But seeing your graph @tomas123  I had to use it for 45 minutes for temps to stabilise, but internal battery does not hold as long. How did you manage to use it that long? Was it attached to external power source during that time? Can it be used with external power source for longer periods while still connected to the phone? Anyways, wanted to try Thermal Camera application but it goes to Thanks screen and when pressing thanks keeps showing me same screen on my old phone. Flir Mobile Tools also does not work on older phone. Maybe will need to try on newer one when type-c situation is resolved.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #247 on: October 10, 2016, 07:03:53 pm »
Has anyone else noticed the number of used FLIR One G2 cameras appearing on the secondary market at ever decreasing prices ?

I almost bought a faulty F1G2 last month for £80 but thought better of it as I already have one. In the last week I managed to buy an as new F1G2 Android for only £60 complete with box and accessories. I bought another today for £135.

I am thinking that maybe the Thermal Revolution is coming to an end for many consumers as they realise it is a neat gadget for which they have no real use in everyday life. I suspect that we will see more F1G2 cameras selling at very reasonable prices. Who would buy a LEPTON3 now when a used F1G2 costs so much less on the secondary market.

I wonder if FLIR sales of the F1G2 have, or are about to, take a steep downturn ?

Interesting times. Fads come and go very quickly. May be good news for us 'hard core' users of the technology but sadly if the consumer market loses interest, we may see the likes of FLIR being less keen to invest in new developments for the low end consumer market.

Food for thought

Fraser
« Last Edit: October 10, 2016, 07:05:41 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #248 on: October 10, 2016, 07:49:22 pm »
Has anyone else noticed the number of used FLIR One G2 cameras appearing on the secondary market at ever decreasing prices ?

I almost bought a faulty F1G2 last month for £80 but thought better of it as I already have one. In the last week I managed to buy an as new F1G2 Android for only £60 complete with box and accessories. I bought another today for £135.

I am thinking that maybe the Thermal Revolution is coming to an end for many consumers as they realise it is a neat gadget for which they have no real use in everyday life. I suspect that we will see more F1G2 cameras selling at very reasonable prices. Who would buy a LEPTON3 now when a used F1G2 costs so much less on the secondary market.

I wonder if FLIR sales of the F1G2 have, or are about to, take a steep downturn ?

Interesting times. Fads come and go very quickly. May be good news for us 'hard core' users of the technology but sadly if the consumer market loses interest, we may see the likes of FLIR being less keen to invest in new developments for the low end consumer market.

Food for thought

Fraser

Not sure where you bought it at such a cheap price? Anyway, Flir may be as well interested to kill consumer market. It is too cheap to make huge profit. I would never consider buying it if it would cost more than several hundred euro. It would then be better to go to lending office. Anyways, I still think it has huge potential. Not everything is discovered in this area yet too. Either Flir kills it or reveals potential good uses for it at home. I.e. what is the most common use for thermal imaging at home for consumer besides the fun factor? I mean what it is good for for casual people at home. To check on laptops temperature? To find out where the dog was sleeping at night? I mean one has to find why people would need this camera. If not, several days of usage and they sell it not having any potential usage for it..
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #249 on: October 10, 2016, 08:48:52 pm »
Hi Allstone,

FLIR are using the LEPTON 2 and 3 in more specialist products that have a definite market. namely the hunting/trekking/Maritime and trades-person tools. These markets will continue IMHO. It is the budget consumer phone accessory that I can see fading away over time. Maybe FLIR will do some more promotion of the technology, I do not know.

My £60 FLIR ONE G2 Android was advertised locally in the newsagent and my £135 FLIR ONE G2 came off ebay today. Both sellers told me the same story. It was a fun gadget for a while but they then put it away and never used it again. How common this scenario must be... just like any consumer gadget bought without a real need for it. I should know, I am a prime offender in that area with test equipment !

Is it just the UK where they are selling cheap on ebay then ? There have been several sold very cheaply of recent here. All with boxes paperwork etc so I do not think they are 'dodgy', just unwanted.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: allstone

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Question about FLIR One for Android
« Reply #250 on: October 10, 2016, 09:01:19 pm »
Fraser, I know you are a Louis Rossmann fan but doesn't infuriate/amuse you how he checks for shorted ICs using heat detection with his lips and a regulated PSU (HP 6632A?)  :-DD That same trick would be so much quicker and easier with a F1G2 for not much money at all.

I have certainly used it. At least a few repairs allow me to justify the £200 and 2 month wait anyway! £60 is a no brainer.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #251 on: October 10, 2016, 09:11:09 pm »
Hi Macbeth,

I have not been watching Louis of recent. The video channel went a bit 'off-tune' for my tastes.

Yes I saw Louis using parts of his anatomy to check surface temperatures. He says be does not want to waste money on the thermal camera. Fair enough if his process works for him. It is only in very recent years that thermal cameras have been affordable to the 'common man' so we techs always tended to use sensitive parts of out bodies to check temperatures on IC's etc  ;D  Burnt lips is not pleasant so most of us used a finger tip first, then the back of the hand, and lastly lips if feeling brave, I have never needed  to go beyond the back of my hand though !

I am biased. I love thermal imaging technology so no no excuse to use it in repairs. It helps me understand what is, or is not running properly on a PCB. Louis has his own approach though and I cannot criticise it if it works for him.

I now own four F1G2 cameras as I want to experiment with one or two without having to worry about trashing £200+

Fraser

Fraser
« Last Edit: October 12, 2016, 10:01:04 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: allstone

Offline frenky

  • Supporter
  • ****
  • Posts: 1003
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #252 on: October 10, 2016, 09:21:52 pm »
Now that you have mutiple F1G2 you could make a thermal VR headset.  ;D

P.S.
I watch Lois too and he is using soldering iron for about 1000$, microscope for about the same amount, but check for shorts with alcohol and hand.  ;D
I do not know if he is aware of F1G2 existance...
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #253 on: October 10, 2016, 09:28:50 pm »
Frenky,

I already have the parts for a Thermal VR headset...... multiple sets of Olympus FMD200 and the better FMD700 headsets  ;D

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline -jeffB

  • Regular Contributor
  • *
  • Posts: 115
Re: Question about FLIR One for Android
« Reply #254 on: October 10, 2016, 11:00:44 pm »
what is the most common use for thermal imaging at home for consumer besides the fun factor? I mean what it is good for for casual people at home.

With a head-mounted or otherwise hands-free version, I'd use it ALL THE TIME for cooking.
 

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #255 on: October 12, 2016, 02:28:55 pm »
what is the most common use for thermal imaging at home for consumer besides the fun factor? I mean what it is good for for casual people at home.

With a head-mounted or otherwise hands-free version, I'd use it ALL THE TIME for cooking.

@-jeffB you can do it :) try using USB extension cable from Flir to your phone, while the phone should be on your forearm (near wrist). Usb cable would then go from forearm, upper arm, should to your head, to the camera itself. You can attach camera to any cheap cap available. Now while cooking you just face the thing you are cooking in front, camera sees it as it is positioned so, you pull your wrist in front of you and you can just check the screen for the image.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #256 on: October 12, 2016, 05:17:22 pm »
How about an app that duplicates the image side by side on the phone and then you can use one of those cheap stereoscopic mobile phone VR headsets that I keep seeing :)
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline vze1lryy

  • Regular Contributor
  • *
  • Posts: 78
  • Country: us
Re: Question about FLIR One for Android
« Reply #257 on: October 12, 2016, 08:59:34 pm »
Fraser, I know you are a Louis Rossmann fan but doesn't infuriate/amuse you how he checks for shorted ICs using heat detection with his lips and a regulated PSU (HP 6632A?)  :-DD That same trick would be so much quicker and easier with a F1G2 for not much money at all.

I have certainly used it. At least a few repairs allow me to justify the £200 and 2 month wait anyway! £60 is a no brainer.

Kissing something that will later burn you is well within my zone of familiarity. :)

The problem I've had with any thermal camera is that, I put it above the board, and 90% of the board turns red. So what is hot.. oh the entire board you say... well yes mr. thermal camera, I was aware the short is on the board? But where? It's infuriating! There are over 130 components within the range of the "red dot."

When thermal cameras are 720p and $200 I will jump on it. I was so excited for this, and then I actually demo'd some $6000 FLIR cam and jeez.. absolutely amazing tool for telling where the cold air leaks are in my apartment, but I'd drive myself nuts using that present technology for troubleshooting.

Just goes to show, use what works best for you!!
Louis Rossmann
Component level motherboard repair technician.
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Question about FLIR One for Android
« Reply #258 on: October 12, 2016, 09:33:00 pm »
Louis, you are not wrong. It is sometimes hard to appreciate how tiny the stuff you work with actually is! I really should get an Amscope and see for myself!
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #259 on: October 12, 2016, 11:10:24 pm »
For high density 0402 type PCB work a thermal camera really needs to have a resolution of at least 320 x 240 pixels,  and, importantly, it needs both span and centre temperature manual adjustment capability. It will also require the fitting of a decent close-up lens, as most cameras do not focus well at the very close range required for 0402. With such a configuration good thermal mapping may be carried out and individual components seen.

If the camera is left in Auto span and centre temperature mode it will try to cover all bases and not provide the detail required for such work. By setting the span to a relatively small range the centre temperature may be increased and decreased to reveal the components that are operating at the different temperatures in an area if the board.. A full span view covering maximum to minimum temperatures in the FOV can also provide a useful overview on occasions but you can get the large area confusion detailed by Louis.

Good PCB temperature profiling can be done with the right tools and effort. Is the F1G2 the camera for such tasks as Louis is involved with? IMHO, no. Does Louis need a thermal camera to do his job, IMHO his current methods work, so no. 

I am spoilt with the nice industrial cameras that I have in my collection so have not had problems working on PCB's. However I fully understand that such expensive camera technology used in Lois's situation would take a very long time to pay for itself, if ever.

Cheap, budget cameras tend to disappoint. The latest Thermal Expert and similar cameras are getting better images though.

For info, there are such things as thermal microscopes. I own the optics from such a unit. It has X15 magnification :)
I may use the lens assembly on another camera in the future.

Frsser
« Last Edit: October 12, 2016, 11:15:55 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: allstone

Offline Bill W

  • Super Contributor
  • ***
  • Posts: 1102
  • Country: gb
    • Fire TICS
Re: Question about FLIR One for Android
« Reply #260 on: October 14, 2016, 09:44:43 am »
I find that the key to thermal camera fault finding, and indeed making sure the errant part does not catch fire before you fix it, is a very short power on.  Even one second is enough to warm up the fault enough to see it and does not cause the red spread that Louis notes.  All you need is 1 degree rise.

For someone doing enough work, a day out spent making a camera using the core from a second hand fire cameras would surely be worthwhile.  Yes it will have all the aesthetics of a brick but it would be free-standing, 320x240, video out or own display, manual focus and 30Hz, plus possibly manual gain / iris depending on model.  Yours for somewhere around GBP250-500 and a bit of fun putting it together.

regards

Bill
(who may have an interest in this suggestion   ;D )

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #261 on: October 14, 2016, 10:52:48 am »
I find that the key to thermal camera fault finding, and indeed making sure the errant part does not catch fire before you fix it, is a very short power on.  Even one second is enough to warm up the fault enough to see it and does not cause the red spread that Louis notes.  All you need is 1 degree rise.

For someone doing enough work, a day out spent making a camera using the core from a second hand fire cameras would surely be worthwhile.  Yes it will have all the aesthetics of a brick but it would be free-standing, 320x240, video out or own display, manual focus and 30Hz, plus possibly manual gain / iris depending on model.  Yours for somewhere around GBP250-500 and a bit of fun putting it together.

regards

Bill
(who may have an interest in this suggestion   ;D )

I still would like to make Flir One work for that too. I will use it to find out which motor/ESC is bad or does not work correctly on my quadcopter. Or maybe if I have cold solder joints, as its a regular thing to resolder something on quadcopter.  320x240 not really a necessity, I believe good quality dots on lepton even smaller amount of them of 160x120, is ok. It is portable enough to bring to the field and check on quadcopter just after the flying session.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #262 on: October 14, 2016, 01:31:01 pm »
After Bill's comment i have to say, I love working on thermal cameras so I am very biased. That said ........

The advantage of building your own 'thermal workbench' is that you, the user, can set it up as an overhead view PCB profiler with the right lens settings for the job, manual focus lens to as short a distance as you want (without needing a close-up auxiliary lens) and it will all cost a lot less than a commercial built camera. Such a system would be far more practical for electronics than messing around with a FLIR One G2 or SEEK camera.

I am always amused when I see thermal fire fighting cameras being sold at knock down prices. Many people searching for a cheap thermal camera pass these by, thinking they are old or poor performance. Such could not be further from the truth. They were built to a standard rather than down to a price. They contain well known high quality imaging cores with superb large diameter Germanium lenses and may be stripped down easily. Just because a fire fighting thermal camera is built in a certain format, does not mean it has to stay in that format. As an example, the ARGUS 2's that I just repaired are basically a nice aluminium chassis onto which are bolted the self contained composite video Viewfinder PCB, EEV controller PCB, Raytheon Core PCB and Imaging sensor with Optical block attached. I have long intended to reformat one of these cameras into a more lab friendly format. You could even have the imaging core separated from the EEV controller and viewfinder boards, like the LAB cameras that had the CCD head separate form the rest of the camera electronics.

Well that is enough of my off F1G2 topic comment but potential FLIR One G2 owners should consider some of the more bulky thermal camera formats if they have the ability to remodel such to a custom solution that better suits their needs.

Fraser
« Last Edit: October 14, 2016, 02:20:39 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: allstone

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #263 on: October 14, 2016, 02:27:02 pm »
A word of caution to those thinking of using a thermal camera to monitor solder joints. Such are highly reflective and have very poor emissivity. As such you see your own body heat reflected off of them. The solder joint surface temperature is very hard to measure unless a high emissivity coating has been applied to it first. It would be possible to see localised heating of the PCB around a poor quality high current solder joint. Much depends upon the exact topology of the PCB being examined.

A FLIR One G2 would really need a close-up lens in order to make any sense of a modern model flight controller. They are small.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: allstone

Offline faboaic

  • Newbie
  • Posts: 2
  • Country: de
Re: Question about FLIR One for Android
« Reply #264 on: October 17, 2016, 04:55:17 am »
The problem I've had with any thermal camera is that, I put it above the board, and 90% of the board turns red. So what is hot.. oh the entire board you say... well yes mr. thermal camera, I was aware the short is on the board? But where? It's infuriating! There are over 130 components within the range of the "red dot."

it depends on the density, etc.

From my point of view it can be good enough for many things.
E.g. a defective ESC on the quadcopter:

https://youtu.be/81KTsn3Yo1k

https://youtu.be/qxtDaJcAIm4

Cheers,
Fabian
 
The following users thanked this post: allstone

Offline allstone

  • Contributor
  • Posts: 13
  • Country: lt
Re: Question about FLIR One for Android
« Reply #265 on: October 17, 2016, 10:49:42 am »
The problem I've had with any thermal camera is that, I put it above the board, and 90% of the board turns red. So what is hot.. oh the entire board you say... well yes mr. thermal camera, I was aware the short is on the board? But where? It's infuriating! There are over 130 components within the range of the "red dot."

it depends on the density, etc.

From my point of view it can be good enough for many things.
E.g. a defective ESC on the quadcopter:

https://youtu.be/81KTsn3Yo1k

https://youtu.be/qxtDaJcAIm4

Cheers,
Fabian

Exactly! And when u see on esc which part is overheating, you can always place a small heatsink on that part as to better dissipate the heat if you haven't got a spare on hands.
 

Offline G0MJW

  • Regular Contributor
  • *
  • Posts: 51
  • Country: gb
  • Mike
    • G0MJW
Re: Question about FLIR One for Android
« Reply #266 on: November 12, 2016, 11:16:47 am »
Hi All

I am having some issues getting this to work on the lastest RPI raspian distribution. Its a newer kernel which may be an issue but I think the real problem is the steps are scattered all over this thread so its not really clear what needs to be done and which is the latest driver e.g. flir8p1 is newer than flir8l3. 8p1 contains an already compiled executable but I can't clean and remake it, whereas I can with 8l3 but both give the same error which is an issue with v4l.

[ 2494.720659] usb 1-1.4: new high-speed USB device number 7 using dwc_otg
[ 2494.822165] usb 1-1.4: New USB device found, idVendor=09cb, idProduct=1996
[ 2494.822191] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2494.822208] usb 1-1.4: Product: FLIR ONE Camera
[ 2494.822225] usb 1-1.4: Manufacturer: FLIR Systems
[ 2494.822241] usb 1-1.4: SerialNumber: FLIRONEF03G4F004AFF

sudo ./flir8p1 Rainbow.raw
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
using output device: /dev/video2
flir8p1: flir8p1.c:168: startv4l2: Assertion `fdwr1 >= 0' failed.

sudo ./flir8l3
Successfully find the Flir One G2 device
Successfully set usb configuration 3
Successfully claimed interface 0,1,2
using output device: /dev/video1
flir8l3: flir8l3.c:136: startv4l2: Assertion `fdwr0 >= 0' failed.

ls -al /dev/video*
ls: cannot access /dev/video*: No such file or directory

v4l-utils and v4l2loopback are both installed.:

pi@raspberrypi:~/flir8l3 $ dpkg --get-selections |grep v4l
libv4l-0:armhf                                  install
libv4l-dev:armhf                                install
libv4l2rds0:armhf                               install
libv4lconvert0:armhf                            install
v4l-utils                                       install
v4l2loopback-dkms                               install

So why the assertion error? Note this PI works fine with a webcam. I am missing a driver installation step - hence the request for a procedure.

Mike

Postscript

I was right about there being something missing. The v412loopback driver. Installing this is Raspian is a bit of a trial. It required kernel headers, but no, not the ones that you can install from apt-get which are missing a build directory.

The headers are found from https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/

You need to know your kernel:

$ uname -a
Linux raspberrypi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux

Download the appropriate headers and install with:
$ sudo dpkg -i /home/pi/linux-headers-4.4.21-v7+_4.4.21-v7+-2_armhf.deb

Its important to get the right ones, your world might end otherwise. Then you can download and make:

$ git clone https://github.com/umlaeute/v4l2loopback
$ cd v412loopback
$ sudo make    [I needed sudo - normally you don't]
$ sudo make install

But I has to insmod rather than modprobe, I am still thinking about that.

e.g. sudo insmod v4l2loopback/v4l2loopback.ko video_nr=0,1,2,3


I an not running a gui so to make it do something useful I piped it to another PC and opened it in vlc (rtp://@:1234) based on the advice further up this thread:

From the directory I compiled the flir package in I ran:

$ sudo ./flir8p1 Rainbow.raw

and in another terminal

This needs avtools
 
$ sudo apt-get install libav-tools
$ avconv -f video4linux2 -i /dev/video3 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method epzs -b 2600k -bt 256k -f rtp rtp://192.168.1.100:1234






 
« Last Edit: November 12, 2016, 07:48:17 pm by G0MJW »
Mike
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #267 on: November 13, 2016, 04:47:00 pm »
Hi Mike,

Now flir8p1 with v4l works fine?

(Sorry but currently I'm not working with my raspberry pi.)
« Last Edit: November 13, 2016, 04:49:15 pm by tomas123 »
 

Offline G0MJW

  • Regular Contributor
  • *
  • Posts: 51
  • Country: gb
  • Mike
    • G0MJW
Re: Question about FLIR One for Android
« Reply #268 on: November 17, 2016, 08:22:59 pm »
Hi Thomas - not the version that comes with Jessie-lite. It seems to be necessary to compile the loopback module but that means getting the kernel headers and these are not where they should be but need to be downloaded from the site I mentioned.
Mike
 

Offline rbalint

  • Newbie
  • Posts: 1
  • Country: hu
Re: Question about FLIR One for Android
« Reply #269 on: November 21, 2016, 10:09:24 pm »
I see use use the last driver from cynfab
Here is my latest version of the driver, it has a few "improvements" over the last one posted here.
flir8p1.zip

Is this pipe correct?
"Phantom 3 Pro" with Android mini pc (Raspberry pi 3) running a "VirtualHere USB Server"  -> wifi ->   Linux tablet with flir8p1 software and VirtualHere USB Client

Based on the PM discussion with tomas123 I added copyright info to the files. Tomas123 kindly agreed to license the code and other content under GPL 2+ and I think I tracked down the origin of font5x7.h, too.

Clarifying licensing is needed because I would like to add some improvements and share it on GitHub - I'll post the repository URL here.
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #270 on: November 21, 2016, 11:11:01 pm »
You are welcome.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #271 on: November 22, 2016, 04:05:59 pm »
Clarifying licensing is needed because I would like to add some improvements and share it on GitHub - I'll post the repository URL here.

I agree with the GPL license.  :-+
Please post the link to your github project.
« Last Edit: November 22, 2016, 04:12:35 pm by tomas123 »
 

Offline pbash

  • Newbie
  • Posts: 1
  • Country: gb
Re: Question about FLIR One for Android
« Reply #272 on: November 26, 2016, 10:36:15 pm »
Thanks to Tomas and Cynfab for the great work on the Flir One G2 and the flir8p1.c program that I am using stream thermal images.

I'm looking to improve the accuracy of the temperature readings and have extracted most of the calibration constants from CameraFiles.zip and updated Planck.h:
.calib.extRBF.ds120C_weRB_apNOA_fiNOF_le.B double 1494.1                      PlanckB
.calib.extRBF.ds120C_weRB_apNOA_fiNOF_le.F double 1                                PlanckF
.calib.extRBF.ds120C_weRB_apNOA_fiNOF_le.J0 double 1223                        Planck0
.calib.extRBF.ds120C_weRB_apNOA_fiNOF_le.J1 double 81.587158
.calib.extRBF.ds120C_weRB_apNOA_fiNOF_le.R double 20628.172                PlanckR1

However, I cant find the PlanckR2 constant for my camera in calib.rsc and hence using the default value from the planck.h file. Unfortunately, I dont have an Android phone to get an image file that I have seen can be used with exiftool to obtain the values. Appreciate any pointers on how to find PlanckR2 and again thanks for the great work.
« Last Edit: November 26, 2016, 11:00:17 pm by pbash »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #273 on: November 27, 2016, 03:58:01 pm »
this is a good question
I will help you:

from my radiometric jpg:
Code: [Select]
$ exiftool -planck*  flir_20160319T173259.jpg
Planck R1                       : 16528.178
Planck B                        : 1427.5
Planck F                        : 1
Planck O                        : -1307
Planck R2                       : 0.012258549

from CameraFiles.zip
Code: [Select]
$ grep CameraFiles/system/calib.rsc
.calib.extRBFCalc.curData.cProt.ds120C_weRB_apNOA_fiNOF_leExFOL2.const text "R 16528, B 1427.5, F 1.00 (J0 1307, J1 81.575722)"

1/81.575722=0.01225854918
(-1)*-1307 = 1307
 ;)

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #274 on: November 28, 2016, 05:56:59 pm »
 The use of macro lens with a 25mm focal. With germanium lens 15mm focal seen the sweat glands on the hand.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #275 on: December 08, 2016, 08:41:29 am »
the v4l kernel driver for raspberry pi is a pain.

Due to this post from G0MJW in november I replayed all steps but this end in a "insmod: ERROR: could not insert module /lib/modules/4.4.34/extra/v4l2loopback.ko: Unknown symbol in module".

I was right about there being something missing. The v412loopback driver. Installing this is Raspian is a bit of a trial. It required kernel headers, but no, not the ones that you can install from apt-get which are missing a build directory.

The headers are found from https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/

You need to know your kernel:

$ uname -a
Linux raspberrypi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux

Download the appropriate headers and install with:
$ sudo dpkg -i /home/pi/linux-headers-4.4.21-v7+_4.4.21-v7+-2_armhf.deb

Its important to get the right ones, your world might end otherwise. Then you can download and make:

$ git clone https://github.com/umlaeute/v4l2loopback
$ cd v412loopback
$ sudo make    [I needed sudo - normally you don't]
$ sudo make install

But I has to insmod rather than modprobe, I am still thinking about that.

e.g. sudo insmod v4l2loopback/v4l2loopback.ko video_nr=0,1,2,3


here my steps on with clean raspberry pi installation
Code: [Select]
$ uname -a
Linux raspberrypi 4.4.34+ #930 Wed Nov 23 15:12:30 GMT 2016 armv6l GNU/Linux

[url]https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi[/url]
// linux-headers-4.4.34+_4.4.34+-2_armhf.deb
[url]https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/linux-headers-4.4.34%2B_4.4.34%2B-2_armhf.deb[/url]

$ sudo apt-get install bc

$ sudo dpkg -i linux-headers-4.4.34+_4.4.34+-2_armhf.deb
...
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
make: Leaving directory '/usr/src/linux-headers-4.4.34+'
/var/lib/dpkg/info/linux-headers-4.4.34+.postinst: 1: /var/lib/dpkg/info/linux-headers-4.4.34+.postinst: dkms: not found

$ sudo apt-get install libv4l-dev

$ sudo apt-get install v4l2loopback-dkms
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  dkms
Suggested packages:
  v4l2loopback-utils
The following NEW packages will be installed:
  dkms v4l2loopback-dkms
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 102 kB of archives.
After this operation, 462 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main dkms all 2.2.0.3-2 [70.9 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main v4l2loopback-dkms all 0.8.0-4 [31.2 kB]
Fetched 102 kB in 1s (98.6 kB/s)       
Selecting previously unselected package dkms.
(Reading database ... 50298 files and directories currently installed.)
Preparing to unpack .../dkms_2.2.0.3-2_all.deb ...
Unpacking dkms (2.2.0.3-2) ...
Selecting previously unselected package v4l2loopback-dkms.
Preparing to unpack .../v4l2loopback-dkms_0.8.0-4_all.deb ...
Unpacking v4l2loopback-dkms (0.8.0-4) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up dkms (2.2.0.3-2) ...
Setting up v4l2loopback-dkms (0.8.0-4) ...
Loading new v4l2loopback-0.8.0 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 4.4.34+ belongs to a chroot's host
Building initial module for 4.4.34+
Error! Bad return status for module build on kernel: 4.4.34+ (armv6l)
Consult /var/lib/dkms/v4l2loopback/0.8.0/build/make.log for more information.


$ dpkg --get-selections |grep v4l
libv4l-0:armhf install
libv4l-dev:armhf install
libv4l2rds0:armhf install
libv4lconvert0:armhf install
v4l-utils install
v4l2loopback-dkms install


$ git clone [url]https://github.com/umlaeute/v4l2loopback[/url]
Cloning into 'v4l2loopback'...
remote: Counting objects: 1561, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 1561 (delta 2), reused 0 (delta 0), pack-reused 1548
Receiving objects: 100% (1561/1561), 754.93 KiB | 542.00 KiB/s, done.
Resolving deltas: 100% (860/860), done.
Checking connectivity... done.

$ cd v4l2loopback/
pi@raspberrypi:~/v4l2loopback $ sudo make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.34+'
  CC [M]  /home/pi/v4l2loopback/v4l2loopback.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/v4l2loopback/v4l2loopback.mod.o
  LD [M]  /home/pi/v4l2loopback/v4l2loopback.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.4.34+'


$  sudo make install
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback modules_install
make[1]: Entering directory '/usr/src/linux-headers-4.4.34+'
  INSTALL /home/pi/v4l2loopback/v4l2loopback.ko
  DEPMOD  4.4.34
make[1]: Leaving directory '/usr/src/linux-headers-4.4.34+'
depmod -a  `uname -r`

$ find / -name v4l2loopback.ko  2>/dev/zero
/lib/modules/4.4.34/extra/v4l2loopback.ko
/home/pi/v4l2loopback/v4l2loopback.ko

$ sudo insmod /lib/modules/4.4.34/extra/v4l2loopback.ko video_nr=0,1,2,3
insmod: ERROR: could not insert module /lib/modules/4.4.34/extra/v4l2loopback.ko: Unknown symbol in module



PS: If you get the error
"insmod: ERROR: could not insert module ./v4l2loopback.ko: Invalid module format"
than you loaded a wrong kernel header file (like linux-headers-4.4.34+_4.4.34+-2_armhf.deb  and linux-headers-4.4.34-v7+_4.4.34-v7+-2_armhf.deb   
« Last Edit: December 11, 2016, 04:38:07 pm by tomas123 »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #276 on: December 10, 2016, 03:32:51 pm »
I answer myself

...
But I has to insmod rather than modprobe, I am still thinking about that.

e.g. sudo insmod v4l2loopback/v4l2loopback.ko video_nr=0,1,2,3
Yes, modprobe doesn't work..
...but insmod doesn't load needed dependencies.

I found this
https://github.com/umlaeute/v4l2loopback/issues/94
Quote
umlaeute commented on 11 Aug 2015
the trick is that v4l2loopback needs the videodev module to be loaded.

make modprobe does that for you

alternatively, when installing the module, a call to depmod should resolve inter-module dependencies, so when you do modprobe v4l2loopback, the system already knows that it also needs to load videodev.

lets test it and preload the videodev.ko

Code: [Select]
pi@raspberrypi:~/v4l2loopback $ sudo insmod ./v4l2loopback.ko
insmod: ERROR: could not insert module ./v4l2loopback.ko: Unknown symbol in module

pi@raspberrypi:~/v4l2loopback $ sudo modprobe videodev

pi@raspberrypi:~/v4l2loopback $ sudo insmod ./v4l2loopback.ko

pi@raspberrypi:~/v4l2loopback $ lsmod
Module                  Size  Used by
v4l2loopback           26994  0
videodev              172779  1 v4l2loopback
media                  16312  1 videodev
...

v4l2loopback is succesfull loaded!!
Code: [Select]
$ ls /dev/video*
/dev/video0

Offline G0MJW

  • Regular Contributor
  • *
  • Posts: 51
  • Country: gb
  • Mike
    • G0MJW
Re: Question about FLIR One for Android
« Reply #277 on: December 11, 2016, 11:28:04 pm »
Well done! Now we need to get it automated.

Meanwhile, my ZnSe lens arrived which will be interesting for close ups.

Mike
Mike
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #278 on: January 17, 2017, 04:36:44 am »
Anybody yet managed to create a Windows EXE file which can access the FLIR One? I've just gotten my USB-A-male to MicroUSB-female adapter. I've plugged the FLIR One into the one end of the adapter, and the other end of the adapter into my Windows laptop.

Windows lists it in Device Manager as "USB Composite Device". As for VID and PID:
VID = 09CB
PID = 1996

I need either a driver that matches this VID and PID that can then be used with a variety of programs, or I need a program that can skip the use of a driver and instead use Windows API functions for raw-reading and raw-writing of data to the USB port.

Anybody here managed to make any progress on either of those (either the driver, or the program that directly communicates with the USB port)?
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #279 on: January 17, 2017, 05:03:55 pm »
ask joe-c, he is working on a driver for Thermovision_JoeC ;)

joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?
Connection yes, but not ready for stream.

i was able to read the Descriptors, write some data, but i can't get the FLIR into the Frame Stream mode.
tomas123 give me great help but sadly i had no success yet.
...

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #280 on: January 17, 2017, 05:54:51 pm »
ask joe-c, he is working on a driver for Thermovision_JoeC ;)

joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?
Connection yes, but not ready for stream.

i was able to read the Descriptors, write some data, but i can't get the FLIR into the Frame Stream mode.
tomas123 give me great help but sadly i had no success yet.
...

I saw a LOT of people writing Linux code for it in this thread. I assumed some of the people doing that, might also have the knowhow to port that code to Windows, so that their program would work in Windows.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #281 on: January 17, 2017, 09:50:07 pm »
Anybody? Please? I'm still looking for an EXE file for Windows, that is a port of the Linux application that already is shown on this thread. Anybody know how to make one for me? Or do you guys so exclusively use Linux, that you actually have no idea how to compile an EXE file for Windows?
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #282 on: January 17, 2017, 10:37:38 pm »
Here is my latest playground.

Connection an reading the Descriptors was possible. But i cant get the EPs let deliver frames. But i have no time to play with it, i have more focus on my Thermal Expert.

but for anyone who wants to try, here is a C# Sample, ported from the Seek Thermal Program.
Workflow:
-Click on Button on top left "Connect and Stream"... with a connected FLIR ONE it should be green.
-Click on "Get 1 Frame (Bytearray)"
in the second step it goes to a infinite loop, because it don't work.
Use
Seekthermal.cs->FlirOneG2Class->public byte[] GetFrame_asBytes()
as entry point with the debugger.

good luck  :-/O
joe-c
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #283 on: January 17, 2017, 11:41:26 pm »
Here is my latest playground.

Connection an reading the Descriptors was possible. But i cant get the EPs let deliver frames. But i have no time to play with it, i have more focus on my Thermal Expert.

but for anyone who wants to try, here is a C# Sample, ported from the Seek Thermal Program.
Workflow:
-Click on Button on top left "Connect and Stream"... with a connected FLIR ONE it should be green.
-Click on "Get 1 Frame (Bytearray)"
in the second step it goes to a infinite loop, because it don't work.
Use
Seekthermal.cs->FlirOneG2Class->public byte[] GetFrame_asBytes()
as entry point with the debugger.

good luck  :-/O
joe-c

Zadig can't find my FLIR One. When I plugged my FLIR One into my computer, Windows detected it as a "USB Composite Device". I can see that in Device Manager. Unfortunately, it does not appear in Zadig's list of USB devices. Is there an alternative method to install WinUSB for the FLIR One?
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #284 on: January 17, 2017, 11:45:11 pm »


Quote from: joe-c on September 21, 2016, 06:44:35 AM
Hey Guys,
I want to use the Flir One on Windows with .NET (like the Seek Thermal).
i was able to connect to the Flir One with Zadig Driver:
1. Plung in Flir One, the Device manager note "could not start"
2. install standard driver for "unknown device"
3. reinstall zadig for the unknown Device "Flir One Camera"
Now the Device could be found and accessed.

now I try to implant the initialization routine for linux, made by cynfab and tomas123. but i get no response on the Endpoints 0x81,0x83 and 0x85.
I don't know what I am doing wrong... :-//
Any suggestions?



joe-c Have you succeeded in connecting Flir One same as Seek Compact to PC ?

With my computer, it does not show up as "Unkown Device". Instead, at least on my PC, it shows up as "USB Composite Device". Unfortunately, the entry for "USB Composite Device" does not show up in Zadig's menu. Do you have an alternative method I can use to install WinUSB for the FLIR One on my PC that does not involve Zadig? Or maybe, is there a way to force Zadig to "see" it?
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #285 on: January 17, 2017, 11:58:35 pm »
Never mind. I figured it out. I had to disable the setting called "Ignore Hubs or Composite Parents" in Zadig, in order for it to find items called "USB Composite Device". After I did that, the FLIR One camera appeared in the Zadig device list, under the name "FLIR ONE Camera". I was then able to install the WinUSB driver for the FLIR One.


Now getting on with debugging Joe-C's program.
When I connect to the FLIR One, and then click the "Get 1 Frame (Bytearray)" button, it gives me an error that says "Not all data transferred". After that, in the "details" section of the error message, it says this:
Quote
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Exception: Not all data transferred
   at SeekThermal.WinUSBDevice.ControlTransferOut(Byte requestType, Byte request, UInt16 value, UInt16 index, Byte[] data) in d:\CloudStation\tech\Flir\FlirOne\FlirOneThermal_010 - NotWork\SeekThermal\SeekThermal.cs:line 2054
   at SeekThermal.FlirOneG2Class.GetFrame_asBytes() in d:\CloudStation\tech\Flir\FlirOne\FlirOneThermal_010 - NotWork\SeekThermal\SeekThermal.cs:line 680
   at SeekThermal_Form.MainForm.Btn_GetFrame_AsByteArrayClick(Object sender, EventArgs e) in d:\CloudStation\tech\Flir\FlirOne\FlirOneThermal_010 - NotWork\SeekThermal\MainForm.cs:line 191
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
FlirOneThermal
    Assembly Version: 1.0.6214.3154
    Win32 Version: 1.0.6214.3154
    CodeBase: file:///C:/Users/Ben%20Hutchinson/Desktop/FLIR%20One%20Test/FlirOneThermal.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8750 (QFE.050727-8700)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.8763 built by: WinRel
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

I hope somebody will find this useful in debugging Joe-C's program.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #286 on: January 19, 2017, 08:08:12 pm »
Has anybody been able yet to fix Joe-C's software for connecting the FLIR One for Android to a Windows PC? He included his source so you can re-compile it if you can figure out what's wrong. To help to that end, I posted the entire error message details (see my post above this one) for the error that occurs when you try to just read a byte-array of raw data from the device with it. Yet there have been no followup posts by either Joe-C or any other members who have taken it upon themselves to try to fix the bug.

I'm really eager for this program to end up working. I've already bought a micro USB to standard USB adapter, and have used Zadig to install the WinUSB driver for FLIR One. So everything now is ready on my PC, except for the software that will actually interact with the FLIR One. I need somebody here to help get that software ready. Joe-C's software was written in C# (pronounced C Sharp), which is a programming language that I have no experience using. So I'm leaving it up to you guys to actually fix Joe-C's program.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #287 on: January 19, 2017, 09:05:11 pm »
This Test version has no real image acquisition inside, because I can't get the endpoints 0x83 and 0x85 talking.
I tried to reproduce the Linux code samples, but I guess, I make something wrong with the pipe handling.

The first step is get EP 0x85 deliver Frames.

I guess the Exception text above is just a follow-up from the not working transmission.
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #288 on: January 19, 2017, 09:51:56 pm »
This Test version has no real image acquisition inside, because I can't get the endpoints 0x83 and 0x85 talking.
I tried to reproduce the Linux code samples, but I guess, I make something wrong with the pipe handling.

The first step is get EP 0x85 deliver Frames.

I guess the Exception text above is just a follow-up from the not working transmission.

You are using the WinUsb API functions, right? I happen to be using Visual Basic 6, and I believe I can use WinUsb in VB6, as well (no dot-net programming languages like C# are required for just using WinUsb). And I'm working on duplicating the basic parts of your project in VB6, but the problem is I haven't learned C#, so I don't know how to interpret all of the different parts of your program. I need to know how your program works at its most basic level, in order to port that functionality over to VB6 code.

My problem is figuring out how to send and receive raw data over USB.

My program does 2 things so far. It uses CreateFile to get a handle to the USB device itself (in this case the FLIR One), and then uses WinUsb_Initialize to get a handle to WinUsb (which I believe is a handle to the main interface of the USB device). Now that I have this handle, I should be able to read and write data to the FLIR One. However, I still need to figure out which WinUsb are used to read and write raw data to the USB port. I think I need to find something called "end points" in order to read and write, but I don't know how to find these "end points". What WinUsb functions do I need to use to find these "end points"?

Note that I've skipped the step of using the SetupDi functions in my program, and instead used RegEdit to search through the registry to find the symbolic device path that is needed to be used as the FileName in the CreateFile function. I have hardcoded this path into my program, so I don't need to worry about all of the extra mess that comes from using the SetupDi functions.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #289 on: January 20, 2017, 05:12:31 am »
Don't try to port my non working sample (and waste your time), better use the Linux sample in C, that was confirmed to work:
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg819493/#msg819493

additional its good to read the messages before and after this post.
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline gtoal

  • Newbie
  • Posts: 1
  • Country: us
Re: Question about FLIR One for Android
« Reply #290 on: January 25, 2017, 06:24:14 am »
Well done! Now we need to get it automated.

Casual readers like myself who have just ploughed through 22 pages of conversation looking for the code to install FlirOne (V2) support on your RPi, please don't use this until the regulars have checked it out and posted any fixes needed.  IT IS UNTESTED.

This is a very quick conversion of the two most recent linux posts into a shell script which generates the commands which I think the authors are saying are needed.  Being short a spare SD card at this particular moment, I haven't yet tried it out on a clean install (or otherwise) myself, so caveat emptor.

Code: [Select]
#!/bin/bash
KERNEL_VSN=`uname -a|tr ' ' '\n'|head -3|tail -1`
echo "#!/bin/sh"
echo "mv linux-headers-${KERNEL_VSN}_${KERNEL_VSN}-2_armhf.deb linux-headers-${KERNEL_VSN}_${KERNEL_VSN}-2_armhf.deb.PREV 2> /dev/null"
echo "wget [url]https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/linux-headers-[/url]${KERNEL_VSN}_${KERNEL_VSN}-2_armhf.deb"
echo "sudo apt-get --assume-yes install bc"
echo "sudo dpkg -i linux-headers-${KERNEL_VSN}_${KERNEL_VSN}-2_armhf.deb"
echo "sudo apt-get --assume-yes install libv4l-dev"
echo "sudo apt-get --assume-yes install v4l2loopback-dkms"
echo "dpkg --get-selections |grep v4l"
echo "git clone [url]https://github.com/umlaeute/v4l2loopback[/url]"
echo "cd v4l2loopback/"
echo "sudo make"
echo "sudo make install"
echo "find / -name v4l2loopback.ko  2>/dev/zero"
echo "sudo modprobe videodev"
echo "sudo insmod ./v4l2loopback.ko"
echo "# sudo insmod /lib/modules/${KERNEL_VSN}/extra/v4l2loopback.ko video_nr=0,1,2,3"
exit 0

offhand I wonder if git or dkpg come preinstalled on the rpi or if they will need to be installed with apt-get too? (not having a virgin system to hand I can't check that right now).  In any case maybe this quick script will provide the impetus for a proper installer to be created.

Graham
 

Offline Mohanad

  • Newbie
  • Posts: 1
  • Country: ae
Re: Question about FLIR One for Android
« Reply #291 on: January 25, 2017, 02:42:06 pm »
Hello

I'm trying to build an android app using the FLIR ONE SDK, but am facing some difficulties.

Is it possible to obtain an image with its temperature spread data ? the Raw Image? How?

And how can i get the correct code to extract the temperature at any point within the image.

Thanks
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #292 on: January 27, 2017, 03:28:09 am »
You know that FLIR One Linux program that was posted much earlier in this thread. Has anybody yet managed to port any of that Linux source code to Windows yet?
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #293 on: February 05, 2017, 05:38:03 am »
This thread has different versions of a linux program for working with the FLIR One over USB. They are presented a C source code in files like flir7h.c, flir8g.c, etc. What I can't figure out is which is the latest version of this program. I would like to attempt to port it to Windows, and want to make sure I'm working with the latest version.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #294 on: February 05, 2017, 01:45:57 pm »
There is no latest = best version  ;)

If you want to port it to windows, then keep it simple.
Ignore the v4l device and save thermal.jpg and real.jpg images:
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg839518/#msg839518

for v4l see this and the following post:
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg840976/#msg840976
« Last Edit: February 05, 2017, 01:51:22 pm by tomas123 »
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #295 on: February 09, 2017, 05:00:33 am »
There is no latest = best version  ;)

If you want to port it to windows, then keep it simple.
Ignore the v4l device and save thermal.jpg and real.jpg images:
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg839518/#msg839518

for v4l see this and the following post:
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/msg840976/#msg840976

I don't want to save just JPEG images. I want to access the 16-bits raw video data stream, but do it on Windows. It would seem that the V4L version is what's needed to access the raw streams (rather than just jpeg compressed images), but V4L is of course Video for Linux, and of course that doesn't work on Windows. I need a solution that combines the 2, and lets me access the raw 16bit-per-pixel thermal video stream from within Windows.

Anybody know how to do that?
 

Offline RTouris

  • Newbie
  • Posts: 5
  • Country: gr
Re: Question about FLIR One for Android
« Reply #296 on: February 09, 2017, 10:53:27 am »
Apologies for being OT but having not managed to find a specific answer to my somewhat peculiar question elsewhere I thought I'd post it here since it's next to the closest related (as well as heavily populated) thread.

So I have this FlirOne (v2) for iOS which I wonder if it is possible to use on an Android device via a ligthing to micro-usb adapter. I'd expect this to be somewhat possible (I'd expect that the internals are the same?) however having an Intel Atom tablet (Lenovo S8-50) I fail to get this to work using the app that Georg released (as outlined here: https://www.eevblog.com/forum/thermal-imaging/flir-one-gen-2-android-app-that-works-with-intel-atom-based-platforms/ ), being so that the native app won't even launch on the x86 android platform.

So I'm at a loss as to why I'm not getting any feedback seeing that F1G2 (Android) works on other x86 Android tablets, it is due to F1G2 being the iOS variant using it with an adapter or maybe because the particular tablet is somehow incompatible with the specific app? (Other USB OTG apps function properly on this particular tablet).

FYI. Tablet runs x86 Lollipop 5.0.1.
« Last Edit: February 09, 2017, 10:58:48 am by RTouris »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #297 on: February 09, 2017, 01:25:47 pm »
It has been previously reported that the iOS F1G2 will not work with an Android host using an adapter cable. I am no expert but I suspect the Apple ID chip that resides inside the iOS version causes the issue. Either that or the iOS port does not identify itself in the same way that a standard USB port does.

IIRC, someone eve. Tried tapping into the USB data lines after the Apple ID chip and it was still not recognised by a USB host.

Others may know more about this.

For info. I can run the official FLIR on my Motorola MOTO G Android phones that are using the ARM, but it will not run on a Hudl that is using the Atom processor. The app by Georg works well on the Moto G and the Hudl.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline RTouris

  • Newbie
  • Posts: 5
  • Country: gr
Re: Question about FLIR One for Android
« Reply #298 on: February 09, 2017, 05:16:23 pm »
Thanks for the insight, exactly the info I was looking for. I was aware of the native Flir app being unable to run on the Atom Android platform, so I thought I'd give Georg's app a spin on that Intel tablet only to bump into that other issue (iOS adapter on Android host). Oh well, I suppose it's kudos to Georg for releasing it for the iOS platform afterall :)  :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #299 on: February 10, 2017, 08:52:39 am »

I don't want to save just JPEG images. I want to access the 16-bits raw video data stream, but do it on Windows.
Anybody know how to do that?

Yes, I understand your problem, but there are two steps:
(1) USB communication with F1G2
(2) video stream in windows

I think, for solution of the first task the smaller jpg-version without  V4L part is a good entry point.
There is no Click-To-Run solution for compiling the linux code in windows.
Have fun  ;)

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #300 on: February 17, 2017, 10:18:03 pm »

I don't want to save just JPEG images. I want to access the 16-bits raw video data stream, but do it on Windows.
Anybody know how to do that?

Yes, I understand your problem, but there are two steps:
(1) USB communication with F1G2
(2) video stream in windows

I think, for solution of the first task the smaller jpg-version without  V4L part is a good entry point.
There is no Click-To-Run solution for compiling the linux code in windows.
Have fun  ;)

The Windows has an equivalent to V4L (video for Linux). It's called VFW (video for Windows). In order to use the VFW framework, you simply need to write a VFW driver for the device in question. In this case, the device is the FLIR One Gen2. VFW supports a number of different video formats, but unfortunately 16bit grayscale isn't one of them. However, I can think of a potential workaround. That workaround, is to write a driver based on YUYV. This way the driver will accept 16bits of data (YU bytes on the first pixel, and YV bytes on the second pixel, etc). Now, once the driver is written and compiled, and you access your F1G2 from within your own software using the VFW driver, will the preview window interpret this as YUYV color data, and the preview window will show it incorrectly. However the VFW framework allows you to write your own video stream callback function in your program, and using this feature you will be able to access the raw pixels, and write your own code that does not process it as YUYV color data, and instead handle it correctly as 16bit grayscale data.

All I need now, is to find a member of these forums, who's willing to take their time and write a VFW driver for the F1G2.
 

Offline djcasper

  • Newbie
  • Posts: 4
  • Country: gb
Re: Question about FLIR One for Android
« Reply #301 on: February 28, 2017, 04:14:28 pm »
Hello.

I have tried your example of extracting jars and when I do the steps you provided I only get 1 jar file. If i look in exploded view on the sample project i can see the jars but cant edit them. I'm trying to get an editable version of the new 1.2.8 sdk to work with because the basis 04 that was posted is very bad and has overflow errors which you can see in 14 bit linear mode near hot items above its max temp. when i use the new flir one sdk this does not happen.

also many bugs are removed i the newer sdk.

I have been laying around with the 04 bundle but now im at a halt because of the faults it has.

i have tried to do each step and i just cant seem to get all this done with the new 1.2.8 sdk.
any help would be appreciated.



Hi sonic,

good work  :-+ :-+

Do you know my posts about the SDK?
You can edit the sdk java files and also switch from cropped to full lepton resolution. Read this thread for more informations...
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

background:
 http://stackoverflow.com/questions/21417419/how-to-convert-aar-to-jar
Quote
Android Studio (version: 1.3.2) allows you to seamlessly access the .jar inside a .aar.
Bonus: it automatically decompiles the classes!
Simply follow these steps:
1. File > New > New Module > Import .JAR/.AAR Package to import you .aar as a module
2. Add the newly created module as a dependency to your main project (not sure if needed)
3. Right click on "classes.jar" as shown in the capture below, and click "Show in explorer". Here is your .jar.

next step:
Android Studio / File / Project Structur
     Modules "app" / Dependencies / + "Module Dependency" and select FlirSDK




SDK without cropped images (full resolution 160x120):

change SDK path for CameraFiles from intern
/data/data/com.flir.flironeexampleapplication/files/CameraFiles
to extern
/sdcard/Android/data/com.flir.flironeexampleapplication/files/CameraFiles

by editing two code lines
Code: [Select]
\FLIROneSDKBundle\FLIRONEExampleApplication\app\src\main\java\com\flir>grep -r -n -A1  getFilesDir *
flironesdk/Device.java:213:        //FrameProcessor.updateCameraFiles(zis, cachedContext.getFilesDir().getAbsolutePath() + File.separator);
flironesdk/Device.java-214-        FrameProcessor.updateCameraFiles(zis, cachedContext.getExternalFilesDir(null).getAbsolutePath() + File.separator);
--
flironesdk/FrameProcessor.java:101:        // String storagePath = context.getFilesDir().getAbsolutePath() + File.separator;
flironesdk/FrameProcessor.java-102-        String storagePath = context.getExternalFilesDir(null).getAbsolutePath() + File.separator;

next step is avoid overwriting your file calib.rsc after starting the apk
edit the function updateCameraFiles() in file FrameProcessor.java
Code: [Select]
static void updateCameraFiles(ZipInputStream zis, String storagePath)
{
    try
    {
        ZipEntry ze;
        while ((ze = zis.getNextEntry()) != null) {
            File f = new File(storagePath + ze.getName());
            if ((!f.exists())||(!ze.getName().endsWith( "calib.rsc")))
            {
                if (ze.isDirectory()) {
                    //File f = new File(storagePath + ze.getName());
                    if (!f.isDirectory()) {
                        f.mkdirs();
                    }
                } else {
                    File parentDir = new File(storagePath + ze.getName()).getParentFile();
                    if (( null != parentDir) &&
                            (!parentDir.isDirectory())) {
                        parentDir.mkdirs();
                    }
                    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(storagePath + ze.getName()));
                    byte[] bytesIn = new byte['?' ];
                    int read;
                    while ((read = zis.read(bytesIn)) != - 1) {
                        bos.write(bytesIn, 0, read);
                    }
                    zis.closeEntry();
                    bos.flush();
                    bos.close();
                }
            }
        }
        zis.close();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
simple delete
/sdcard/Android/data/com.flir.flironeexampleapplication/files/CameraFiles/system/calib.rsc
for getting a fresh version of the file from the FlirOne Flash

now you can edit your calib.rsc (without always overwriting with original file from your F1)

edit your calib.rsc to remove the crop factor by removing the .calib.lensCorr part
the crop factor is inside *.fff files, this files are not bad pixel map files (like Ex):
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.345
.calib.lensCorr.ds_we_ap_fi_le.type int32 100
.calib.lensCorr.ds_we_ap_fi_le.zoom double 7.69
.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.345
.calib.lensCorr.ds_we_ap_fi_leExFOL2.type int32 100
.calib.lensCorr.ds_we_ap_fi_leExFOL2.zoom double 7.69

calc a new checksum crc
Code: [Select]
// crc32 sample on bash command line

// count 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
first try this steps with an original file
inside the large E4 thread in this forum you find some more methods for calculating the Flir CRC



a hint: the FlirOne App from Play Store save the original CameraFiles also to the visible path:
/sdcard/Android/data/com.flir.flirone/files/
CameraFiles.zip
CameraFilesSimu.zip

Here you can always get an original (unpatched) CameraFiles.zip.


view my thermal gallery  ;)
https://www.eevblog.com/forum/testgear/flir-e4-thermal-imaging-camera-teardown/msg802245/#msg802245
Flir One G2 Lepton 160x120 with hacked config file calib.rsc


 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #302 on: March 01, 2017, 08:51:27 am »
As I wrote earlier, there is no click to run solution for getting working java code from a aar file (binary code).
You must manuell debug the source code fragments and stitch to your project until all works fine.

The link above to stackoverflow is a good entry point.

Test it with differents decompilers, because different decompilers deliver differents results.
Make the best of them.

--------
see also
ApkTook     http://ibotpeaches.github.io/Apktool/
dex2jar       http://sourceforge.net/projects/dex2jar/
decompiler:
   JD-GUI        https://github.com/java-decompiler/jd-gui
   bytecode-viewer  https://github.com/Konloch/bytecode-viewer   
   and don't forget the decompiler in Android Studio  ;)

Offline djcasper

  • Newbie
  • Posts: 4
  • Country: gb
Re: Question about FLIR One for Android
« Reply #303 on: March 07, 2017, 09:38:56 am »
DO NOT USE THIS IF YOUR GOING TO USE GOOGLE PLAY!!!!!

THIS CODE JUT GOT ME IN BIG TROUBLE WITH GOOGLE THEY SUSPENDED IT SAYING IT WAS MALICIOUS I ALREADY HAVE 3 SUSPENSIONS SO NOW I HAVE 4 I DARE NOT EVEN UPDATE MY CURRENT APPS OR EVER UPLOAD A NEW APP AP AGAIN IN CASE ,Y ACCOUNT GETS CLOSED. IT JUST PROVES USING SAMPLES ONLINE IS VERY DANGEROUS AND UNLESS YOU HAVE WRITTEN IT YOUR SELF STAY AWAY.

LIBPNG LIBRARY HAS VULNERABILITIES THAT COME UNDER "MALICIOUS BEHAVIOUR" AND THE USER DATA POLICY ALL VOILATED!!!!

NO HAPPY AT WHAT THE CONTENTS OF THIS SITE HAVE DONE TO MY GOOGLE PLAY DEV ACCOUNT.

THANKS VERY MUCH I REALLY APRECIATE ALL YOUR HELP AND THE FACT THAT ITS ALMOST CLOSED MY GOOGLE ACCOUNT.



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
 

Offline djcasper

  • Newbie
  • Posts: 4
  • Country: gb
Re: Question about FLIR One for Android
« Reply #304 on: March 07, 2017, 09:42:39 am »
HERES THE SCREENSHOT OF MY EMAIL FROM GOOGLE PLAY.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #305 on: March 07, 2017, 12:16:49 pm »
Djcasper,

Sorry to hear you are having some issues with others code that you have decided to use in your application.

I do find your post amusing however. Where did you read that all code on this forum developed by others is 'safe' and 'perfect' . A developer should be aware of the risks of using code written by others.

People on this forum have tried to assist you, please do not get annoyed with them if something goes wrong...... it is development after all !

Now to your Google Play problem.........

Have you considered writing to Google and explaining what you have been developing and the fact that there was no malicious intent ? Such may be looked upon favourably and the strike removed. I see that you say you have previous strikes against your account. Maybe you need to determine how to test your developer code before exposing Google Play to it ? Ask Google for advice or go to a Android developer forum To seek such. In my world we operated pre-prop systems to test code before uploading it into a live environment. Maybe such exists for Android ?

Please do not get angry against fellow developers, that can only lead to you being ignored when asking for help in the future.

Time for a deep breath and a carefully crafted email to Google, and then maybe, a less vitriolic post on this forum that is not in capitals ?

There are some very good, friendly and helpful people on this forum. Do not alienate them. They are just trying to offer help and remember, they are doing so in their own time and without reward. Perfect they are not, neither do they deserve to be subjected to angry posts for a possible error that they have made.

Just my thoughts. Feel free to do with them what you will.

Fraser
« Last Edit: March 07, 2017, 12:26:31 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: firehopper

Offline djcasper

  • Newbie
  • Posts: 4
  • Country: gb
Re: Question about FLIR One for Android
« Reply #306 on: March 07, 2017, 06:46:18 pm »
Hello,
I get what your saying now i'm a little calmer.
I'm am sorry for the way i reacted. There really is no need.

Because my android programming is limited I try to understand the best i can.
My apps I have made took many days whereas an experienced programmer for android could do it in a hour maybe half.
I was annoyed because there was an older editable version and no matter how im told to do it i don't get it.
I have decompiled the java and tried everything to get the upto date version working so i can actually move on and play around.
I have lots of exp with hacking but unfortunately i reprogramed chips eproms hex codes for modified items that saved people a lot of money over the years but on wont say in public on what. .

I feel when I can get going I have a lot to offer on reverse engineering the flir and theres a few things I want to do when I get this updated 1.2.8 i think it is in an editable manner then I can work on raw data and do some reprogramming on the actual hardware calls. I believe the things i want to do will greatly improve the improvements already done which with the help of this forum I managed to do as said to achieve the bigger images sizes and stop them over writing them. which i am thankful for.
Ive even been willing to pay anybody who will send me a working 1.2.8 version where i can edit all the files from within the .aar file namely the java thats how much I want to get this going.
I love the fact that flir allow apps to be made but I love the fact that you can do so much more when restrictions are removed such as imported java that you cant edit.

Most can do this with ease I cant because Its not something I do ... yet

Anyway my other apps did have issues down to me not backing up older projects and reusing parts of others to update an existing app and leaving the old google add code in. silly little things like ads on an app that links to youtube somewhere and because it has ads on they pretty much made me update however with no help from them to find out what my problems was i would try fid the issue resubmit then end up suspended.

This however they seen as malicious intent due to new regulations on libpng which come in to effect in september or from now on any new updates to existing apps or any new apps.

i assume it was the streaming they didnt like and i removed it however i have no idea where this libpng is so i cant even go ahead and rename  the project and try again incase i get my google account blocked totally.

anyways sorry once again im trying so hard with this spending everyday and getting nowhere at all.




 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #307 on: March 08, 2017, 12:00:31 am »
DO NOT USE THIS IF YOUR GOING TO USE GOOGLE PLAY!!!!!

THIS CODE JUT GOT ME IN BIG TROUBLE WITH GOOGLE
What do you mean exactly with your warn about my raspberry pi code written for a linux system?

https://support.google.com/faqs/answer/7011127?hl=en
Change your Libpng version!

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #308 on: March 08, 2017, 08:55:58 am »
Ah, I see...
(1) For reverse engineering of the Flir one USB protocol I debugged with user cynfab  :-+ :-+ the traffic between the camera and an Android system.
(2) For this purpose I decompiled some Flir java libraries in 2015 (proof of concept).
(3) 16 month later you upload own code with the manipulated Flir SDK (from my code) to the google play store   :palm:
(4) You violate the law, because the terms of licence from the Flir One SDK prohibit the manipulation of the SDK  |O
(5) Be happy, that Google refused your apk, because the outdated Flir SDK from 2015 used an old Libpng version  :-DD


Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #309 on: March 09, 2017, 03:48:39 pm »
Hello! My english is bad (I studied German,But did not learn :) ) . Sorry.  :-[
I buy Flir One Gen 2. I connect Flir One to PC. I read this thema and create my programm for Windows XP. Tomas123, many thanks for the your program!
I use usblib v1.26, but ep 0x83 and ep 0x85 received is error: "libusb0-dll:err [submit_async] submitting request failed, win error: The parameter is incorrect".  |O

Algorithm:

1)  usb_init(); usb_find_busses(); usb_find_devices().
2) Find device. USBDeviceHandle=usb_open(dev).
3) usb_set_configuration(USBDeviceHandle,3).
4) usb_claim_interface(USBDeviceHandle,0); usb_claim_interface(USBDeviceHandle,1); usb_claim_interface(USBDeviceHandle,2).
5) Stop inerface 1 and 2.
    usb_control_msg(USBDeviceHandle,1,0x0b,0,2,data,0,100);   - Why "0"?
    usb_control_msg(USBDeviceHandle,1,0x0b,0,1,data,0,100)    - Why "0"?
6) Start interface 1.
    usb_control_msg(USBDeviceHandle,1,0x0b,1,1,data,0,100)  - Why "0"?
7) Read 0x81: usb_bulk_read(USBDeviceHandle,0x81,Data,SizeOfData,10);
8) Read 0x83: usb_bulk_read(USBDeviceHandle,0x83,Data,SizeOfData,10);
9) Start interface 2.
    usb_control_msg(USBDeviceHandle,1,0x0b,1,2,data,2,200) - Why "2"?
10) Read 0x81: usb_bulk_read(USBDeviceHandle,0x81,Data,SizeOfData,10);
11) Read 0x83: usb_bulk_read(USBDeviceHandle,0x83,Data,SizeOfData,10);
12) Read frame: usb_bulk_read(USBDeviceHandle,0x85,Data,SizeOfData,100);
13) go to  10

In line 11,12 received error (The parameter is incorrect). In line 10 - time out.

Maybe someone knows what the problem is? Thanks.

Programm (russian language in log file and text!).
« Last Edit: March 09, 2017, 03:53:20 pm by da-nie »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #310 on: March 10, 2017, 08:30:41 am »
You are the third user who tries to compile this code with windows (without success).

I think, the best way is to debug my working code with a Linux machine like Raspi (don't try a virtual machine!!).
You can also boot from an Ubuntu Live Media.

Then you can debug all binary packets and compare the usb traffic witth your windows machine.
Maybe that the overlaying usb library under windows not all transfer byte are identical with the linux usb library.

As I wrote the linux code I compared all transfer bytes with the logfile from cynfabs usb sniffer (see top ofv this thread).
And this was very tricky. The F1 is a diva. I guess there are somecritical timings and you need some delays  >:(

here is a sample from my first steps in 2015
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: "FLIRONEF03F8O0FAFFF"
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

: Mon Dec  7 09:55:58 2015

Mon Dec  7 09:55:58 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x81: LIBUSB_ERROR_TIMEOUT

Mon Dec  7 09:55:59 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x83: LIBUSB_ERROR_OTHER

Mon Dec  7 09:56:00 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x85: LIBUSB_ERROR_IO

: Mon Dec  7 09:56:01 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":"F03F8O0FAFF","partNumberBoard":"21200161301","versionBoard":"D","serialNumberLepton":"371871","versionLepton":"3.1.46","leptonQR":"A0371871","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"}}

Mon Dec  7 09:56:01 2015
 >>>>>>>>>>>>>>>>>bulk transfer (in) 0x85: LIBUSB_ERROR_PIPE

: Mon Dec  7 09:56:02 2015
 bulk read EP 0x81, actual length 282
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 33 2e 36 39 30 30 30 30 30 35 37 32 32 30 34 36 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 31 7d 7d 00 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:
?TU0g{"type":"batteryVoltageUpdate","data":{"voltage":3.69000005722046,"percentage":11}}?E?$??{"type":"batteryChargingCurrentUpdate","data":{"chargingCurrent":0}}?Qg??P{"type":"batteryChargingStateUpdate","data":{"chargingState":"stateNoCharging"}}

ask for CameraFiles.zip on EP 0x83:

: Mon Dec  7 09:56:02 2015

To be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 41 00 00 00 f8 b3 f7 00 ]

Write successful!
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"}}

To be sent Hexcode: 16 Bytes[ cc 01 00 00 01 00 00 00 33 00 00 00 ef db c1 c1 ]

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

: Mon Dec  7 09:56:02 2015

: Mon Dec  7 09:56:02 2015
 bulk read EP 0x81, actual length 16
HEX:
 cc 01 00 00 01 00 00 00 5d 00 00 00 df 5b 38 1a
STRING:
?]?[8

: Mon Dec  7 09:56:02 2015
 bulk read EP 0x81, actual length 93
HEX:
 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 31 2c 22 6d 6f 64 65 22 3a 22 72 22 7d 7d 00
STRING:
{"type":"openFileStatus","data":{"path":"CameraFiles.zip","streamIdentifier":11,"mode":"r"}}

: Mon Dec  7 09:56:04 2015

: Mon Dec  7 09:56:06 2015
 bulk read EP 0x81, actual length 99
HEX:
 cc 01 00 00 01 00 00 00 53 00 00 00 ec 2c e7 fa 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 33 2e 36 38 30 30 30 30 30 36 36 37 35 37 32 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 31 7d 7d 00
STRING:
?S?,??{"type":"batteryVoltageUpdate","data":{"voltage":3.6800000667572,"percentage":11}}

: Mon Dec  7 09:56:08 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 33 2e 36 39 30 30 30 30 30 35 37 32 32 30 34 36 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 31 7d 7d 00
STRING:
?TU0g{"type":"batteryVoltageUpdate","data":{"voltage":3.69000005722046,"percentage":11}}

: Mon Dec  7 09:56:12 2015
 bulk read EP 0x81, actual length 99
HEX:
 cc 01 00 00 01 00 00 00 53 00 00 00 ec 2c e7 fa 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 33 2e 36 38 30 30 30 30 30 36 36 37 35 37 32 2c 22 70 65 72 63 65 6e 74 61 67 65 22 3a 31 31 7d 7d 00
STRING:
?S?,??{"type":"batteryVoltageUpdate","data":{"voltage":3.6800000667572,"percentage":11}}

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #311 on: March 10, 2017, 02:45:01 pm »
Thank you! Now it is clear that the problem is with Windows. With the program for Linux, I'm not very interested. :) I'm sure that the program for Linux will work. I'll try all the same so far to launch under Windows.
 

Offline G0MJW

  • Regular Contributor
  • *
  • Posts: 51
  • Country: gb
  • Mike
    • G0MJW
Re: Question about FLIR One for Android
« Reply #312 on: March 10, 2017, 07:12:07 pm »
Don't linux and Windows use opposite byte order - bigendian vs littleendian? Maybe this has some impact.
Mike
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #313 on: March 10, 2017, 07:19:12 pm »
For Linux Mageia 5 the program is working. :) Data is accepted.

Bigendian and littleendian in USB protocol? Unlikely. The standard must accurately determine the order of the bytes.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #314 on: March 10, 2017, 10:48:26 pm »
For Linux Mageia 5 the program is working. :) Data is accepted.

Great.
Now you can translate step-by-step all "steps" to windows code.
Please tell us your progress.

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #315 on: March 11, 2017, 05:29:48 am »
In Windows, the functions in the libusb have a different format and other names.
For example:

long received=usb_bulk_read(USBDeviceHandle,0x81,Data,SizeOfData,10); - in Windows libusb.

long ret=libusb_bulk_transfer(devh, 2, my_string1, length, &transferred, 0); - in Linux libusb.

The function "usb_bulk_read" in Windows for endpoints 0x85 and 0x83 is also executed with an error: "libusb0-dll:err [submit_async] submitting request failed, win error: The parameter is incorrect". The reason I do not understand. This endpoints is isochronous. Maybe there is an error in windows libusb.

The result was a picture in linux and programm:
« Last Edit: March 11, 2017, 06:44:15 pm by da-nie »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #316 on: March 13, 2017, 09:01:34 am »
When I wrote the Linux F1 driver/code I rechecked all USB packages with the great doc "USB in a NutShell"
a sample http://www.beyondlogic.org/usbnutshell/usb5.shtml#StringDescriptors

My two cents:
I would install a Windows USB protocol sniffer and compare all transfered package bytes with the Linux version.
Then you fast find the difference  ;)

cynfabs usb sniffer was a great help.
excerpt from my notes:
Code: [Select]
>grep -A4  bmRequestType f6c*

SETUP: 0.0
0 bmRequestType = 80     
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0100 type (H) index (L)
4 wIndex 00
5 wLength 00
->DATA0: 80 06 00 01 00 00 40 00 dd 94
<-DATA1: 12 01 00 02 00 00 00 40 cb 09 96 19 08 01 01 02 03 01 ef bc
Device Descriptor result
Offset Field Value
0 bLength = 12
1 bDescriptorType = 01
2 bcdUSB = 0002
4 bDeviceClass = 00
5 bDeviceSubClass = 00
6 bDeviceProtocol = 00
7 bMaxPacketSize0 = 40
8 idVendor = cb09
10 idProduct = 9619
12 bcdDevice = 0801
14 iManufacturer = 01
15 iProduct = 01
16 iSerialNumber = 0203
17 bNumConfigurations = 01

--
SETUP: 0.0
0 bmRequestType = 00
1 bRequest = 05                          SET_ADDRESS
2 wValue 004c  0x4c = 76
4 wIndex 00
5 wLength 00
DATA0: 00 05 4c 00 00 00 00 00 e4 f8

--
SETUP: 76.0
0 bmRequestType = 80
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0100 type (H) index (L)
4 wIndex 00
5 wLength 00
-> DATA0: 80 06 00 01 00 00 12 00 e0 f4
<- DATA1: 12 01 00 02 00 00 00 40 cb 09 96 19 08 01 01 02 03 01 ef bc
Device Descriptor result
Offset Field Value
0 bLength = 12
1 bDescriptorType = 01
2 bcdUSB = 0002
4 bDeviceClass = 00
5 bDeviceSubClass = 00
6 bDeviceProtocol = 00
7 bMaxPacketSize0 = 40
8 idVendor = cb09
10 idProduct = 9619
12 bcdDevice = 0801
14 iManufacturer = 01
15 iProduct = 01
16 iSerialNumber = 0203
17 bNumConfigurations = 01

--
0 bmRequestType = 80
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0002 type (H) index (L)
4 wIndex 00
5 wLength 00
-> DATA0: 80 06 00 02 00 00 09 00 ae 04
<- DATA1: 09 02 60 00 03 03 04 c0 00 2b 05

--
0 bmRequestType = 80
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0002 type (H) index (L)
4 wIndex 00
5 wLength 00
-> DATA0: 80 06 00 02 00 00 60 00 80 54
<- 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 ca ae
<-DATA0: 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 a7 0d

   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

--
0 bmRequestType = 80
1 bRequest = 06                          GET_DESCRIPTOR
2 wValue 0300 type (H) index (L)          type: String Descriptor (0x03)  // http://www.beyondlogic.org/usbnutshell/usb5.shtml#StringDescriptors
4 wIndex 00
5 wLength 00
DATA0: 80 06 00 03 00 00 ff 00 d4 64
-> String Descriptor result
     Offset Field Value
     0 bLength = 04
     1 bDescriptorType = 03
     2 bString 0409

 
--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0302 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 02 03 09 04 ff 00 97 db
-> String Descriptor result (FLIR ONE Camera)


--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0301 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 01 03 09 04 ff 00 97 e8
-> String Descriptor result (FLIR SYSTEMS)

--
0 bmRequestType = 80
1 bRequest = 06                     GET_DESCRIPTOR
2 wValue 0303 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 03 03 09 04 ff 00 96 0a
-> String Descriptor result (FLIRONEF03F6200xxxx)

--
0 bmRequestType = 00
1 bRequest = 09                     SET_CONFIGURATION     03
2 wValue 0003 type (H) index (L)
4 wIndex 00
5 wLength 00
DATA0: 00 09 03 00 00 00 00 00 26 c7

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
 2 wValue 0304 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 04 03 09 04 ff 00 97 bd
-> String Descriptor result (SBI BDP Configuration)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
 2 wValue 0305 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 05 03 09 04 ff 00 96 6c
-> String Descriptor result (iAP Interface)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
 2 wValue 0306 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 06 03 09 04 ff 00 96 5f
-> String Descriptor result (com.flir.rosebud.fileio)

--
0 bmRequestType = 80
1 bRequest = 06                    GET_DESCRIPTOR
 2 wValue 0307 type (H) index (L)
4 wIndex 09
5 wLength 04
DATA0: 80 06 07 03 09 04 ff 00 97 8e
-> String Descriptor result (com.flir.rosebud.frame)

--
0 bmRequestType = 01
1 bRequest = 0b                     SET_INTERFACE
2 wValue 0000 type (H) index (L)          Alternate Setting 0
4 wIndex 02                                              Interface 2
5 wLength 00
DATA0: 01 0b 00 00 02 00 00 00 c5 40

--
0 bmRequestType = 01
1 bRequest = 0b                    SET_INTERFACE
 2 wValue 0000 type (H) index (L)          Alternate Setting 0
4 wIndex 01                                          Interface 1
5 wLength 00
DATA0: 01 0b 00 00 01 00 00 00 c5 04

--
0 bmRequestType = 01
1 bRequest = 0b                     SET_INTERFACE
 2 wValue 0001 type (H) index (L)           Alternate Setting 1
4 wIndex 01                                    Interface 1
5 wLength 00     
DATA0: 01 0b 01 00 01 00 00 00 c4 d5

--

[        ]   3.045669 d=  0.000001 [  4.1 + 96.633] [  3] IN   : 78.1
[        ]   3.045669 d=  0.000001 [  4.1 + 97.150] [515] DATA0: 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 ......
{"type":"sledInformation","data":{"serialNumberBoard":"F03F6200571","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","operatinw

[        ]   3.045741 d=  0.000001 [  4.2 + 44.367] [  3] IN   : 78.1
[        ]   3.045742 d=  0.000001 [  4.2 + 44.883] [ 26] DATA1: 67 4d 6f 64 65 22 3a 22 6f 70 65 72 61 74 69 6f 6e 61 6c 22 7d 7d 00 63 74
gMode":"operational"}}

[        ]   3.152582 d=  0.000000 [111.1 +  1.867] [  3] OUT  : 78.2
[        ]   3.152583 d=  0.000000 [111.1 +  2.267] [ 19] DATA0: cc 01 00 00 01 00 00 00 41 00 00 00 f8 b3 f7 00 6b d2

[        ]   3.153468 d=  0.000001 [112.0 + 12.600] [  3] OUT  : 78.2
[        ]   3.153468 d=  0.000000 [112.0 + 13.000] [ 68] DATA1: 7b 22 74 79 70 65 22 3a 22 6f 70 65 6e 46 69 6c 65 22 2c 22 64 61 74 61 22 3a 7b 22 6d 6f 64 65 22 3a 22 72 22 2c 22 70 61 74 68 22 3a 22 43 61 6d 65 72 61 46 69 6c 65 73 2e 7a 69 70 22 7d 7d 00 9c 80
{"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
 

[        ]   3.159050 d=  0.000001 [117.4 + 94.250] [  3] OUT  : 78.2
[        ]   3.159051 d=  0.000000 [117.4 + 94.650] [ 19] DATA0: cc 01 00 00 01 00 00 00 33 00 00 00 ef db c1 c1 bf 77


[        ]   3.159582 d=  0.000018 [118.1 +  0.933] [  3] OUT  : 78.2
[        ]   3.159582 d=  0.000000 [118.1 +  1.333] [ 54] DATA1: 7b 22 74 79 70 65 22 3a 22 72 65 61 64 46 69 6c 65 22 2c 22 64 61 74 61 22 3a 7b 22 73 74 72 65 61 6d 49 64 65 6e 74 69 66 69 65 72 22 3a 31 30 7d 7d 00 a1 23
{"type":"readFile","data":{"streamIdentifier":10}}
 
[        ]   3.162183 d=  0.000001 [120.5 +102.317] [  3] IN   : 78.3
[        ]   3.162184 d=  0.000001 [120.5 +102.833] [ 27] DATA0: 10 55 00 00 01 00 00 00 b7 1a 00 00 0a 00 00 00 00 99 9d 5d 2c 91 a3 df 5e 15

[        ]   3.166051 d=  0.000001 [124.4 + 94.367] [  3] IN   : 78.3
[        ]   3.166051 d=  0.000001 [124.4 + 94.883] [515] DATA1: 50 4b 03 04 14 00 08 08 08 00 77 7b 15 47 00.....
PK zip Datei

[        ]   3.166095 d=  0.000001 [124.5 + 13.167] [  3] IN   : 78.3
[        ]   3.166095 d=  0.000001 [124.5 + 13.683] [515] DATA0: 9b e6 28 68 48 b6 71 d0 9a b1 8d 84 ......
usw
----

[        ]   3.171615 d=  0.000001 [130.1 + 33.617] [  3] OUT  : 78.2
[        ]   3.171616 d=  0.000000 [130.1 + 34.017] [ 19] DATA0: cc 01 00 00 01 00 00 00 33 00 00 00 ef db c1 c1 bf 77

[        ]   3.172186 d=  0.000001 [130.5 +103.600] [  3] OUT  : 78.2
[        ]   3.172186 d=  0.000000 [130.5 +104.000] [ 54] DATA1: 7b 22 74 79 70 65 22 3a 22 72 65 61 64 46 69 6c 65 22 2c 22 64 61 74 61 22 3a 7b 22 73 74 72 65 61 6d 49 64 65 6e 74 69 66 69 65 72 22 3a 31 30 7d 7d 00 a1 23
{"type":"readFile","data":{"streamIdentifier":10}}


[        ]   3.172642 d=  0.000000 [131.1 + 60.300] [  3] IN   : 78.3
[        ]   3.172643 d=  0.000001 [131.1 + 60.833] [ 27] DATA1: 10 55 00 00 01 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 69 e7 7b b0 e5 eb

SDK App sendet keine 2. Anfrage, Rückmeldung ggf für empty

--
0 bmRequestType = 01
1 bRequest = 0b                              SET_INTERFACE
 2 wValue 0001 type (H) index (L)           Alternate Setting 1
4 wIndex 02                                              Interface 2
5 wLength 00

--

[        ]   3.232393 d=  0.000001 [190.7 + 56.067] [  3] OUT  : 78.2
[        ]   3.232393 d=  0.000000 [190.7 + 56.467] [ 65] DATA1: 7b 22 74 79 70 65 22 3a 22 73 65 74 4f 70 74 69 6f 6e 22 2c 22 64 61 74 61 22 3a 7b 22 6f 70 74 69 6f 6e 22 3a 22 61 75 74 6f 46 46 43 22 2c 22 76 61 6c 75 65 22 3a 74 72 75 65 7d 7d 00 3e 5b
{"type":"setOption","data":{"option":"autoFFC","value":true}}0x00

[        ]   3.233349 d=  0.000001 [191.7 + 12.633] [  3] IN   : 78.1
[        ]   3.233350 d=  0.000001 [191.7 + 13.150] [ 85] DATA0: cc 01 00 00 01 00 00 00 42 00 00 00 16 1c 42 12 7b 22 74 79 70 65 22 3a 22 73 65 74 4f 70 74 69 6f 6e 53 74 61 74 75 73 22 2c 22 64 61 74 61 22 3a 7b 22 6f 70 74 69 6f 6e 22 3a 22 61 75 74 6f 46 46 43 22 2c 22 76 61 6c 75 65 22 3a 2d 31 7d 7d 00 89 bd
{"type":"setOptionStatus","data":{"option":"autoFFC","value":-1}}


// anderer Mitschnitt


[        ]  20.832630 d=  0.000018 [231.5 +  0.933] [  3] OUT  : 89.2
[        ]  20.832630 d=  0.000000 [231.5 +  1.333] [ 65] DATA1: 7b 22 74 79 70 65 22 3a 22 73 65 74 4f 70 74 69 6f 6e 22 2c 22 64 61 74 61 22 3a 7b 22 6f 70 74 69 6f 6e 22 3a 22 61 75 74 6f 46 46 43 22 2c 22 76 61 6c 75 65 22 3a 74 72 75 65 7d 7d 00 3e 5b
{"type":"setOption","data":{"option":"autoFFC","value":true}}


[        ]  21.627581 d=  0.000001 [  2.4 + 14.133] [  3] IN   : 89.1
[        ]  21.627582 d=  0.000001 [  2.4 + 14.650] [ 87] DATA1: cc 01 00 00 01 00 00 00 44 00 00 00 ca 43 29 37 7b 22 74 79 70 65 22 3a 22 73 65 74 4f 70 74 69 6f 6e 53 74 61 74 75 73 22 2c 22 64 61 74 61 22 3a 7b 22 6f 70 74 69 6f 6e 22 3a 22 61 75 74 6f 46 46 43 22 2c 22 76 61 6c 75 65 22 3a 74 72 75 65 7d 7d 00 ab 6b
{"type":"setOptionStatus","data":{"option":"autoFFC","value":true}}


[        ]  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
RAW Daten
It goes on and on and on from here.


Maybe there is an error in windows libusb.
I believe not.
You must exact generate the same byte sequence with the same length.

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #317 on: March 14, 2017, 05:23:14 pm »
Hm. In Mageia 5 and Raspbian this programm is work.
But in XUbuntu 16.10 this programm works poorly. Often occurs LIBUB_ERROR_PIPE! Hm...


 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #318 on: March 14, 2017, 08:06:46 pm »
I know:
happy our, on my Raspberry Pi the code also runs fine
I worked the last two weeks at wrong computers  |O


Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #319 on: March 17, 2017, 09:45:27 am »
I'm creating a program for QNX 6.3. The frame is collected in 20 seconds - all other frames are lost. Io-usb does not have time to receive all the data. In addition, Io-usb often ends abnormally. But all the same the program works with the device not with libusb, but with using USBD.

Also, CRC is used for the string.

Updated!  :-DD I changed timeout in usbd_io in 0. FPS - 2-3 image per sec!!! :) Programm updated.

Programm for QNX 6.3 SP 3.

« Last Edit: March 17, 2017, 11:49:10 am by da-nie »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #320 on: March 20, 2017, 05:24:45 pm »
New version for QNX 6.3! :)

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #321 on: March 21, 2017, 10:56:14 am »
Great  :-+

You asked two weeks ago for a Windows XP program.
And now I write code for QNX.
What is your target device?

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #322 on: March 21, 2017, 05:03:11 pm »
Target device - PC. :)
 ::) I use QNX 6.3 at work.  8)  For Windows the program does not work. Therefore, I tried writing a USB driver for QNX. In parallel, I'm writing on Qt4 a program for Linux. I have decided not to use Windows yet.

It is interesting how RAW14 is recalculated in temperature. In the datasheet, I did not find it...

 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #323 on: March 21, 2017, 11:16:01 pm »
There are some Flir documents about this.
The raw value is linear to radiance.
Therefore we only need Plancks Law.
see my footer for further informations.

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #324 on: March 22, 2017, 04:23:23 pm »
It is interesting how RAW14 is recalculated in temperature. In the datasheet, I did not find it...

A good source is the FLIR GEV Demo Source Code:
http://80.77.70.144/SwDownload/app/RssSWDownload.aspx?ID=143

PvSimpleUISampleDlg.cpp
the calibration values and air constants:
Code: [Select]
       // Get current measurement parameters
        PvGenFloat *lR = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "R" ) );
        PvGenFloat *lB = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "B" ) );
        PvGenFloat *lF = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "F" ) );
        // Get gain (J1) and offset (J0)
        PvGenInteger *lJ0 = dynamic_cast<PvGenInteger *>( lGenDevice->Get( "J0" ) );
        PvGenFloat *lJ1 = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "J1" ) );
        // Get spectral response
        PvGenFloat *lX = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "X" ) );
        PvGenFloat *la1 = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "alpha1" ) );
        PvGenFloat *la2 = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "alpha2" ) );
        PvGenFloat *lb1 = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "beta1" ) );
        PvGenFloat *lb2 = dynamic_cast<PvGenFloat *>( lGenDevice->Get( "beta2" ) );

and the temperature calculation
Code: [Select]
CTemperature PvSimpleUISampleDlg::imgToTemp(long lPixval)
{
    double tmp;
    CTemperature K;

    tmp = imgToPow(lPixval);
    //tmp = clipPow(tmp,pValState);
    tmp = powToObjSig(tmp);
    K = objSigToTemp(tmp);

    return (K);
}

see my excel sheet  RAW2Temp.xls  for details:
https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/?action=dlattach;attach=168737

the excel sheet and the "FLIR GEV Demo" only use the formulas from this two Flir documents:
only Plancks Law: https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/?action=dlattach;attach=83952
with air influence:  https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/?action=dlattach;attach=83950

 8)

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #325 on: March 23, 2017, 06:18:08 pm »
Thank you, Thomas123! In your program flir8p1c is a function of the temperature calculation. I used it. Now the program for QNX 6.3 is like this. :)

 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #326 on: March 27, 2017, 07:03:46 pm »
Preview version! Sometimes works for Windows!

I create driver FLIR One Gen 2 for Windows XP with WinDDK!
After calibration does not work!

Uses:
0) Find WdfCoInstaller01009.dll (its not in archive! Big size...)
1) Flir One Gen 2 On.
2) Wait for green LED.
3) Start FlirOneControl.exe.
4) In path Image must created files ".tga". ( If everything worked :) - Does not always work )
5) Fun. :)

The program used ReadFile in synchronously mode. After closing the window FlieOneControl in the task manager, close the application if it remains working.


 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #327 on: March 28, 2017, 09:35:55 am »
Stable version for Windows XP!

 ^-^

Note: If device removed, thern restart programm FlirOneControl!
« Last Edit: March 28, 2017, 06:07:04 pm by da-nie »
 

Offline frenky

  • Supporter
  • ****
  • Posts: 1003
  • Country: si
    • Frenki.net
Re: Question about FLIR One for Android
« Reply #328 on: March 28, 2017, 10:44:20 am »
Good job! :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #329 on: March 29, 2017, 03:37:15 pm »
@da-nie

I need some helps for the neccesary steps for running the FlirOneControl.exe (Windows 10).

I found a download of WdfCoInstaller01009.dll here
https://github.com/buaabyl/vmulti/tree/master/sys
and put the dll in your folder \FlirOneForWindows\FlirOneControl\Release.
Code: [Select]
> cd FlirOneForWindows\FlirOneControl\Release
> md5sum WdfCoInstaller01009.dll
a9970042be512c7981b36e689c5f3f9f *WdfCoInstaller01009.dll
But Procmon.exe from Sysinternals doesn't show any access of FlirOneControl.exe to WdfCoInstaller01009.dll.

There are three *.inf driver inside "\Driver for FLIR One Gen 2 for XP".
Code: [Select]
flironegen2_fileio.inf
flironegen2_frame.inf
flironegen2_iap.inf
Do I need to install these drivers?

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #330 on: March 29, 2017, 04:11:18 pm »
There is a problem. I use WinDDk 7.1.0. This WDK can not create a driver for Windows 10.

Quote
The Microsoft Windows Driver Kit (WDK) Version 7.1.0 is an update of the WDK 7.0.0 release and contains a set of tools, code samples, documentation, compilers, headers, and libraries that driver developers can use to create drivers for Windows 7, Windows Vista, Windows XP, Windows Server 2008 R2, Windows Server 2008, and Windows Server 2003.

WDK 10 i do not have. WDK 10 is integrated with Microsoft Visual Studio 2015. I not use Microsoft Visual Studio 2015, I use VC 6.  8) and Windows XP ( Yes, I'm retrograde  8) ). I can compile the driver for Windows 7. But i unknow, how to make an inf-file for Windows 7.  :-\ I use example for usb device in WDK 7.1.0. Today I'll try to make an inf for Windows 7 x86.

I do not know when I'll try WDK 10. But you can install WDK 10 and compile the driver. Maybe there will not be any changes to the program.  ::)

Quote
Do I need to install these drivers?

Yes, but this inf only XP...
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #331 on: March 29, 2017, 06:05:12 pm »
I compile driver for Windows 7 (x86,amd64,ai64). But I can not do inf-file. Does not work. Windows reports that the driver was not found.
And Windows does not see three devices! He sees only one device. Maybe that's why I did not install the driver.
By the way, WdfCoInstaller01009.dll needs different for different drivers (x86, amd64, ai64)!

Maybe someone can install drivers for Windows 7 and write an inf-file...


Update! On x64 platforms, a digital signature of the driver is required! Maybe, Therefore, the driver is not installed. On the Internet write that it can be fixed.
« Last Edit: March 29, 2017, 06:23:21 pm by da-nie »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #332 on: March 30, 2017, 07:43:31 pm »
In Windows 7 x86 Flir One is "USB Composite Device", but not as three devices (how in XP). How to separate them?  |O I do not know what to do to get three devices.
Devices ID:
USB\VID_09CB&PID_1996&MI_00 - iAP
USB\VID_09CB&PID_1996&MI_01 - FileIO
USB\VID_09CB&PID_1996&MI_02 - Frame

In Windows 7 devices ID: USB\VID_09CB&PID_1996 -  |O
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #333 on: April 05, 2017, 06:25:27 pm »
Updated programm for Windows XP. :)

Windows 7 is not supported...



 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #334 on: April 10, 2017, 05:03:42 pm »
Updated version for Windows XP. :) (For Windows the most stable work)

 
The following users thanked this post: joe-c

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: de
    • Joe-c.de
Re: Question about FLIR One for Android
« Reply #335 on: April 10, 2017, 09:22:46 pm »
if i have again a FLIR One i will try that program.
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Some Thermal cameras: Kameras
 

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #336 on: April 12, 2017, 04:51:53 pm »
Hello, I know it is a really noob question for you guys, but mayby somebody can help me and tell me how to compile the .c files ? I wanted to use the flir one cam for android on my raspberry pi3 to stream the picture together with a pi cam over wifi, but unfortunalty I don`t have the skills for it... I tried several .c files like the flir8l.c, the flir8l3.c and the flir8p1.c for example. I`m using the preinstalled Geany software on the raspberry. When I want to compile (F8), an error appears for missing the libusb.h.
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #337 on: April 12, 2017, 05:29:21 pm »
1) sudo apt-get install libusb [ENTER] or sudo apt-get install libusb-1.0-0-dev [ENTER]
2) make [ENTER] in project "flir...c" directory.

 
The following users thanked this post: Niels2

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #338 on: April 12, 2017, 11:39:42 pm »
Thanks da-nie, I allready installed the libhub, it seems to work with "make" in Geany (shift+F9) and I guess that I finally understood how to compile in the Linux command line... .
 

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #339 on: April 13, 2017, 01:46:14 pm »
After trying several versions, I think I got the camera somehow running, it looks like the list below. I run flir8l3 atm. But unfortunately I am unable to get a picture on the screen. When I run guvcview I got an error message: no video device found. I can choose between 3 dummy video devices, but when I click on the "ok" button the error message box disappear and nothing happens...   :'(
Btw., is there something like the "Windows" snipping tool in Rasbian implemented?

Quote
: Thu Apr 13 13:26:20 2017
 bulk read EP 0x81, actual length 100
HEX:
 80 00 64 00 00 00 00 00 00 00 00 00 00 00 00 00 1e 00 00 00 01 00 01 00 9e 00 76 00 07 00 2c 00 0e 00 a4 01 3f 00 1f 00 0f 00 14 00 00 00 00 00 07 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 3a 00 cd c3 d0 43 b3 0f f1 77 85 09 06 00 20 ca 15 00 e8 03 00 00 60 61 02 00 85 09 06 00 20 ca 15 00 e8 03
STRING:
?d?v,??:???C??w? ??`a? ?
#00000527 85/10 fps:{"shutterState":"ON","shutterTemperature":307.940002441406,"usbNotifiedTimestamp":1185381769.56599,"usbEnqueuedTimestamp":1185381769.56773,"ffcState":"FFC_VALID_RAD"}
#00000528 84/10 fps:{"shutterState":"ON","shutterTemperature":307.950012207031,"usbNotifiedTimestamp":1185381769.68106,"usbEnqueuedTimestamp":1185381769.68236,"ffcState":"FFC_VALID_RAD"}
#00000529 84/10 fps:{"shutterState":"ON","shutterTemperature":307.950012207031,"usbNotifiedTimestamp":1185381769.79381,"usbEnqueuedTimestamp":1185381769.79525,"ffcState":"FFC_VALID_RAD"}
#00000530 84/10 fps:{"shutterState":"ON","shutterTemperature":307.950012207031,"usbNotifiedTimestamp":1185381769.9109,"usbEnqueuedTimestamp":1185381769.91248,"ffcState":"FFC_VALID_RAD"}
#00000531 87/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.02179,"usbEnqueuedTimestamp":1185381770.02322,"ffcState":"FFC_VALID_RAD"}
#00000532 85/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.13591,"usbEnqueuedTimestamp":1185381770.13732,"ffcState":"FFC_VALID_RAD"}
#00000533 88/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.25076,"usbEnqueuedTimestamp":1185381770.25231,"ffcState":"FFC_VALID_RAD"}
#00000534 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.3639,"usbEnqueuedTimestamp":1185381770.36531,"ffcState":"FFC_VALID_RAD"}
#00000535 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.47768,"usbEnqueuedTimestamp":1185381770.4791,"ffcState":"FFC_VALID_RAD"}
#00000536 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.59205,"usbEnqueuedTimestamp":1185381770.59352,"ffcState":"FFC_VALID_RAD"}
#00000537 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.70577,"usbEnqueuedTimestamp":1185381770.70718,"ffcState":"FFC_VALID_RAD"}
#00000538 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.81978,"usbEnqueuedTimestamp":1185381770.82159,"ffcState":"FFC_VALID_RAD"}
#00000539 85/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381770.93474,"usbEnqueuedTimestamp":1185381770.93727,"ffcState":"FFC_VALID_RAD"}
#00000540 86/10 fps:{"shutterState":"ON","shutterTemperature":307.970001220703,"usbNotifiedTimestamp":1185381771.04869,"usbEnqueuedTimestamp":1185381771.05,"ffcState":"FFC_VALID_RAD"}
#00000541 85/10 fps:{"shutterState":"ON","shutterTemperature":307.970001220703,"usbNotifiedTimestamp":1185381771.16167,"usbEnqueuedTimestamp":1185381771.16308,"ffcState":"FFC_VALID_RAD"}
#00000542 85/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381771.27668,"usbEnqueuedTimestamp":1185381771.27798,"ffcState":"FFC_VALID_RAD"}
#00000543 84/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381771.3896,"usbEnqueuedTimestamp":1185381771.39102,"ffcState":"FFC_VALID_RAD"}
#00000544 86/10 fps:{"shutterState":"ON","shutterTemperature":307.959991455078,"usbNotifiedTimestamp":1185381771.50327,"usbEnqueuedTimestamp":1185381771.50501,"ffcState":"FFC_VALID_RAD"}

 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #340 on: April 13, 2017, 03:17:59 pm »
Change USB-port for FLIR One and disconnected all devices (without keyboard :) ).
In Raspberry Pi 3 FLIR One work unstable... libusb error and libusb timeout.

Your received data is normal. :) But this data is part full data.
 
The following users thanked this post: Niels2

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #341 on: April 13, 2017, 08:09:37 pm »
Thanks again for your fast response da-nie, but this solution seems not working for me. Maybe this helps;
Code: [Select]
pi@raspberrypi:~ $ sudo guvcview
GUVCVIEW: couldn't open /root/.config/guvcview2/video0 for read: No such file or directory
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video0
V4L2_CORE: Unable to find parent usb device.V4L2_CORE: Unable to find parent usb device.V4L2_CORE: Unable to find parent usb device.libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video4
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L interface: Invalid argument

** (guvcview:13857): WARNING **: Couldn't connect to accessibility bus: Empty address ''
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
pi@raspberrypi:~ $ GUVCVIEW: couldn't open /root/.config/guvcview2/video1 for read: No such file or directory
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video0
V4L2_CORE: Unable to find parent usb device.V4L2_CORE: Unable to find parent usb device.V4L2_CORE: Unable to find parent usb device.libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video4
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (libusb) couldn't get device
GUVCVIEW: no valid file extension for video file (?
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
^C
pi@raspberrypi:~ $
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #342 on: April 13, 2017, 11:33:35 pm »
Quote
V4L2_CORE: ERROR opening V4L2 interface for /dev/video0

Did you run the v4l2loopback kernel driver on your raspberry pi?

You need:
/dev/video1
/dev/video2


Code: [Select]
pi@raspberrypi:~/v4l2loopback $ sudo modprobe videodev

pi@raspberrypi:~/v4l2loopback $ sudo insmod v4l2loopback.ko video_nr=0,1,2,3
pi@raspberrypi:~/v4l2loopback $ lsmod
Module                  Size  Used by
v4l2loopback           26994  0
configs                32580  0
videodev              172779  1 v4l2loopback
media                  16312  1 videodev
bnep                   11853  2
hci_uart               21122  1
btbcm                   7885  1 hci_uart
bluetooth             365780  22 bnep,btbcm,hci_uart
brcmfmac              201842  0
brcmutil                9031  1 brcmfmac
snd_bcm2835            23131  0
snd_pcm                95473  1 snd_bcm2835
snd_timer              22556  1 snd_pcm
cfg80211              500739  1 brcmfmac
snd                    68400  3 snd_bcm2835,snd_timer,snd_pcm
rfkill                 21397  4 cfg80211,bluetooth
bcm2835_gpiomem         3759  0
bcm2835_wdt             4133  0
uio_pdrv_genirq         3718  0
uio                    10230  1 uio_pdrv_genirq
ipv6                  367697  24

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #343 on: April 13, 2017, 11:37:29 pm »
Finally it works!  :) got the flir8k running with the "mjpeg-stream" thats all I wanted. I have still no clue about getting the guvcview working, but after struggeling with the "kernel header things"  |O I`m totaly satisfied! Thank you all for your great work! :-+
 

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #344 on: April 13, 2017, 11:47:42 pm »
Quote
V4L2_CORE: ERROR opening V4L2 interface for /dev/video0

Did you run the v4l2loopback kernel driver on your raspberry pi?



I think so  :-//   but for now, it works like I wanted (the livestream via wifi). Next step is to automise everything on start. I hope it will be easier  ::)
Thanks again for your great support!  :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #345 on: April 14, 2017, 04:31:30 pm »
the v4l interface is tricky to install on the raspi

with the last raspi firmware
Code: [Select]
$ uname -a
Linux raspberrypi 4.4.50+ #970 Mon Feb 20 19:12:50 GMT 2017 armv6l GNU/Linux

.. I got the kernel headers with https://github.com/notro/rpi-source/wiki
see my terminal log
Code: [Select]
$ sudo apt-get install bc
$ sudo apt-get install dkms


pi@raspberrypi:~ $ mkdir temp
pi@raspberrypi:~ $ cd temp/
pi@raspberrypi:~/temp $ sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
--2017-04-09 15:21:32--  https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.112.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.112.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12670 (12K) [text/plain]
Saving to: ‘/usr/bin/rpi-source’

/usr/bin/rpi-source                        100%[=========================================================================================>]  12.37K  --.-KB/s   in 0.003s

2017-04-09 15:21:32 (4.06 MB/s) - ‘/usr/bin/rpi-source’ saved [12670/12670]

pi@raspberrypi:~/temp $ rpi-source

 *** gcc version check: OK

 *** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz

 *** Latest firmware revision: b51046a2b2bb69771579a549d157205d9982f858

 *** Linux source commit: e223d71ef728c559aa865d0c5a4cedbdf8789cfd

 *** Download kernel source
--2017-04-09 15:21:52--  https://github.com/raspberrypi/linux/archive/e223d71ef728c559aa865d0c5a4cedbdf8789cfd.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/raspberrypi/linux/tar.gz/e223d71ef728c559aa865d0c5a4cedbdf8789cfd [following]
--2017-04-09 15:21:53--  https://codeload.github.com/raspberrypi/linux/tar.gz/e223d71ef728c559aa865d0c5a4cedbdf8789cfd
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121, 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 136303810 (130M) [application/x-gzip]
Saving to: ‘/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd.tar.gz’

/home/pi/linux-e223d71ef728c559aa865d0c5a4 100%[=========================================================================================>] 129.99M  1.45MB/s   in 77s   

2017-04-09 15:23:11 (1.68 MB/s) - ‘/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd.tar.gz’ saved [136303810/136303810]


 *** Unpack kernel source

 *** Add '+' to kernel release string

 *** Create symlink: /home/pi/linux

 *** Create /lib/modules/<ver>/{build,source} symlinks

 *** .config

 *** Module.symvers

 *** make modules_prepare
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
...

 *** ncurses-devel is NOT installed. Needed by 'make menuconfig'. On Raspbian sudo apt-get install libncurses5-dev

 *** Help: https://github.com/notro/rpi-source/wiki

//check
ls -al /lib/modules/$(uname -r)/build
lrwxrwxrwx 1 root root 14 Apr  9 15:25 /lib/modules/4.4.50+/build -> /home/pi/linux


// weiter mit Treiber

$ sudo apt-get install libv4l-dev
$ sudo apt-get install git

pi@raspberrypi:~ $ git clone https://github.com/umlaeute/v4l2loopback
Cloning into 'v4l2loopback'...
remote: Counting objects: 1565, done.
remote: Total 1565 (delta 0), reused 0 (delta 0), pack-reused 1565
Receiving objects: 100% (1565/1565), 730.30 KiB | 439.00 KiB/s, done.
Resolving deltas: 100% (868/868), done.
Checking connectivity... done.

pi@raspberrypi:~ $ cd v4l2loopback/


$ cd v4l2loopback/
pi@raspberrypi:~/v4l2loopback $ sudo make clean
rm -f *~
rm -f Module.symvers Module.markers modules.order
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback clean
make[1]: Entering directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
  CLEAN   /home/pi/v4l2loopback/.tmp_versions
make[1]: Leaving directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
pi@raspberrypi:~/v4l2loopback $ sudo make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback modules
make[1]: Entering directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
  CC [M]  /home/pi/v4l2loopback/v4l2loopback.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/v4l2loopback/v4l2loopback.mod.o
  LD [M]  /home/pi/v4l2loopback/v4l2loopback.ko
make[1]: Leaving directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
pi@raspberrypi:~/v4l2loopback $ sudo make install
make -C /lib/modules/`uname -r`/build M=/home/pi/v4l2loopback modules_install
make[1]: Entering directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
  INSTALL /home/pi/v4l2loopback/v4l2loopback.ko
  DEPMOD  4.4.50+
make[1]: Leaving directory '/home/pi/linux-e223d71ef728c559aa865d0c5a4cedbdf8789cfd'
depmod -a  `uname -r`
pi@raspberrypi:~/v4l2loopback $ find /lib/ -name v4l2loopback.ko 2>/dev/zero
/lib/modules/4.4.50+/extra/v4l2loopback.ko
/lib/modules/4.4.50/extra/v4l2loopback.ko  //BAD

//vorher nicht vergessen
$ sudo modprobe videodev

pi@raspberrypi:~/v4l2loopback $ sudo insmod /lib/modules/4.4.50+/extra/v4l2loopback.ko video_nr=0,1,2,3
pi@raspberrypi:~/v4l2loopback $ lsmod
Module                  Size  Used by
v4l2loopback           26994  0
configs                32580  0
videodev              172779  1 v4l2loopback
media                  16312  1 videodev
bnep                   11853  2
hci_uart               21122  1
btbcm                   7885  1 hci_uart
bluetooth             365780  22 bnep,btbcm,hci_uart
brcmfmac              201842  0
brcmutil                9031  1 brcmfmac
snd_bcm2835            23131  0
snd_pcm                95473  1 snd_bcm2835
snd_timer              22556  1 snd_pcm
cfg80211              500739  1 brcmfmac
snd                    68400  3 snd_bcm2835,snd_timer,snd_pcm
rfkill                 21397  4 cfg80211,bluetooth
bcm2835_gpiomem         3759  0
bcm2835_wdt             4133  0
uio_pdrv_genirq         3718  0
uio                    10230  1 uio_pdrv_genirq
ipv6                  367697  24

Offline Niels2

  • Newbie
  • Posts: 7
  • Country: de
Re: Question about FLIR One for Android
« Reply #346 on: April 14, 2017, 10:06:01 pm »
Thanks for the help tomas123

I tried it one more time, but Guvcview is still not working. It isn`t really a problem for me, as long as the stream is running...

Here are my check for the right kernel (hope this is the right way to check it):

Code: [Select]
pi@raspberrypi:/ $ uname -a
Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux

pi@raspberrypi:/ $ ls -al /lib/modules/$(uname -r)/build
lrwxrwxrwx 1 root root 14 Apr 13 19:12 /lib/modules/4.4.50-v7+/build -> /home/pi/linux
Then I did this
Code: [Select]

pi@raspberrypi:/ $ sudo modprobe videodev

pi@raspberrypi:/ $ cd /home/pi/v4l2loopback

pi@raspberrypi:~/v4l2loopback $ sudo insmod /lib/modules/4.4.50-v7+/extra/v4l2loopback.ko video_nr=0,1,2,3

pi@raspberrypi:~/v4l2loopback $ lsmod
Module                  Size  Used by
v4l2loopback           23431  0
videodev              132913  1 v4l2loopback
media                  11573  1 videodev
binfmt_misc             6388  1
bnep                   10340  2
hci_uart               17943  1
btbcm                   5929  1 hci_uart
bluetooth             326105  22 bnep,btbcm,hci_uart
brcmfmac              186403  0
brcmutil                5661  1 brcmfmac
evdev                  11396  2
cfg80211              428871  1 brcmfmac
rfkill                 16037  4 cfg80211,bluetooth
snd_bcm2835            20447  1
snd_pcm                75762  1 snd_bcm2835
snd_timer              19288  1 snd_pcm
snd                    51908  5 snd_bcm2835,snd_timer,snd_pcm
bcm2835_gpiomem         2976  0
bcm2835_wdt             3225  0
uio_pdrv_genirq         3164  0
uio                     8000  1 uio_pdrv_genirq
i2c_dev                 5859  0
fuse                   84037  3
ipv6                  347620  66

And this was the result:

Code: [Select]
pi@raspberrypi:/ $ sudo guvcview
GUVCVIEW: couldn't open /root/.config/guvcview2/video0 for read: No such file or directory
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video0
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video1
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video2
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L2 interface for /dev/video3
libv4l2: error getting pixformat: Invalid argument
V4L2_CORE: ERROR opening V4L interface: Invalid argument
Unable to init server: Could not connect: Connection refused
GUVCVIEW: (GUI) Gtk3 can't open display
Guvcview error: no video device found
Maybe I`ll try to fix it later...

Today I tried to work out an automatised start for the "flir8k" driver and used this:
Code: [Select]
pi@raspberrypi:/ $ sudo /home/pi/Downloads/flir8k/flir8k
this worked fine, but then I tried to start the start1.sh file the same way:
Code: [Select]
pi@raspberrypi:/ $ sudo /home/pi/mjpg-streamer/mjpg-streamer/start1.sh
cat: ./start1.sh: No such file or directory
/home/pi/mjpg-streamer/mjpg-streamer/start1.sh: 3: /home/pi/mjpg-streamer/mjpg-streamer/start1.sh: ./mjpg_streamer: not found
/home/pi/mjpg-streamer/mjpg-streamer/start1.sh: 4: /home/pi/mjpg-streamer/mjpg-streamer/start1.sh: ./mjpg_streamer: not found

That didn`t work.

I can only start the stream by entering the folder of the "mjpg-streamer like this:

Code: [Select]
pi@raspberrypi:~/mjpg-streamer/mjpg-streamer $ cd /
pi@raspberrypi:/ $ cd /home/pi/mjpg-streamer/mjpg-streamer/
pi@raspberrypi:~/mjpg-streamer/mjpg-streamer $ sudo ./start1.sh
cat ./start1.sh
export LD_LIBRARY_PATH=./
./mjpg_streamer -i "input_file.so -f /mnt/RAMDisk/ -n thermal.jpg" -o "output_http.so -p 8080 -w /usr/local/www" &
./mjpg_streamer -i "input_file.so -d 0 -f /mnt/RAMDisk/ -n real.jpg"    -o "output_http.so -p 8081 -w /usr/local/www"
MJPG Streamer Version: svn rev: 3:172
 i: folder to watch...: /mnt/RAMDisk/
 i: forced delay......: 0
 i: delete file.......: no, do not delete
 i: filename must be..: real.jpg
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8081
 o: username:password.: disabled
 o: commands..........: enabled
MJPG Streamer Version: svn rev: 3:172
 i: folder to watch...: /mnt/RAMDisk/
 i: forced delay......: 0
 i: delete file.......: no, do not delete
 i: filename must be..: thermal.jpg
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled


...but couldn`t find a way to autostart it that way...  :palm:

btw. this is how my "start1.sh" file looks like:

Code: [Select]
cat ./start1.sh
export LD_LIBRARY_PATH=./
./mjpg_streamer -i "input_file.so -f /mnt/RAMDisk/ -n thermal.jpg" -o "output_http.so -p 8080 -w /usr/local/www" &
./mjpg_streamer -i "input_file.so -d 0 -f /mnt/RAMDisk/ -n real.jpg"    -o "output_http.so -p 8081 -w /usr/local/www"
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #347 on: April 15, 2017, 03:25:46 pm »
Quote
Code: [Select]
./mjpg_streamer: not foundThat didn`t work.
I can only start the stream by entering the folder of the "mjpg-streamer"
 

I see, you need some Linux beginner tutorials  ;)
I good german source for free books is:
http://openbook.rheinwerk-verlag.de/shell_programmierung/index.htm
http://openbook.rheinwerk-verlag.de/linux/

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #348 on: May 01, 2017, 11:03:00 am »
My RAW-file analizer.

 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #349 on: May 03, 2017, 04:34:18 am »
Updated version for Windows XP. :) (For Windows the most stable work)

This looks awesome! Thanks for making this. However, it has 3 problems.
1) It doesn't come with a driver installer (or text file explaining how to install), only the driver files, so I don't know exactly how to install it.
2) It is a driver designed only for XP, which doesn't work on newer versions of Windows, including Windows 10. My current PC has Windows 10, and I don't want to downgrade it to XP.
3) The software itself is not written in English, and is not written for an English locale, so all the text on user interface is just a bunch of question marks.

Here's 3 solutions.
1) Create a setup.exe to make sure that it can be installed properly, or at least include a text file with instructions on how to install the driver.
2) In addition to the XP driver (don't get rid of it, as some people still use XP), use a newer driver SDK to create a Windows 7 driver, and also a Windows 10 driver.
3) Create a separate English language file that I can load, so that all the strings in the program are in English, so that the text actually displays properly on computer's who's locale is set to United States, and so that people who only know English (like myself) can read it.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #350 on: May 03, 2017, 08:00:04 am »
@Ben321
da-nie wrote a special driver for the Flir One, which writes proprietary RAW files.
Your problem ist not the russian language the viewer software, rather the connecting of a Flir One with your PC and getting the raw files ;-)
Please read the previous posts of da-nie for more informations

@da-nie
thanks for sharing your work :-+
Some years ago I wrote a php script, which can transform your RAW images in Flir Radiometric JPG files (for Flir Tools etc.):
https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/msg348715/#msg348715

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #351 on: May 03, 2017, 09:22:55 am »
Quote
1) It doesn't come with a driver installer (or text file explaining how to install), only the driver files, so I don't know exactly how to install it.

I don't know, how to do it install.exe for drivers...  :-\

Quote
2) It is a driver designed only for XP, which doesn't work on newer versions of Windows, including Windows 10. My current PC has Windows 10, and I don't want to downgrade it to XP.

Sorry, but Windows XP is single Operation System with i can create drivers. In Windows 7 (In Windows 10,i think, also) Flir One Gen 2 not separate for 3 device - drivers not find.

Quote
3) The software itself is not written in English, and is not written for an English locale, so all the text on user interface is just a bunch of question marks.

No problem.  8) I created version for english language.

P.S. My RAW-format:

Code: [Select]
//RAW-Header
struct SHeader
 {
  unsigned long Width;
  unsigned long Height;
  double PlanckR1;
  double PlanckB;
  double PlanckF;
  double PlanckO;
  double PlanckR2;
  double TempReflected;
  double Emissivity;
};
//RAW-DATA
unsigned short RAW14[160*120];


« Last Edit: May 03, 2017, 09:32:31 am by da-nie »
 

Offline Vipitis

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: de
  • aspiring thermal photography enthusiast
Re: Question about FLIR One for Android
« Reply #352 on: May 07, 2017, 01:40:10 am »
I wanted to know if the custom tools for four one also work for the cat S60, because it is the same module
 

Offline ruzze

  • Newbie
  • Posts: 3
  • Country: it
Re: Question about FLIR One for Android
« Reply #353 on: June 24, 2017, 04:10:56 pm »
Hi everyone,

first of all thanks for this beautiful thread about flir one software teardown!
For my personal project i needed to disable automatic FFC (shutter) and do FFC only a couple of times a day. I tried to reverse enginnering the command packet and the string for disable automatic FFC through flirone android sdk, but i  encountered some troubles and i tried to sniff the packet using USBMON with wireshark plugin. Now i can disableAutomaticFFC and do FFC calibration when i want  :)

In order to send a command you need to send a command packet and subsequently a string packet (JSON format).

For disable automatic shuttering FFC you must send
- command packet : CC 01 00 00 01 00 00 00 3F 00 00 00 57 64 17 8b;
- string packet: {"type":"setOption","data":{"option":"autoFFC","value":false}}

If you want to do a FFC calibration you must send:
- command packet: CC 01 00 00 01 00 00 00 3C 00 00 00 B9 CB A2 99
- string packet: {"type":"setOption","data":{"option":"doFFC","value":true}}

I hope this will be useful to someone :)

 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #354 on: June 24, 2017, 05:10:21 pm »
Thank you!  :-+
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #355 on: June 25, 2017, 01:24:03 pm »
@ruzze
Thank you for clarification.  :-+
I posted the corresponding code snippets some times ago, but this thread is a bit confusing.

Please post your enhanced code here. The original code was a proof of concept and we need some improvements.
Thank you
 


and here the tune command "doFFC" (Flat-field correction)
{"type":"setOption","data":{"option":"doFFC","value":true}}
Code: [Select]
data = {byte[16]@21106}
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 = 60 (0x3C)
9 = 0 (0x0)
10 = 0 (0x0)
11 = 0 (0x0)
12 = -71 (0xB9)
13 = -53 (0xCB)
14 = -94 (0xA2)
15 = -103 (0x99)
protocolType = {UsbCommunicator$ProtocolType@20957} "CONFIGURATION"

{"type":"setOption","data":{"option":"doFFC","value":true}}
data = {byte[60]@21045}
0 = 123 (0x7B)
1 = 34 (0x22)
2 = 116 (0x74)
3 = 121 (0x79)
4 = 112 (0x70)
5 = 101 (0x65)
6 = 34 (0x22)
7 = 58 (0x3A)
8 = 34 (0x22)
9 = 115 (0x73)
10 = 101 (0x65)
11 = 116 (0x74)
12 = 79 (0x4F)
13 = 112 (0x70)
14 = 116 (0x74)
15 = 105 (0x69)
16 = 111 (0x6F)
17 = 110 (0x6E)
18 = 34 (0x22)
19 = 44 (0x2C)
20 = 34 (0x22)
21 = 100 (0x64)
22 = 97 (0x61)
23 = 116 (0x74)
24 = 97 (0x61)
25 = 34 (0x22)
26 = 58 (0x3A)
27 = 123 (0x7B)
28 = 34 (0x22)
29 = 111 (0x6F)
30 = 112 (0x70)
31 = 116 (0x74)
32 = 105 (0x69)
33 = 111 (0x6F)
34 = 110 (0x6E)
35 = 34 (0x22)
36 = 58 (0x3A)
37 = 34 (0x22)
38 = 100 (0x64)
39 = 111 (0x6F)
40 = 70 (0x46)
41 = 70 (0x46)
42 = 67 (0x43)
43 = 34 (0x22)
44 = 44 (0x2C)
45 = 34 (0x22)
46 = 118 (0x76)
47 = 97 (0x61)
48 = 108 (0x6C)
49 = 117 (0x75)
50 = 101 (0x65)
51 = 34 (0x22)
52 = 58 (0x3A)
53 = 116 (0x74)
54 = 114 (0x72)
55 = 117 (0x75)
56 = 101 (0x65)
57 = 125 (0x7D)
58 = 125 (0x7D)
59 = 0 (0x0)
protocolType = {UsbCommunicator$ProtocolType@20949} "CONFIGURATION"


Code: [Select]
            //--------- write string: {"type":"setOption","data":{"option":"autoFFC","value":false}}
            length = 16;
            unsigned char my_string4[16]={0xcc,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x57,0x64,0x17,0x8b};
            printf("\nEP 0x02 to be sent Hexcode: %i Bytes[",length);
            for (i = 0; i < length; i++) {
                printf(" %02x", my_string4[i]);

            }
            printf(" ]\n");

            r = libusb_bulk_transfer(devh, 2, my_string4, length, &transferred, 0);
            if(r == 0 && transferred == length)
            {
                printf("\nWrite successful!");
            }
            else
                printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

            strcpy(  my_string,"{\"type\":\"setOption\",\"data\":{\"option\":\"autoFFC\",\"value\":false}}");
            length = strlen(my_string)+1;
            printf("\nEP 0x02 to be sent %i Bytes: %s", length, my_string);

            // avoid error: invalid conversion from ‘char*’ to ‘unsigned char*’ [-fpermissive]
            my_string1 = (unsigned char*)my_string;

            r = libusb_bulk_transfer(devh, 2, my_string1, length, &transferred, 0);
            if(r == 0 && transferred == length)
            {
                printf("\nWrite successful!");
                printf("\nSent %d bytes with string: %s\n", transferred, my_string);
            }
            else
                printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

Offline ruzze

  • Newbie
  • Posts: 3
  • Country: it
Re: Question about FLIR One for Android
« Reply #356 on: June 26, 2017, 12:15:22 pm »
@tomas123

I am pleased to hear your gratitude.

This is my implementation of two functionalities..

Code: [Select]
void disableAutomaticFFC()
{
    printf("\ndisable AutomaticFFC \n");
    time_t now = time(0); // Get the system time
    printf("\n: %s", ctime(&now));

    int transferred = 0;
    int r;
    char stringCommand[128];

    //--------- write string: {"type":"openFile","data":{"mode":"r","path":"CameraFiles.zip"}}
    int startCommandLength = 16;
    unsigned char startCommand[16] = {0xcc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x57, 0x64, 0x17, 0x8b};
    printf("\nEP 0x02 to be sent Hexcode: %i Bytes[", startCommandLength);
    int j;
    for (j = 0; j < startCommandLength; j++)
    {
        printf(" %02x", startCommand[j]);
    }
    printf(" ]\n");

    r = libusb_bulk_transfer(devh, 2, startCommand, startCommandLength, &transferred, 0);
    if (r == 0 && transferred == startCommandLength)
    {
        printf("\nWrite successful!");
    }
    else
    {
        printf("\nError in write! res = %d and transferred = %d\n", r, transferred);
    }

    strcpy(stringCommand, "{\"type\":\"setOption\",\"data\":{\"option\":\"autoFFC\",\"value\":false}}");

    startCommandLength = strlen(stringCommand) + 1;
    printf("\nEP 0x02 to be sent: %s", stringCommand);

    // avoid error: invalid conversion from ‘char*’ to ‘unsigned char*’ [-fpermissive]
    unsigned char *stringCommandUns = (unsigned char *)stringCommand;
    //my_string1 = (unsigned char*)my_string;

    r = libusb_bulk_transfer(devh, 2, stringCommand, startCommandLength, &transferred, 0);
    if (r == 0 && transferred == startCommandLength)
    {
        printf("\nWrite successful!");
        printf("\nSent %d bytes with string: %s\n", transferred, stringCommandUns);
    }
    else
    {
        printf("\nError in write! res = %d and transferred = %d\n", r, transferred);
    }
}

void doFFC()
{
    printf("\n doFFC \n");
    time_t now = time(0); // Get the system time
    printf("\n: %s", ctime(&now));

    int transferred = 0;
    int r;
    char stringCommand[128];

    int startCommandLength = 16;
    unsigned char startCommand[16] = {0xcc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0xB9, 0xCB, 0xA2, 0x99};
    printf("\nEP 0x02 to be sent Hexcode: %i Bytes[", startCommandLength);
    int j;
    for (j = 0; j < startCommandLength; j++)
    {
        printf(" %02x", startCommand[j]);
    }
    printf(" ]\n");

    r = libusb_bulk_transfer(devh, 2, startCommand, startCommandLength, &transferred, 0);
    if (r == 0 && transferred == startCommandLength)
    {
        printf("\nWrite successful!");
    }
    else
        printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

    strcpy(stringCommand, "{\"type\":\"setOption\",\"data\":{\"option\":\"doFFC\",\"value\":true}}");

    startCommandLength = strlen(stringCommand) + 1;
    printf("\nEP 0x02 to be sent: %s", stringCommand);

    // avoid error: invalid conversion from ‘char*’ to ‘unsigned char*’ [-fpermissive]
    unsigned char *stringCommandUns = (unsigned char *)stringCommand;
    //my_string1 = (unsigned char*)my_string;

    r = libusb_bulk_transfer(devh, 2, stringCommandUns, startCommandLength, &transferred, 0);
    if (r == 0 && transferred == startCommandLength)
    {
        printf("\nWrite successful!");
        printf("\nSent %d bytes with string: %s\n", transferred, stringCommandUns);
    }
    else
    {
        printf("\nError in write! res = %d and transferred = %d\n", r, transferred);
    }
}

Now you can call this functions wherever you want in your state machine.

If someone else need to discover other functionalities of flirone i can try to help you in my spare time. I owe so much to this thread :)
 

Offline MDC

  • Newbie
  • Posts: 3
  • Country: us
Re: Question about FLIR One for Android
« Reply #357 on: August 05, 2017, 07:02:31 am »
@da-nie

I am having trouble getting a thermal image on my PC using FlirOneControl. I am attempting to install the FLIR One for Android on an Acer Aspire One ZG5 Netbook which is running Windows XP SP3. After inserting the FLIR One device in a USB port, each of the 3 drivers required a file WdfCoInstaller01009.dll (link supplied by tomas123; I assume for x86), which I had to place in the "Driver for FLIR One Gen 2 for XP" folder. In Device Manager, under "FlirOne Gen 2 FileIO", there are 3 devices listed and another under "Universal Serial Bus controllers" called "USB Composite Device". In the "Image" folder, I am getting .tga files, but they are blank, because the screen is blank. The FLIR One when fully charged is supposed to run for 30 minutes. When I first turn it on, the power button turns orange, then red, then blinks green, which indicates that it is ready. I have attached an image of the Device Manager and an image of the English version of FlirOneControl. I would appreciate your help.
« Last Edit: August 05, 2017, 07:26:15 am by MDC »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #358 on: August 06, 2017, 07:10:39 am »
Hm... Images are not collected - data image is lost.
Version of the program with saving all data from the Flir One.
If data is received, a file is "flir_data.txt" created.

 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #359 on: August 06, 2017, 07:20:36 am »
Now I connected it to the computer on the front of the system unit - there is also no image. I connected it from the back of the system unit - the image appeared. Try different USB connectors. Try to turn on the program, and then Flir One. Or vice versa. Try another cable (maybe your cable is low-frequency).
 

Offline MDC

  • Newbie
  • Posts: 3
  • Country: us
Re: Question about FLIR One for Android
« Reply #360 on: August 06, 2017, 09:27:13 am »
@ Da-nie

Thanks for your timely response. I tried all 3 USB ports, turning on the FlirOneControl program before and after starting FLIR One (still no image displayed). I only have one cable, so I can't test another (the length is only 5 inches long; I assume the quality is good). I ran your test program "FlirOneControl-english (test).zip" which produced the "flir_data.txt" file attached (I only ran FLIR One for about 1 second to keep the data file under 1MB, because the file grew very quickly). Hopefully you can find a problem in this data file.
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #361 on: August 06, 2017, 03:23:05 pm »
CRC in line error.  Hm...
Here is the program without CRC and your image in .txt file (in file 8 images).

By the way, try to change in the BIOS USB 1.0 or USB 2.0 Legacy.

Code: [Select]
00 50 - header
df 5a - crc=5adf

Data line:
fb 1f fc 1f
02 20 fa 1f 05 20 09 20 ff 1f 00 20 04 20 fe 1f
0e 20 06 20 0a 20 07 20 0b 20 16 20 11 20 08 20
08 20 04 20 08 20 09 20 0d 20 0b 20 0a 20 00 20
06 20 02 20 04 20 08 20 10 20 08 20 0d 20 09 20
07 20 0b 20 14 20 09 20 0c 20 09 20 08 20 0b 20
11 20 0f 20 10 20 ff 1f 0c 20 08 20 0a 20 0e 20
04 20 11 20 03 20 0e 20 ff 1f 0b 20 09 20 02 20
0f 20 06 20 0b 20 02 20 0e 20 0c 20 05 20 05 20
03 20 07 20 05 20 06 20 0c 20 08 20 12 20 0d 20
11 20 13 20 16 20 13 20 12 20 16 20

CRC=f583 (header=0x00 0x00 and CRC in package=0x00 0x00 - in Lepton 3 manual page 39).
Quote
The CRC is calculated over the entire packet, including the ID and CRC fields. However, the four most-significant bits of the ID and all sixteen bits of the CRC are set to zero for calculation of the CRC. There is no requirement for the host to verify the CRC. However, if the host does find a CRC mismatch, it is recommended to re-synchronize the VoSPI stream to prevent potential misalignment.

Code: [Select]
unsigned char byte_array[164]=
{
 0x00,0x00,//header (with mask 0x0FFF)
 0x00,0x00,//CRC in package =0
 0xfb,0x1f,0xfc,0x1f,0x02,0x20,0xfa,0x1f,0x05,0x20,0x09,0x20,0xff,0x1f,0x00,0x20,
 0x04,0x20,0xfe,0x1f,0x0e,0x20,0x06,0x20,0x0a,0x20,0x07,0x20,0x0b,0x20,0x16,0x20,
 0x11,0x20,0x08,0x20,0x08,0x20,0x04,0x20,0x08,0x20,0x09,0x20,0x0d,0x20,0x0b,0x20,
 0x0a,0x20,0x00,0x20,0x06,0x20,0x02,0x20,0x04,0x20,0x08,0x20,0x10,0x20,0x08,0x20,
 0x0d,0x20,0x09,0x20,0x07,0x20,0x0b,0x20,0x14,0x20,0x09,0x20,0x0c,0x20,0x09,0x20,
 0x08,0x20,0x0b,0x20,0x11,0x20,0x0f,0x20,0x10,0x20,0xff,0x1f,0x0c,0x20,0x08,0x20,
 0x0a,0x20,0x0e,0x20,0x04,0x20,0x11,0x20,0x03,0x20,0x0e,0x20,0xff,0x1f,0x0b,0x20,
 0x09,0x20,0x02,0x20,0x0f,0x20,0x06,0x20,0x0b,0x20,0x02,0x20,0x0e,0x20,0x0c,0x20,
 0x05,0x20,0x05,0x20,0x03,0x20,0x07,0x20,0x05,0x20,0x06,0x20,0x0c,0x20,0x08,0x20,
 0x12,0x20,0x0d,0x20,0x11,0x20,0x13,0x20,0x16,0x20,0x13,0x20,0x12,0x20,0x16,0x20
};

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevstance,LPSTR lpstrCmdLine,int nCmdShow)
{
 unsigned short crc=0x0000;
 unsigned short *ptr=reinterpret_cast<unsigned short*>(byte_array);
 for(long m=0;m<164/2;m++)
 {
  unsigned short word=ptr[m];
  crc^=word;
  for(unsigned char n=0;n<16;n++)
  {
   if (crc&0x8000) crc=(crc<<1)^0x1021;
              else crc<<=1;
  }
 }
 char str[255];
 sprintf(str,"CRC:%04x",crc);
 MessageBox(NULL,str,"Ok",MB_OK);
 return(0);
}


Why your Flir One CRC=f583 and CRC in package=5adf - i don't know.  |O Lepton error?  :-//
My Flir One CRC is equivalent.  ::)
« Last Edit: August 06, 2017, 06:33:12 pm by da-nie »
 

Offline MDC

  • Newbie
  • Posts: 3
  • Country: us
Re: Question about FLIR One for Android
« Reply #362 on: August 06, 2017, 08:18:29 pm »
@Da-nie

There is no option in BIOS to change the USB version. However, I tried your program "FlirOneControl-english-no_crc.zip", and it works. Excellent job! Thanks for your help. If you need anymore testing, just let me know.
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #363 on: August 06, 2017, 08:21:18 pm »
Great!  :-+
Unknow error CRC...  :-//
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #364 on: August 13, 2017, 08:38:09 am »
My scanning of Hause.

« Last Edit: August 13, 2017, 08:58:38 am by da-nie »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #365 on: September 02, 2017, 07:47:18 pm »
I create device with STM32F4Discovery board (this board have USB-HOST). Flir One Gen 2 connected with USB. I created project for CubeMX with STM32F407VGT. Flir One connects, reports parameters, completes enumeration, opens pipes, but does not transmit data. Commands for stopping and starting interfaces are not executed. |O

I attached main.c file. Maybe someone will tell me what I did wrong. :-//  Thank you.





 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #366 on: September 03, 2017, 09:51:05 am »
Hm. Flir One FFC control with programm for STM32F4. But no data with restart interface...

--------------------------------------------------------------------
I am surprised. I read descriptor of interface. bAlternateSetting=1 means that the interface does not have end points! The  bAlternateSetting=0 means that there are endpoints.

SetConfiguration( bInterfaceNumber=1, bAlternateSetting=0) - EP=0x83, 0x04;
SetConfiguration( bInterfaceNumber=1, bAlternateSetting=1) - No EP!!!

SetConfiguration( bInterfaceNumber=2, bAlternateSetting=0) - EP=0x85, 0x06;
SetConfiguration( bInterfaceNumber=2, bAlternateSetting=1) - No EP!!!

But initialize Flir One is:
1) SetConfiguration( bInterfaceNumber=1, bAlternateSetting=0)
2) SetConfiguration( bInterfaceNumber=2, bAlternateSetting=0)
3) SetConfiguration( bInterfaceNumber=2, bAlternateSetting=1) - No EP.
4) SetConfiguration( bInterfaceNumber=1, bAlternateSetting=1) - No EP.

How can this be?  :-//

In Linux

Quote
Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    240
      bInterfaceProtocol      1
      iInterface              6 com.flir.rosebud.fileio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        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     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1

In STM32F wMaxPacketSize=64.  :-//

And:

Quote
Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    240
      bInterfaceProtocol      1
      iInterface              6 com.flir.rosebud.fileio

    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    240
      bInterfaceProtocol      1
      iInterface              6 com.flir.rosebud.fileio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        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     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
« Last Edit: September 04, 2017, 04:39:39 pm by da-nie »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #367 on: September 04, 2017, 06:01:30 pm »
tomas123, please tell me how you intercepted the USB excange?
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #368 on: September 04, 2017, 08:09:33 pm »
Da-nie, currently I don't work with Flir One and Raspberry Pi. All steps for the usb handshakes are documented in our c code. This are the exact replays of the original Flir One App communication. 
Look there...
« Last Edit: September 04, 2017, 08:13:17 pm by tomas123 »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #369 on: September 05, 2017, 07:14:54 am »
The device startup sequence is known. I'm curious, how did you intercept the exchange via USB? I want to see what STM32F4 is requesting and what Flir One is responsible for.
---------------------------------------------------------------
Updated.

I change in function OpenPipe 512 ?? 64 byte. I receive data!!!
« Last Edit: September 05, 2017, 06:26:09 pm by da-nie »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #370 on: September 06, 2017, 11:35:00 am »
The usb communication is tricky, because there are some influences of the chipset.
So far, I have not understood the logic behind the usb block length of my rapsberry pi.
I'm glad about all the incoming data and build the data together.
After all there are frequently drops inside the steam (we get a broken frame)

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #371 on: September 06, 2017, 05:57:10 pm »
Size of block i know: :)
1) Full Speed and Low Speed = 64 bytes ma.
2) High Speed = 512 bytes max.

My STM32F4 is Full Speed. => 64 bytes. :(
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #372 on: September 07, 2017, 06:21:48 am »
yes, this is the buffer size of the "hardware" buffer

While a bulk read from endpoint you get larger packets from the "usb driver" buffer.
I wrote about the packet size from driver buffer...

Offline kerio

  • Newbie
  • Posts: 2
  • Country: it
Re: Question about FLIR One for Android
« Reply #373 on: October 11, 2017, 08:32:24 am »
Hi, has anyone figured out the exact details on how the MSX algorithm works, at least regarding the coordinate transform between the visible and the thermal? I'm trying to figure out how to go from visible to thermal, and the extracted calib.rsc has a whole bunch of parameters, none of which seems to work fine as a simple scaling factor.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #374 on: October 11, 2017, 07:39:01 pm »
Look at my footer.
There is a php script with two samples for MSX with Imagemagick

Offline kerio

  • Newbie
  • Posts: 2
  • Country: it
Re: Question about FLIR One for Android
« Reply #375 on: October 12, 2017, 05:06:26 am »
AIUI your script relies on the "raw" thermal data from radiometric jpegs saved with the flir app, is that correct?
That raw data is already preprocessed in some way that does alter the geometry of the image, as far as i can tell; which is likely the reason for the 320x240 resolution.
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #376 on: October 12, 2017, 07:37:19 am »
yes, its a workflow for the Flir radiometric jpgs

The true sensor raw is useless signal for you.

The microbolometer generates some noise and drifts, which are filtered with the flat-field correction (FFC):
Pixel Noise
Row Noise
Column Noise
Uniformity

The next step is the bad pixel mapping.

After then the Flir firmware converts (in radiometry mode) this post processed signal to a value which is linear to radiance [W / m^2 (per nm)].
This computational result is the so-called 14 Bit Raw signal (like ThermalLinearFlux14BitImage)


Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #377 on: October 13, 2017, 04:13:23 pm »
New version programm for Flir One Control (without drivers in this archive). Added Video! :)
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #378 on: October 15, 2017, 10:06:42 am »
 
The following users thanked this post: sheepsheep

Offline G0MJW

  • Regular Contributor
  • *
  • Posts: 51
  • Country: gb
  • Mike
    • G0MJW
Re: Question about FLIR One for Android
« Reply #379 on: October 15, 2017, 04:36:13 pm »
GitHub repository:

Flir One Drivers: https://github.com/da-nie/FlirOneDrivers
Flir One Control: https://github.com/da-nie/FlirOneControl
Flir One Raw Analizer: https://github.com/da-nie/FlirOneRAWAnalizer

This looks rather interesting as there are Windows 7 drivers. Maybe they will work with Windows 10? How are they installed?

Mike
Mike
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #380 on: October 15, 2017, 06:15:33 pm »
No! Windows 7 Drivers can not be installed! These drivers are compiled for Windows 7, but they can not be installed. Only XP...
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #381 on: October 15, 2017, 06:46:53 pm »
Flir One Gen 2 and STM32F4Discovery. :)

https://github.com/da-nie/nightvision

Display 320x240 with HX8347D controller.
Connect:
D0-D7 - PE4-PE11
CS - PE12
RD - PE13
RW - PE14
RS - PE15
RST - PE2

Project from Keil 5 with Cube MX. If 3 second not image then microcontroller is restart.

STM32F4 and Flir One Gen 2
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #382 on: October 27, 2017, 04:24:54 pm »
Please i need desperately your expert help.
As i didn't manage to work my F1G2 android device, i decided to teardown and check some things.
When i connect the device with micro usb-to usb and then to old WIN XP PC, founds a new hardware.
I tried to install the xp drivers made by Da-Nie but it doesn't work. The device remains with yellow exclamation mark.
Then i supposed that the medium black chip might need re flowing. I did that but no luck again.
I 'm ready to re-flow the big Atmel chip also. But before doing this, i ask you help and advice from experts.
The device power on and after some orange red light, the green light flashes but my samsung A5 android cannot recognize it.
The shutter on off and on again.
Any help will be appreciated.
TIA
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #383 on: October 27, 2017, 05:42:29 pm »
Quote
founds a new hardware.

Found three device?

Quote
The device remains with yellow exclamation mark.

All three devices?

Quote
The device power on and after some orange red light, the green light flashes but my samsung A5 android cannot recognize it.

This is correct.
Quote
Then i supposed that the medium black chip might need re flowing. I did that but no luck again.

medium black chip???  :-//
« Last Edit: October 27, 2017, 05:44:05 pm by da-nie »
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #384 on: October 27, 2017, 06:40:58 pm »
Dear Da-Nie

thank you for reply.
Please let me explain with photo's:
The chip i did reflow is the big square one

Win XP founds only ONE UKNOWN device.
This is the Atmel chip side.

This is the Lepton module from device.

I don't know what chip envolves with the Lepton module though.
TIA
« Last Edit: October 27, 2017, 06:49:17 pm by misterno »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #385 on: October 27, 2017, 06:55:56 pm »
Quote
don't know what chip envolves with the Lepton module though.

i.e? This is lepton.

 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #386 on: October 27, 2017, 07:04:02 pm »
Quote
don't know what chip envolves with the Lepton module though.

i.e? This is lepton.



Yes, this is lepton camera module. I was wondering how this module involves with the other chips like the Atmel. In the worst case, i will take this module and try to do another interface with it.
Or i can buy a lepton breakout board and use it. My question is how to test if this module is ok or not? Is it a good idea try to reflow the Atmel chip or it has no interference with the camera module?
TIA
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #387 on: October 27, 2017, 07:44:08 pm »
I have yet to see a LEPTON failure through natural means rather than abuse.

Take care if considering a reflow on the micro. It is supported with epoxy and this prevents the IC free floating on the liquid solder balls. Cracked solder balls could actually separate leaving a gap between the IC and PCB pads. You really should remove the securing epoxy and the IC, before re-balling and re-fitting. You could try a simpler approach though.

Fraser

If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #388 on: October 27, 2017, 08:01:28 pm »
I have yet to see a LEPTON failure through natural means rather than abuse.

Take care if considering a reflow on the micro. It is supported with epoxy and this prevents the IC free floating on the liquid solder balls. Cracked solder balls could actually separate leaving a gap between the IC and PCB pads. You really should remove the securing epoxy and the IC, before re-balling and re-fitting. You could try a simpler approach though.

Fraser
Yes i noticed that. I put hot air at 180 degrees and melt carefully the epoxy. My question though is:
If i manage to reflow the Atmel with no harm, will it be the cause of the fault? What does it doing?
TIA
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #389 on: October 29, 2017, 07:31:11 pm »
Today i just finished the reballing of the chip and tomorrow i will try to put it in his place.
I also did write down the test points connections with the chip and i will post them for reference here.
 
 

Offline fnoop

  • Newbie
  • Posts: 3
  • Country: gb
Re: Question about FLIR One for Android
« Reply #390 on: November 11, 2017, 07:49:53 am »
Hi, I haven't tried this on earlier versions of Raspbian based on debian jessie, but the latest version based on debian stretch is really simple to install working v4l2loopback:

sudo apt install raspberrypi-kernel-headers libusb-1.0-0-dev dkms v4l2loopback-utils v4l2loopback-dkms
sudo modprobe v4l2loopback video_nr=0,1,2,3

If it's OK, as per previous replies a way back, I'll create a git repo with the contents of flir8p1-gpl.tar (unless someone has already done it that I missed?)
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #391 on: November 11, 2017, 08:35:17 am »
Today i just finished the reballing of the chip and tomorrow i will try to put it in his place.
I also did write down the test points connections with the chip and i will post them for reference here.
Hey. Did you manage to solder the chip? I have Flir One with the same problem. To begin with, I warmed up the atmel a little. The thermal imager worked a week. And again it does not work.
 

Offline fnoop

  • Newbie
  • Posts: 3
  • Country: gb
Re: Question about FLIR One for Android
« Reply #392 on: November 11, 2017, 08:55:34 am »
Is there any way of keeping the flir one awake, or waking it up through usb?  It has a very short timeout where it goes to sleep and then you have to physically press the button.  This is no good if it's mounted somewhere (outside of a house, drone, etc)
 

Offline fnoop

  • Newbie
  • Posts: 3
  • Country: gb
Re: Question about FLIR One for Android
« Reply #393 on: November 11, 2017, 12:45:04 pm »
Initial cleanup and commit to git repo here:
https://github.com/fnoop/flirone-v4l2
 

Offline sheepsheep

  • Newbie
  • Posts: 1
  • Country: 00
Re: Question about FLIR One for Android
« Reply #394 on: November 13, 2017, 09:33:04 am »
Question about the color palettes (*.raw files): How do you create a specific color palette? Is rainbow.raw a standardized file format? Where can I download more color palettes or how can I create more? Is a source code available?
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #395 on: November 13, 2017, 09:59:39 am »
Unfortunately the device is still in coma!
I 'll wait for new equipment and i will try one last time to "revive" it and the i 'll post the results here.
C ya!
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #396 on: November 13, 2017, 10:05:34 am »
Have you replaced the AT91SAM9X25-CU?
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #397 on: November 13, 2017, 10:27:02 am »
Have you replaced the AT91SAM9X25-CU?
No i didn't manage to do it yet. I 've already order some bga stuff to do the job more precisely.
 

Offline newex

  • Contributor
  • Posts: 23
  • Country: 00
Re: Question about FLIR One for Android
« Reply #398 on: November 16, 2017, 07:28:17 pm »
Have you replaced the AT91SAM9X25-CU?

I had the same trouble. Atmel chip reballing does not solve the problem.
In my case, the nand flash chip reballing helped. After this device works good.
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #399 on: November 16, 2017, 07:49:25 pm »
The nand flash chip - it 6HA98?
 

Offline newex

  • Contributor
  • Posts: 23
  • Country: 00
Re: Question about FLIR One for Android
« Reply #400 on: November 16, 2017, 07:55:17 pm »
Micron NAND Flash
This is NAND Flash and DDR in one chip.
« Last Edit: November 16, 2017, 08:03:00 pm by newex »
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #401 on: November 16, 2017, 08:20:39 pm »
In my case, after warming up Atmel, the thermal imager worked a week. Now it can only work a few minutes if you heat Atmel. It is glued with a compound and I can not remove it. The thermal imager does not respond to memory heating.
 

Offline newex

  • Contributor
  • Posts: 23
  • Country: 00
Re: Question about FLIR One for Android
« Reply #402 on: November 16, 2017, 08:35:37 pm »
Ok, try it. I have already passed this way.
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #403 on: November 29, 2017, 10:28:20 am »
Help is needed. I decoupled the AT91SAM26 and lost the resistor. Tell me please his resistance. It is connected to the pin F1 - TCLK4
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #404 on: November 29, 2017, 11:53:03 am »
It is a 10K Ohm resistor

Just measured it on one of my units.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #405 on: November 29, 2017, 11:57:04 am »
Thank you very much!
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #406 on: November 29, 2017, 11:58:43 am »
When applying heat in the area of that Atmel chip, do be conscious of the components on the other side of the PCB. Whilst an issue may appear to come from the large Atmel chip, heat is also warming the clock oscillator etc on the the other side. It is always worth checking these components before considering a reballing operation on the Atmel.

Clock oscillators do fail and sometimes respond to heat.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #407 on: November 29, 2017, 12:00:12 pm »
Uho,

No problem. I always have a FLIR One disassembled in case I need to check something on the PCB

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #408 on: November 29, 2017, 12:12:58 pm »
Clock oscillators do fail and sometimes respond to heat.

Fraser
I tried to heat Clock oscillators. There was no result.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #409 on: November 29, 2017, 12:27:51 pm »
It would be great if someone with the available time would reverse engineer the FLIR One G2, at least to the point of a block diagram showing all major components. It may help others to identify helpful test points and likely causes of faults.

With a non responsive FLIR One G2, it is always the power supply circuit that should be checked first as I have little confidence in this area of the design. As for the battery.....

I owned two FLIR One G2 units from new. One was lightly used and the other sat in its sealed box, untouched. Both sat unused for several months. A fellow forum member wanted to buy my sealed unit and I was concerned whether the battery was OK. As soon as I connected the USB power supply, the camera began to charge normally. After testing, the cameras run time was a healthy 60 minutes. I tested my other FLIR One G2 that I have used. It also charged easily and ran for 60 minutes .

I carried out a test on three faulty units that await my attention (no boot) All of them took some coaxing to start their charge cycle. A coincidence or sign that those units have a duff battery or charge controller ? Those units were fully charged only a couple of months ago yet the charge circuit saw the battery as below normal charge initiation point. Hmmmm, something is not right there.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline lambcutlet

  • Contributor
  • Posts: 13
  • Country: gb
Re: Question about FLIR One for Android
« Reply #410 on: December 27, 2017, 09:26:02 am »
hello,
its my first post here so please go easy. I'd been reading this forum on and off for about a month now and thought i would have a punt at buying a faulty Flir one gen2 from Ebay.
To help others I thought i would share info i have found so far, see attachment.
In my case connector J7 the 4pin connector to the USB board had been wedged up breaking a solder joint. Once resoldered it now connected to my phone. However the punter on Ebay I bought the Flir from must also be trying to repair these as he has torn the ribbon cable to the visible camera. So the Flir will connect to the phone I can check the firmware but their is no display. Thinking i had purchased rubbish I then obtained a v1.4 breakout board from digikey in the hope the Lepton3 was as people have mentioned in the forum, bullet-proof. I hooked it up to a raspberry-pi using this, pylepton (branch lepton3) https://github.com/groupgets/pylepton/tree/lepton3 and thankfully it worked.
Questions:
Can anyone identify the visible camera? I need a replacement
Does anyone else use the raspberry-pi with a breakout board and Lepton3? and what software do you use? (off topic sorry)

'Charging the battery' to help Frasers previous query. The USB input feeds a BQ24295 which charges the battery and shares power to the system via multiple step-down convertors (markings C1xx, SM33G & SM28G). The BQ24295 can be and is controlled in part by the processor having found the username and password in these forums I poked around and found '/etc/battery.cfg' a file which specifies numerous controlling parameters, such as 'BATT_CHARGING_TIMEOUT_S=14400'.
here's the contents
Code: [Select]
$ cat /etc/battery.cfg
# max verbosity 3
DEBUG_LEVEL=0

# polling interval in msec
POLL_PERIOD_MS=100

# number of polling intervals before writing first status
STATUS_UPDATE_STARTUP_WAIT=100

# number of polling intervals between writing status
STATUS_UPDATE_TICKS=10

# number of polling intervals between logging statistics (if enabled)
LOG_UPDATE_TICKS=100

# number of consecutive polling intervals switch reads low to shut down
SHUTDOWN_TICKS=10

# time to try charging again after charger signals thermal fault
FAULT_RECOVERY_TICKS=600

# maximum time for trying to charge own battery:
# if battery is still not full after attempting to charge this long,
# assume there is a hardware problem and go into fault state
BATT_CHARGING_TIMEOUT_S=14400

# grace period for power-down: really turn off if switch stays 'off' this long
# special value of '0' disables switch checking (useful for bare boards)
POWEROFF_DEBOUNCE_MS=2000

# number of voltage readings to average when calculating battery level
NUM_VBATT_READINGS=5

# weight for filter used to smooth battery level estimate
CHARGE_FILTER_WEIGHT=0.9835

# voltage offset when USB5V is connected
# (subtracted from voltage reading)
USB5V_VOLTAGE_OFFSET=0.04

# minimum voltage (in mV) allowed from charger
MINIMUM_INPUT_VOLTAGE_MV=4520

# whether to allow iphone charging when own battery is full
ENABLE_PHONE_CHARGING=1

# timeout for staying phone charge mode if own battery is less than full
# (avoids leaving battery partially full after charger chip stole stole
# charge to boost current to phone)
PHONE_CHARGING_TOPOFF_TIMEOUT_S=1800

# whether to force statistics logging on startup
AUTO_ENABLE_LOGGING=0

# location of logfile (if logging is enabled, via autostart or socket command)
LOGFILE_PATH=/var/log/battery_statistics.log

## app management when 5V is plugged/unplugged

# command to run just usb app for charge-only mode
START_CHARGE_ONLY_COMMAND=/etc/init.d/userapps charge-only

# command to start streaming when switch turns "on"
START_STREAMING_COMMAND=/etc/init.d/userapps start

#command for system shutdown
SHUTDOWN_COMMAND=sync && echo o > /proc/sysrq-trigger

# how long after startup should we wait for activity before sleeping
DEEP_SLEEP_TIMEOUT_S=120

# how long after disconnect should we wait before sleeping
POWER_SAVE_TIMEOUT_S=120

# how many ticks between checking for deep sleep or power save states
POWER_SAVE_CHECK_TICKS=25
So charging the battery is not a simple constant current constant voltage system it has smarts for added control and safety in the form of the BQ24295 in conjunction with the processor.

And to check 'battery voltage & status' issue this command 'cat /var/log/battery/status'



 
The following users thanked this post: Fraser, joe-c, kirill_ka

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #411 on: December 27, 2017, 09:48:14 am »
The lack of a video camera does not interfere with getting the battery charge status. Do you see the battery on the phone screen? Yes, without a camera there will not be a thermal image. I also did not find a camera with this kind of connector. I'm now looking for a memory chip.
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #412 on: December 27, 2017, 11:56:43 am »
Lambcutlet,

Very sorry to hear that someone had been inside your F1G2 before you. That is always a worry as you do not know what further damage has been done. The classic 'heat it with a paint stripper' to reflow the chips comes to mind  :scared:

Thank you very much for the detail on the charge management. The FLIR i series use similar.

I am not a software tech but would like to take a look around inside my faulty F1G2 and DUO R cameras. Can you detail how you wentvabout accessing the file system in the F1G2. I know how to do it with i and E series cameras but not on the F1G2. Many Thanks.

Fraser
« Last Edit: December 27, 2017, 12:58:02 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #413 on: December 27, 2017, 12:23:25 pm »
Hi all. Merry Christmas!

I have a flir one for android and after many attempts i end up with a damaged CPU. Is it possible though to check if the flir sensor is working even with other interface as well?
TIA
 

Offline lambcutlet

  • Contributor
  • Posts: 13
  • Country: gb
Re: Question about FLIR One for Android
« Reply #414 on: December 28, 2017, 06:47:14 am »
Fraser, how much do you know about linux? below is some basic commands to help you navigate with examples
hardware setup. note: attach micro USB cable otherwise board powers down
solder 3 wires to Tx,Rx & Gnd (see my previous document for locations) using a TTL to USB convertor https://shop.clickandbuild.com/cnb/shop/ftdichip?productID=53&op=catalogue-product_info-null&prodCategoryID=296. then using putty http://www.putty.org to connect to the serial port of the TTL cable using settings 115200, 8n1.
so now when you power-up the Flir one you should see the boot sequence ending with a prompt
'Welcome to Rosebud (Operational)
(none) login:'
Code: [Select]
RomBOOT
Start AT91Bootstrap version svn-r5344 ...
Init HALF drive strength DDR... BOARD_ConfigureDdram()
DDRSDRC->DDRSDRC_LPR: 0x12101
Done!
Downloading image...
Trying to load uboot...
nandflash_hw_init()
reset_nandflash()
AT91F_NandReadID()
ManufacturerID: 0x2c DeviceID: 0xa1
chip id: 0x2ca1
Copy 0x50000 bytes from 0x40000 to 0x23f00000
nandflash_cfg_8bits_dbw_init()
switch(sNandInfo.uDataNbBytes) 2048:
read_nandflash: while (1)
read_nandflash: while (1)
read_nandflash: while (1)
read_nandflash(): return 0;
Done!
Returning jump to 0x0x23f00000


U-Boot 2010.06-svn5344 (Aug 03 2015 - 13:27:27)

DRAM:  64 MiB
NAND:  nand->ecc.bytes 28
nand->ecc.steps 1
nand->ecc.layout = pmecc_oobinfo_2048
host->mm 13
host->nn 8191
host->tt 4
host->sector_size 512
host->sector_number 4
host->ecc_bytes_per_sector 7
host->alpha_to 0x10C000
host->index_of 0x108000
128 MiB
*** Warning - bad CRC or NAND, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0, macb1
eth_enable not set, skipping macb init.
eth_enable not set, skipping macb init.
Watchdog enabled.
Hit CTRL-C to stop autoboot:  0
Data (writethrough) Cache is ON
boot operational

Loading from nand0, offset 0xe00000
   Image Name:   Linux-2.6.39+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3358884 Bytes = 3.2 MiB
   Load Address: 20008000
   Entry Point:  20008000
Bit flip in data area, byte_pos: 772, bit_pos: 5, 0xbc -> 0x9c
Bit flip in data area, byte_pos: 192, bit_pos: 4, 0x72 -> 0x62
Bit flip in data area, byte_pos: 1503, bit_pos: 4, 0x72 -> 0x62
Bit flip in data area, byte_pos: 826, bit_pos: 0, 0x27 -> 0x26
Bit flip in data area, byte_pos: 937, bit_pos: 2, 0xbe -> 0xba
Bit flip in data area, byte_pos: 104, bit_pos: 3, 0xfc -> 0xf4
Bit flip in data area, byte_pos: 1636, bit_pos: 7, 0xc3 -> 0x43
Automatic boot of image at addr 0x22000000 ...
## Booting kernel from Legacy Image at 22000000 ...
   Image Name:   Linux-2.6.39+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3358884 Bytes = 3.2 MiB
   Load Address: 20008000
   Entry Point:  20008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.025000] AT91: CM rev B and higher
[    0.037000] AT91: EK rev B and higher
Starting watchdog...done
mounting jffs2 READ-ONLY...done
start battery charge control
Starting battery_charge: OK
done
Formatting /tmp/versions: OK
[    1.666000] lepton_init
[    1.672000] lepton_probe: using 16-bit SPI width

Welcome to Rosebud (Operational)
(none) login:
now enter the username and password to gain access
Code: [Select]
Welcome to Rosebud (Operational)
(none) login: root
Password:
login[313]: root login on ‘ttyS0‘
-sh: id: not found
sh: bad number
-sh: id: not found
-sh: /bin/hostname: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
-sh: alias: not found
$
you now have a root prompt.
type 'ls' to show what's in your directory
type 'pwd' to show where you are
Code: [Select]
$ ls
RBTest.sh     shared_files
$
$ pwd
/root
$
you are in directory '/root'
now 'cd' to change directory, example 'cd shared_files/'
then 'ls' to show contents
Code: [Select]
$ cd shared_files/
$ ls
CameraFiles.zip         lepton_info.txt         version_dv.txt
batteryvoltages.txt     manufacturing_data.txt  version_op.txt
connector_type          version.txt             version_up.txt
$
to view the contents of regular files use 'cat' for example 'cat batteryvoltages.txt'
Code: [Select]
$ cat batteryvoltages.txt
764
762
765
762
765
$
use 'cd ..' to move up a directory level
Code: [Select]
$ pwd
/root/shared_files
$ cd ..
$ pwd
/root
$
using the above commands you can now navigate by changing directories, view the contents of that directory and view file contents.
so now on to more interesting locations the root of the linux system 'cd /' and perform 'ls'
Code: [Select]
$ cd /
$ ls
bin          home         linuxrc      proc         sys          var
dev          init         mnt          root         tmp          version.txt
etc          lib          opt          sbin         usr
$
this is the root of the system
this may help as a general guide to explain folder contents http://www.thegeekstuff.com/2010/09/linux-file-system-structure/
location of log files '/var/log/'
location of config files '/etc/'

other helpful commands:
type 'reboot' to reboot the Flir one processor
type 'poweroff'' to powerdown and disconnect



 
The following users thanked this post: Fraser, joe-c, mahony

Offline lambcutlet

  • Contributor
  • Posts: 13
  • Country: gb
Re: Question about FLIR One for Android
« Reply #415 on: December 28, 2017, 06:54:19 am »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #416 on: December 28, 2017, 03:29:54 pm »
@Lambcutlet,

Many thanks for the excellent guide to accessing the file system. That is really helpful to me. I am no Linux guru but I will study the Linux command set and work on gaining a better knowledge of it. My previous experience has only been with Knoppix !

I believe my FLIR PM series cameras also run Linux so I shall have to access their engineering serial port and do some digging around in them as well.

Many thank again  :-+

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline misterno

  • Contributor
  • Posts: 33
  • Country: gr
Re: Question about FLIR One for Android
« Reply #417 on: December 29, 2017, 09:40:58 am »
misterno, I used a lepton breakout board https://www.digikey.co.uk/products/en/development-boards-kits-programmers/evaluation-boards-sensors/795?k=lepton and a raspberry pi to check the thermal sensor, like this https://learn.sparkfun.com/tutorials/flir-lepton-hookup-guide
Thank you for immediate reply. I mention that my PCB is in good condition. Is it any chance to order a new empty CPU and do the programming later?
If that happens i would be very pleased.  :)
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #418 on: December 30, 2017, 01:28:25 pm »
@lambcutletF
thanks for sharing the information, how to debug the F1G2   :-+

Offline mahony

  • Regular Contributor
  • *
  • Posts: 156
  • Country: de
Re: Question about FLIR One for Android
« Reply #419 on: December 30, 2017, 05:01:39 pm »
Hi lambcutlet,
very nice Infos!  :-+ Do you have pictures of your wiring setup?
Did you just connect the TTL to USB to the original USB pins?

Regards
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #420 on: December 30, 2017, 06:24:24 pm »
Mahoney,

The wiring points are shown on the open office text document that was provided but it needs to be viewed by an Open Office capable program. I converted it to PDF using an on line converter.

Fraser
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 
The following users thanked this post: mahony

Offline lambcutlet

  • Contributor
  • Posts: 13
  • Country: gb
Re: Question about FLIR One for Android
« Reply #421 on: January 04, 2018, 10:15:21 pm »
misterno,
I have never programmed an Atmel CPU but I suspect replacing a broken CPU with a blank version will not solve your problem. There has to be some embedded code programmed into the device to make it function.
Maybe others with more programming experience of these devices could help.
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #422 on: January 08, 2018, 12:29:55 pm »
I got two not working thermal imager. The first one has problems with calibration. The second thermal imager does not turn on. 1.The shutter does not work. This problem arises from the poor quality of conductive paste. This paste is connected to the conductive paths in Lepton. Replace the paste with a good conductive coating. I make it from copper dust and nail polish. The main thing that a wife or daughter did not notice the loss of lacquer. 2. The thermal imager does not turn on. After connecting the dipstick of the oscillograph to quartz, it began to work. It works a few seconds or minutes well. Then the image freezes. The LED flashes. Shutter is working. The calibration button does not work. I checked the generation on quartz. Again there is no signal. There are three possible causes of failure. Quartz is defective. Defective capacitors next to it. Defective controller. I will look for quartz for replacement. maybe I'm lucky.  Photo signals and voltages that should be. Maybe for someone it's useful.
P.S. I changed the quartz. Nothing changed.
« Last Edit: January 13, 2018, 05:24:32 pm by Uho »
 
The following users thanked this post: Fraser

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #423 on: January 14, 2018, 12:57:04 pm »
lambcutlet,
If you did not find the webcam, then you can try to connect an external one.
 1. Remove the SN9C270A.
 2. Connect the DM and DP of the external USB camera to the leads 29 and 30.
 3. Feed 5v and ground wire connect to the USB connector of the thermal imager.
If the webcam 640x480 then it should work.
 
The following users thanked this post: Fraser

Offline in.Vitro

  • Regular Contributor
  • *
  • Posts: 50
  • Country: de
Re: Question about FLIR One for Android
« Reply #424 on: January 19, 2018, 07:20:25 am »
...

this will not work for the iOS Version, right?
 

Offline Uho

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ua
Re: Question about FLIR One for Android
« Reply #425 on: January 19, 2018, 07:57:49 am »
I do not know that. But Seek is only a connector. I changed the plug and the thermal imager worked on the android. I did not repair Flir one ios. Therefore, I can not say exactly whether they are the same.
 

Offline newex

  • Contributor
  • Posts: 23
  • Country: 00
Re: Question about FLIR One for Android
« Reply #426 on: January 19, 2018, 02:50:18 pm »
There are two board revisions. The difference between them in the presence of a single chip. Both work on android or iOS. They are absolutely identical functionally. I put a board from the iOS version into the case for the android and it worked.
 

Offline kazik151

  • Newbie
  • Posts: 1
  • Country: pl
Re: Question about FLIR One for Android
« Reply #427 on: March 02, 2018, 11:22:29 pm »
Hello,
I have read about all amazing things that you've done with F1G2 and I'd like to ask you for advice. My Flir One is totally down. When I plug the battery, it sends part of boot sequence to the serial port:
Code: [Select]
RomBOOT

Start AT91Bootstrap version svn-r5344 ...

Init HALF drive strength DDR... BOARD_ConfigureDdram()

DDRSDRC->DDRSDRC_LPR: 0x12101

Done!

Downloading image...

Trying to load uboot...

nandflash_hw_init()

reset_nandflash()

AT91F_NandReadID()

ManufacturerID: 0x2c DeviceID: 0xa1

chip id: 0x2ca1

Copy 0x50000 bytes from 0x40000 to 0x23f00000
nandflash_cfg_8bits_dbw_init()

switch(sNandInfo.uDataNbBytes) 2048:

read_nandflash: while (1)

read_nandflash: while (1)

read_nandflash: while (1)

read_nandflash(): return 0;

Done!

Returning jump to 0x0x23f00000

RomBOOT

Start AT91Bootstrap version svn-r5344 ...

Init HALF drive strength DDR... BOARD_ConfigureDdram()

DDRSDRC->DDRSDRC_LPR: 0x12101

Done!

Downloading image...

Trying to load uboot...

nandflash_hw_init()

reset_nandflash()

AT91F_NandReadID()

ManufacturerID: 0x2c DeviceID: 0xa1

chip id: 0x2ca1

Copy 0x50000 bytes from 0x40000 to 0x23f00000
nandflash_cfg_8bits_dbw_init()

switch(sNandInfo.uDataNbBytes) 2048:

read_nandflash: while (1)

read_nandflash: while (1)

read_nandflash: while (1)

read_nandflash(): return 0;

Done!

Returning jump to 0x0x23f00000

Then nothing happens for the next 17 seconds when the orange light blinks once and then it starts all over again. So it is a kind of boot loop. Do you know is there anything that I can do to make it work?
 

Offline wb0gaz

  • Regular Contributor
  • *
  • Posts: 200
Re: Question about FLIR One for Android
« Reply #428 on: March 07, 2018, 11:13:12 pm »
I am trying to duplicate the installation on linux mint 17.3 described by tomas123 in reply 110 on December 31, 2015, 01:50:14 AM. Although the post was made over 2 years ago, it provides a solution that I seek: My goal is to get my Flir ONE G2 for Android running on a generic Linux machine.

I am unable to complete the procedure, as I get stuck building the v4l2loopback module.

I am running the same version of linux mint 17.3, but as a virtual machine (virtualbox guest.) This is the main (only?) difference between the procedure I am following and the procedure in the reply above.

I am unable to complete install of the v4l2loopback module which is compiled from source per the instructions.

In cd v4l2loopback/
make works fine, however, when I issue the command
sudo make install
to prepare v4l2loopback.ko, I receive an error about a missing key (presumably a cryptographic key).

Here is the result of sudo make install:

------------------------------------------------
sudo make install
make -C /lib/modules/`uname -r`/build M=/home/dgf/v4l2loopback modules_install
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-32-generic'
  INSTALL /home/dgf/v4l2loopback/v4l2loopback.ko
Can't read private key
  DEPMOD  3.19.0-32-generic
make[1]: Leaving directory `/usr/src/linux-headers-3.19.0-32-generic'[/font][/font]
-------------------------------------------------

As I cannot complete "make install", I cannot perform sudo modprobe v4l2loopback video_nr=1,2.

I originally was trying this procedure with Ubuntu 16.04, but ran into the same (cryptographic key) problem, and as I didn't see mention of a key in reply 110 above, I thought I would be OK using Linux Mint 17.3, but that is not the case.

While I have long ago successfully built kernel modules, I have not done this in quite some time, so the process of requiring inclusion of a cryptographic key is new to me. While I can find quite a bit of information on how to install linux with (or without) secure UEFI boot, I cannot find a clear explanation of how to build a kernel that involves a key.

Any help/pointer very much appreciated!

Dave
« Last Edit: March 07, 2018, 11:33:41 pm by wb0gaz »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #429 on: March 09, 2018, 09:02:03 am »
Linux kernel driver are a pain and google is your friend ;-)

Quote
make "Can't read private key"   DEPMOD generic

Google found
https://github.com/slavrn/gm12u320/issues/7

and a german post with the same error message under Linux Mint by compiling a keyboard kernel driver:

https://www.linuxmintusers.de/index.php?topic=33630.msg469267#msg469267
Code: [Select]
Can't read private key
  DEPMOD  3.19.0-32-generic
make[1]: Verzeichnis »/usr/src/linux-headers-3.19.0-32-generic« wird verlassen

after the last post in this thread it works after unbind/bind some driver and change the path...
see this script
https://github.com/CMoH/lg4l/blob/master/rebind


Offline yokoAC

  • Newbie
  • Posts: 5
  • Country: de
Re: Question about FLIR One for Android
« Reply #430 on: March 23, 2018, 06:15:17 pm »
Hey  :)

I'm trying to use the FlirOne on Windows10
My approach:
- use the code you presented for Linux (based on libusb)
- use Zadig ("Zadig is a Windows application that installs generic USB drivers, such as WinUSB, libusb-win32/libusb0.sys or libusbK, to help you access USB devices."): at the moment I'm using 'libsubK'

Actually the interface 0x81 is working! E.g. I get log messages like the following one (I'm sorry, not at my working computer...copied this log msg from the forum, but I get quasi the same msg)

Code: [Select]
{"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"}}
or some stuff about the battery status.

My problem is, that 0x83 and 0x85 is not working. Using libusb_bulk_transfer() on these interfaces always returns LIBUSB_ERROR_NOT_FOUND :(
Did anyone get this error? Maybe there is someone getting the same error while trying to get run the FlirOne on Windows10.
I think there is maybe a problem how USB communication is done on Windows10 (...but why is 0x81 working?!). Sorry, I'm entirely new to this topic :(

Thanks!
 

Offline yokoAC

  • Newbie
  • Posts: 5
  • Country: de
Re: Question about FLIR One for Android
« Reply #431 on: April 06, 2018, 05:16:53 pm »
Hey :)

Is there nobody who wants to get the FlirOne running on Windows10? :(
I attached my FlirOne.cpp and the corresponding output.

I tried to use libusb_set_interface_alt_setting instead of libusb_control_transfer to start/stop the interfaces 1 and 2 (not sure, if this is okay..).
Now I get an LIBUSB_ERROR_IO error on the endpoints 0x83 and 0x85 (instead of using libusb_control_transfer, where I would get the LIBUSB_ERROR_NOT_FOUND error).

Corresponding to the OutputFile, the interfaces 1 and 2 have two alternate settings (0 and 1). Using 1 results in  LIBUSB_ERROR_IO and using 0 results in LIBUSB_ERROR_NOT_FOUND.

Maybe the approach using libusb_set_interface_alt_setting is completely wrong. Hopefully there is somebody with an idea how to connect to the endpoints 0x83 and 0x85.
Thanks!
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Re: Question about FLIR One for Android
« Reply #432 on: April 09, 2018, 11:26:48 am »
Preview version! Sometimes works for Windows!

I create driver FLIR One Gen 2 for Windows XP with WinDDK!
After calibration does not work!

Uses:
0) Find WdfCoInstaller01009.dll (its not in archive! Big size...)
1) Flir One Gen 2 On.
2) Wait for green LED.
3) Start FlirOneControl.exe.
4) In path Image must created files ".tga". ( If everything worked :) - Does not always work )
5) Fun. :)

The program used ReadFile in synchronously mode. After closing the window FlieOneControl in the task manager, close the application if it remains working.

If you use the program Zadig to install the WinUSB driver for the FLIR One device, then it should be possible to write a program using the WinUSB interface to control the FLIR One. In this way, you won't need to write a dedicated driver for FLIR One. WinUSB is available on all Windows systems, from XP all the way to Windows 10. Therefore, once you wrote your program and posted it to the internet, anybody could download it and use it. They would just need one extra step, and that is to download Zadig, and use it to install the WinUSB driver for FLIR One. Once they did that, your program would work to control the FLIR One.

You could even include a copy of Zadig with your download of your FLIR One app, and include instructions in a text file explaining how to use Zadig to install the WinUSB driver for the FLIR One device.

The nice thing about the WinUSB driver is that it is very generic, and can be installed for any device using Zadig. Once it is installed, if you know the USB commands that the device is expecting, you can use the WinUSB interface to send those commands to the device. The WinUSB interface is part of the Windows API. It's just a set of DLL functions that let you control any device that currently has the WinUSB driver installed.
 

Offline yokoAC

  • Newbie
  • Posts: 5
  • Country: de
Re: Question about FLIR One for Android
« Reply #433 on: April 09, 2018, 07:55:00 pm »
Hey guys :)

Actually, I have also tried using WinUSB (see attached file: sorry for inappropriate programming, I'm new to this windows stuff and just put different code examples together).
I get the device and can receive some descriptors, but I'm not sure how to communicate with the device. I cannot change the alternate settings or the configuration.

I think there is some bad windows stuff...e.g. WinUSB cannot set the configuration (configuration 3 is needed as you can see in the files which are running on Linux) as described in https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/selecting-the-configuration-for-a-multiple-interface--composite--usb-d:
Quote
The operating system does not allow this...a client driver that controls a set of interfaces or an interface collection of the composite device cannot change the configuration that is initially set by Usbccgp.sys

This could be the reason why it's running on Linux and not on Windows. The following 'project' tries to avoid this problem by using a so called lower-level filter driver (https://nadavrub.wordpress.com/2014/10/16/winusb-with-non-default-configuration/). Too bad, that I do not get this one running :(

All in all, maybe developing a driver might be the only chance  :-\

Remark: if anyone wants to monitor his USB output, I can recommend "Device Monitoring Studio". The first 14 days are for free.
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #434 on: April 13, 2018, 03:10:34 pm »
Quote
All in all, maybe developing a driver might be the only chance  :-\

I created the driver. But in Windows 7 and later it can not be installed. And Windows 7 and older does not see the Flir One.
 

Offline yokoAC

  • Newbie
  • Posts: 5
  • Country: de
Re: Question about FLIR One for Android
« Reply #435 on: April 14, 2018, 11:52:15 am »
Quote
All in all, maybe developing a driver might be the only chance  :-\

I created the driver. But in Windows 7 and later it can not be installed. And Windows 7 and older does not see the Flir One.

Hey, are you talking about the three drivers you developed before? Or did you develop a 'one-driver' solution in the meantime, where no single driver installation for each interface is necessary?
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #436 on: April 14, 2018, 01:45:21 pm »
I'm talking about the driver for each interface. There are three.
 

Offline yokoAC

  • Newbie
  • Posts: 5
  • Country: de
Re: Question about FLIR One for Android
« Reply #437 on: April 16, 2018, 12:21:55 pm »
I am running the same version of linux mint 17.3, but as a virtual machine (virtualbox guest.) This is the main (only?) difference between the procedure I am following and the procedure in the reply above.

Did you get anything running on your virtual machine?
I'm trying to use a virtual machine (VMware, Linux Mint 17.3) as well, but I cannot connect to the Flir..
Actually all installation steps are successful, but when I start the flir8g-mint.c code I just get the following:
Successfully find the Flir One G2 device
libusb_set_configuration error -99

Does anyone have this problem as well? Could this be related to my virtual machine?
« Last Edit: April 16, 2018, 12:30:04 pm by yokoAC »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #438 on: April 19, 2018, 08:52:56 pm »
I also had no success with vmware and usb (flir one).
 

Do you remember, how many time I wasted on the wrong system (Linux VM, OS X)?
Apparently the FlirOne G2 USB connection is tricky...
 

Offline budhafoo

  • Newbie
  • Posts: 8
Re: Question about FLIR One for Android
« Reply #439 on: April 27, 2018, 01:59:16 am »
This thread is awesome! 8)

I have not read all, but I felt like writing something.
My flir one for android (2nd gen I believe) just died.

The unit is blinking orange when charged, opened it, unplug the batt, tried all sort of things.

When I manage to get the green light blinking, the unit is recognized using the app, but shows only blank/black screen.

I havent opened the copper tape shielding to do some measurements, but unit surely gets really hot when the orange light is blinking, current from charger when plugged is around 500mA.

If anyone can point me what can start to read/do that will be great. :D

-B
 

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #440 on: May 17, 2018, 01:58:42 pm »
First of all thank you @tomas123 & @cynfab for the brilliant work!

I am using the "flir8p1-gpl" Driver (11/2016) in conjunction with EZ-Wifibroadcast on a Reconnaissance & Inspection drone project. The FlirOneG2 is connected to a Raspberry Pi0 which is mounted to the drone.
The Pi0 running EZ-Wifibroadcast streams a digital HD-Video feed and the FlirOneG2 Thermalvideo wirelessly to the Ground where  it can be displayed via HDMI (or on a tablet). The same WiFi link (bi-directional) is also used to control the drone.
The range is up to 8km. #mind-boggling :o

It was excessive work to get everything working but finally I succeeded.
However some minor problems (P) and questions (Q) remain and I hope I can get some help and guidance here  ;)

 P1.) I noticed that quite often I get the "reset buffer because of bad Magic Byte" error. The system will continue working but that feels somehow uncomfortable (and I think it also drops some frames?)
 P2.) The FCC shutter is quite annoying during Air operations. Is there a parameter on the driver how to disable this calibration or at least do it less often?
        (everytime the video freezes for a sec the pilots heart almost stops)

now for the questions:

 Q1.) Is "flir8p1-gpl.tar" (as from 11/2016) the latest version of the driver? User rbalint wanted to publish it on GitHub after tomas123 & cynfab gave their okay for the license.
        (However rbalint never wrote again or publsihed the GitHub link  :wtf:? - do i miss anything?)
 Q2.) Is it possible to get more then the ~9fps from the camera? I noticed that the linux password for the camera has been revealed. Has there been any attempt to remove this limitation or is the 9fps limitation hardware wise?
 Q3.) Is there a way to change the color-palette without restarting the Driver?


Thank you so much for your help and terrific work.

BTW: That's how my little project (codename: Predator) looks like... It is used for good ( saving fawns during harvest season)

« Last Edit: May 17, 2018, 02:09:19 pm by careyer »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #441 on: May 18, 2018, 02:16:41 am »
Thanks for the nice words.
Since the Flir One-G2 is no longer available other than used from e-bay I have not done too much with the code since 2016. The Flir One G3 is somewhat of a disappointment.
So on to your problems & questions.

P1, yes I have seen that error message, I have no clue as to what it means and the system does seem to continue running. I think it may have to do with Flir's USB stack, but it doesn't seem to cause any problems.

P2, Yes the FFC is a PITA for airborne operations, I believe there is a command to stop the automatic FFC and another to do a manual FFC, but I have not investigated.

Q1, the latest code I had anything to do with is flir8p1. Someone else may have done more with it. My primary goal was to run flir8 on a 3DR Solo on it's iMx6 companion computer. I got this to work, but found that the iMx6 was somewhat underpowered for the job. It took a lot of work to figure out how to recompile u-boot and the kernel, Also the 3.10.17 kernel really needs updating to a much more recent version to allow running gstreamer 1.0, and that proved to be more than I was willing to put any more time into.
It is still an interesting project and the potential for S&R, inspections is really great. The cost of one Flir Vue or Flir DUO is more than several 3DR Solo's + Flir One G2's.

Q2, to do that one would have to tweak the Lepton 3 as well as the code in the onboard ARM processor. a) this may not be a good idea for ITAR/Wassamer reasons, b) the onboard ARM processor may not be able to process more than 9fps. 3) your external processor would have to process a lot more data too, which may be beyond it's capabilities, the Solo's iMx6 is almost out of it's league at 9fps, any more would require an auxiliary processor, if you could get the first two parts to work, IMHO, financially  it would make more sense to by some other camera.

Q3, not with the flir8 code, it's open source, have at it, and best of luck.

I like your Predator!!    Fawn + John Deere => "Bad Things(tm) happening to Bambi"

First of all thank you @tomas123 & @cynfab for the brilliant work!

I am using the "flir8p1-gpl" Driver (11/2016) in conjunction with EZ-Wifibroadcast on a Reconnaissance & Inspection drone project. The FlirOneG2 is connected to a Raspberry Pi0 which is mounted to the drone.
The Pi0 running EZ-Wifibroadcast streams a digital HD-Video feed and the FlirOneG2 Thermalvideo wirelessly to the Ground where  it can be displayed via HDMI (or on a tablet). The same WiFi link (bi-directional) is also used to control the drone.
The range is up to 8km. #mind-boggling :o

It was excessive work to get everything working but finally I succeeded.
However some minor problems (P) and questions (Q) remain and I hope I can get some help and guidance here  ;)

 P1.) I noticed that quite often I get the "reset buffer because of bad Magic Byte" error. The system will continue working but that feels somehow uncomfortable (and I think it also drops some frames?)
 P2.) The FCC shutter is quite annoying during Air operations. Is there a parameter on the driver how to disable this calibration or at least do it less often?
        (everytime the video freezes for a sec the pilots heart almost stops)

now for the questions:

 Q1.) Is "flir8p1-gpl.tar" (as from 11/2016) the latest version of the driver? User rbalint wanted to publish it on GitHub after tomas123 & cynfab gave their okay for the license.
        (However rbalint never wrote again or publsihed the GitHub link  :wtf:? - do i miss anything?)
 Q2.) Is it possible to get more then the ~9fps from the camera? I noticed that the linux password for the camera has been revealed. Has there been any attempt to remove this limitation or is the 9fps limitation hardware wise?
 Q3.) Is there a way to change the color-palette without restarting the Driver?


Thank you so much for your help and terrific work.

BTW: That's how my little project (codename: Predator) looks like... It is used for good ( saving fawns during harvest season)

 

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #442 on: May 18, 2018, 07:52:47 am »
Thanks for the nice words.
Since the Flir One-G2 is no longer available other than used from e-bay I have not done too much with the code since 2016. The Flir One G3 is somewhat of a disappointment.
So on to your problems & questions.

P1, yes I have seen that error message, I have no clue as to what it means and the system does seem to continue running. I think it may have to do with Flir's USB stack, but it doesn't seem to cause any problems.

P2, Yes the FFC is a PITA for airborne operations, I believe there is a command to stop the automatic FFC and another to do a manual FFC, but I have not investigated.

Q1, the latest code I had anything to do with is flir8p1. Someone else may have done more with it. My primary goal was to run flir8 on a 3DR Solo on it's iMx6 companion computer. I got this to work, but found that the iMx6 was somewhat underpowered for the job. It took a lot of work to figure out how to recompile u-boot and the kernel, Also the 3.10.17 kernel really needs updating to a much more recent version to allow running gstreamer 1.0, and that proved to be more than I was willing to put any more time into.
It is still an interesting project and the potential for S&R, inspections is really great. The cost of one Flir Vue or Flir DUO is more than several 3DR Solo's + Flir One G2's.

Q2, to do that one would have to tweak the Lepton 3 as well as the code in the onboard ARM processor. a) this may not be a good idea for ITAR/Wassamer reasons, b) the onboard ARM processor may not be able to process more than 9fps. 3) your external processor would have to process a lot more data too, which may be beyond it's capabilities, the Solo's iMx6 is almost out of it's league at 9fps, any more would require an auxiliary processor, if you could get the first two parts to work, IMHO, financially  it would make more sense to by some other camera.

Q3, not with the flir8 code, it's open source, have at it, and best of luck.

I like your Predator!!    Fawn + John Deere => "Bad Things(tm) happening to Bambi"

Thank you cynfab for quickly coming back to me!
I am aware that the FlirOneG2 is end of life and not available for purchase anymore. However from time to time you can make a good deal buying a used one off ebay. (or like Fraser likes to do: revive a dead one). Like you already pointed out: For the price of a FLIR VUE Pro you can get a whole bunch of them plus some neat drone equipment on top.  :-+
(And when it comes to the FlirOneG3 I totally agree: It's a total rip-off: Flir compensates for all the repair- and support costs  they had with dying batteries and corrupted firmewares on the G2 model by shipping a less capable product (G3 Std) for the same price -or- in case of the Pro model: slightly vamped up but with almost same G2 performance for a much higher price tag). So at the end of the day the G2 is still the better G3Pro!

As for
P2.)  the auto FFC thing -  I think the solution was described here  by tomas123 (Yes I did read the whole thread! ;D). However I have no clue at all when it comes to programming. It is almost like an extra terrestrial  language to me. I was hoping that you guys might be willing and able to help out here? That would be awesome and so much appreciated.  :clap:

Q2.) Yes I understand. The ITAR thing is quite obvious. The inernal ARM processor might be a bottleneck as well. However the Processor on the Pi0 has plenty off number crunching power left. Moreover I make use of its' hardware H264 encoder to process the thermal frames, i.e. -> no additional load for the CPU at all. I'd be more than happy to share if you are interested and still into flying (and building) drones. It should suit your solution (3DR Solo) well since EZ-Wifibroadcast uses MavLink.  ;)

Q3.) same extra terrestrial thing you know...  :scared: (Ahhhh!!!...)

Have a great day! Cheers!
Thomas
« Last Edit: May 18, 2018, 08:08:19 am by careyer »
 

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #443 on: May 18, 2018, 09:11:40 am »
Hi careyer,

you are the second Bambi lifesaver in this thread 
I love your work :-+ :-+

@tomas123
Use case is flying over the field and searching for Bambi that would be hurt or killed while mowing the hay.

I wrote the code as proof of concept.  Therefore the code is raw and the error correction algorithm is half-baked.
A drop in the packets from USB interface results in a "Reset buffer because of bad Magic Byte!"

I think, my last version was flir8l3.zip
minor update:
- a smaller font 5x7 for more chars in information line
- better filtering FFC frames
- crosshair for medium temperature of 2x2 "center" pixels
- info line with temperature  min/crosshair/max
https://www.eevblog.com/forum/thermal-imaging/question-about-flir-one-for-android/?action=dlattach;attach=195140

In April 2017 I ran this code in a test environments 19 days non-stop (F1G2 with a Raspberry Pi0).
After 14.877.155 frames I cancelled the test, because I was worried about the shutter hardware and the overloaded battery.
Code: [Select]
: Sat Apr 29 10:30:46 2017
#14877155 84/10 fps:{"shutterState":"ON","shutterTemperature":314.989990234375,"usbNotifiedTimestamp":1178763464.53319,"usbEnqueuedTimestamp":1178763464.53469,"ffcState":"FFC_VALID_RAD"}

Unfortunately, there has never been anyone in this forum who has improved my C code (proof oc concept) for USB communication with the camera.


Your queastions:
(P1) See above. I know, there is a big potential for a stable connection.
(P2) from my notes

first disable Auto FFC (autoFFC:false)
Code: [Select]
            //--------- write string: {"type":"setOption","data":{"option":"autoFFC","value":false}}
            length = 16;
            unsigned char my_string4[16]={0xcc,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x57,0x64,0x17,0x8b};
            printf("\nEP 0x02 to be sent Hexcode: %i Bytes[",length);
            for (i = 0; i < length; i++) {
                printf(" %02x", my_string4[i]);

            }
            printf(" ]\n");

            r = libusb_bulk_transfer(devh, 2, my_string4, length, &transferred, 0);
            if(r == 0 && transferred == length)
            {
                printf("\nWrite successful!");
            }
            else
                printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

            strcpy(  my_string,"{\"type\":\"setOption\",\"data\":{\"option\":\"autoFFC\",\"value\":false}}");
            length = strlen(my_string)+1;
            printf("\nEP 0x02 to be sent %i Bytes: %s", length, my_string);

            // avoid error: invalid conversion from ‘char*’ to ‘unsigned char*’ [-fpermissive]
            my_string1 = (unsigned char*)my_string;

            r = libusb_bulk_transfer(devh, 2, my_string1, length, &transferred, 0);
            if(r == 0 && transferred == length)
            {
                printf("\nWrite successful!");
                printf("\nSent %d bytes with string: %s\n", transferred, my_string);
            }
            else
                printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

and trigger if required a manual FCC (doFFC:true)
Code: [Select]
unsigned char my_string2[16]={0xcc,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xb9,0xcb,0xa2,0x99};

                r = libusb_bulk_transfer(devh, 2, my_string2, length, &transferred, 0);
                if(r == 0 && transferred == length)
                    printf("\nWrite successful!");
                else
                    printf("\nError in write! res = %d and transferred = %d\n", r, transferred);

                char my_string[128];
                transferred = 0;

                strcpy(my_string, "{\"type\":\"setOption\",\"data\":{\"option\":\"doFFC\",\"value\":true}}");
                length = strlen(my_string)+1;

                unsigned char *my_string1 = (unsigned char*)my_string;

                transferred = 0;

                r = libusb_bulk_transfer(devh, 2, my_string1, length, &transferred, 0);
                if(r == 0 && transferred == length)
                {
                    printf("\nWrite successful!");
                    printf("\nSent %d bytes with string: %s\n", transferred, my_string);
                }
                else
                    printf("\nError in write! res = %d and transferred = %d\n", r, transferred);


(Q1) see my comments above. The last versions in this thread are "only" improvements in code structure for palette and calibrations values. Unfortunately not for communications to F1G2.
My proposal:
Learn the basics for C programming and you can self change the code for your needs.
This is not as hard as compiling kernel drivers  ;)

(Q2) The lepton datasheet gives as 8.7 Hz. I can't hack the frame rate.

(Q3) This is only a minor code customizing. See (Q1)

Offline tomas123

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: de
Re: Question about FLIR One for Android
« Reply #444 on: May 18, 2018, 09:26:20 am »
Hello cynfab,
two years later it's nice to hear from you in this thread.
It was a great piece of work together.
:-+

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #445 on: May 18, 2018, 09:35:25 am »
Hi tomas123,

thanks man for your awesome and detailed reply.
I am happy to hear that despite to the error message the connection between F1G2 and Pi0 seems to be rock solid. That is brilliant news!

I have already tried to have a look to the c Sources but I am somewhat too dump to do it. It has been years and years since I did some Java coding (back then at university) but somewhat my brain is not made for coding - c in particular scares the death out of me . That is a major drawback I have  |O  :palm:
I really would not ask for help if I could somehow manage to do it myself.

It would be a dream come true to have a version that allows at runtime for:
  • manual FFC
  • change color palette

Maybe the two of you (cynfab and you) can team up again to add this final step and make it perfect?
So much thanks in advance from me and the Bambis
Cheers!
Thomas

P.S: That is how the integration into EZ-WifiBroadcast looks like! Man I can't thank you enough for making this driver reality.
(Looks like the Pi is connected to the TV in this video but it is not. It transmits wireless to a 2nd Pi which is behind the TV ;-)) BTW - My wife was incredibly pissed off that she could not watch her Sex and the City DVD for days and days of debugging. haha ;D

« Last Edit: May 18, 2018, 09:53:53 am by careyer »
 

Offline cynfab

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
Re: Question about FLIR One for Android
« Reply #446 on: May 18, 2018, 01:05:31 pm »
Hi tomas123!
Good to hear from you as well, I read this forum every day (almost), but too many other projects lead to less attention to each ;>((
I wish I could find half of the "good deals" that Fraser finds, he as a talent for sniffing out some of the best thermal camera bargains there are.
I know I posted the link to my 3DR Solo with Flir One G2, but here it is again in case anyone didn't see it:


caryer, I'l like more details on your drone setup, FC, frame, flight time carrying capacity etc. it looks like s nice one.

It's never too late to learn more coding...


Hello cynfab,
two years later it's nice to hear from you in this thread.
It was a great piece of work together.
:-+
 

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #447 on: May 18, 2018, 01:33:32 pm »
@cynfab
Your side-by-side integration into the Solo-App looks sweet man! :-+

here are a few basic data about the "Predator" drone as requested. It has been a 2year DIY project.

Frame: folding frame milled from aircraft grade aluminum and carbon, retractable landing gear (completely DIY, collapses down to the size of a Phantom when folded)
Propulsion System: DJI E1200 Pro, 17" Props (max 4,8kW, combined 16kg Thrust)
FC: 3DR Pixhawk
Controlsystem: EZ-Wifibroadcast (modified, bidirectional 2,4Ghz Link: FullHD-Video + Thermal Downlink, Control Uplink via MavLink/Serial,
Range ~8km - no boosters, no directional antennae, no tracking required) - so to say DJI Lightbridge 2 for a budget! (and more versatile) ;)
Camera: Raspberry Camera with switchable IR-Filter + FlirOne G2
Battery: 6S 20.000mAh (2,4kg)
AUW: 4,6kg
Lifting capacity: plenty! ;) (but 5kg weight limit in Germany, oh man...)
Flighttime: approx. 45-50min
very silent in flight and absolutely robust against wind gusts and outside influences

Sure! It's never too late to learn coding. I tried several times (Java and Java ME) but when it comes to C i miserably failed - I tried more than once. :palm:
(Obviously I'm more of a craftsman).
Therefore any help from you guys would be greatly appreciated - really!
In exchange I can get you kick started with the EZ-Wifibroadcast integration if that is of any interest to you - or donate some beer!?  :popcorn:



« Last Edit: May 18, 2018, 02:00:37 pm by careyer »
 

Offline Fraser

  • Super Contributor
  • ***
  • Posts: 13165
  • Country: gb
Re: Question about FLIR One for Android
« Reply #448 on: May 18, 2018, 04:12:16 pm »
Confab,

You will be pleased to hear that I am no longer actively hunting thermal cameras 🙂

If there are any bargains out there, you will not have me competing with you to buy them 👍

I actually sold some of my collection and more will follow I feel sure. I hit saturation point !

Best Wishes

Fraser
« Last Edit: May 18, 2018, 04:14:00 pm by Fraser »
If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #449 on: May 26, 2018, 07:17:53 pm »
I developed a thermal imager based on stm32f407vgt6. Dysplay with hx8347d controller 320x240. Flir Lepton 3 unit. Flir lepton board.

Connecting Display Contacts:

D0 - PD14
D1 - PD15
D2 - PD0
D3 - PD1
D4 - PE7
D5 - PE8
D6 - PE9
D7 - PE10
CS - PD7 (FSMC_NE1)
RW - PD5 (FSMC_NWE)
RD - PD4 (FSMC_NOE)
RS - PD11 (FSMC_A16)
RESET - PE1

Connecting lepton board Contacts:
SCK - PA5
MISO - PA6
MOSI - GND
CS - GND
SCL - PB6
SDA - PB7

Programm for Keil 5 and Cube MX: https://github.com/da-nie/STM32F407VGT6AndFlirLepton3
« Last Edit: June 02, 2018, 04:49:12 pm by da-nie »
 
The following users thanked this post: carpin, newex

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #450 on: May 28, 2018, 08:17:42 am »
@da-nie: Looks awesome!  :clap: What are you planning to do with it?

I tinkered all weekend with the flir8 driver for linux. However I wasn't able to alter it in the way needed and compile it. I am stuck.  :-BROKE
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #451 on: May 28, 2018, 02:29:18 pm »
Quote
What are you planning to do with it?

I want to make a night vision device. :)
 

Offline alromh87

  • Newbie
  • Posts: 1
  • Country: mx
Re: Question about FLIR One for Android
« Reply #452 on: September 11, 2018, 04:10:23 am »
@careyer Hello I got interested in your proyect and it could be of some use for me, I do lots of programming and electronics so I dont think It would be a problem to help you with small changes in software:

manual FFC
change color palette

Unfurtunately I don't have much time right now, so if you could point me to the right information would be very apreciated, same goes for EZ-Wifibroadcast.

In the mean time I'm building this USB sniffer to get needed packages and put them into the driver:
https://blog.gimx.fr/a-beagleboard-xm-based-usb-sniffer/

Hope to hear from you soon.

I like using github so I would like to put code there if its still ok with after tomas123 & cynfab
« Last Edit: September 11, 2018, 04:19:05 am by alromh87 »
 
The following users thanked this post: careyer

Offline careyer

  • Newbie
  • Posts: 8
  • Country: de
Re: Question about FLIR One for Android
« Reply #453 on: September 14, 2018, 01:16:54 pm »
@alromh87 : You have a PM :-+
 

Offline McBryce

  • Super Contributor
  • ***
  • Posts: 2682
  • Country: de
Re: Question about FLIR One for Android
« Reply #454 on: October 01, 2018, 10:51:27 am »
@da-nie: I have a FlirOne G2 for Android that's dead. I haven't taken a proper look at why yet, but I may end up building something like you show here. Do you have a webpage where all this is summarised, or is the thread the only source for your work?

McBryce.
30 Years making cars more difficult to repair.
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #455 on: October 01, 2018, 04:51:03 pm »
I write on different forums and update the results.
The program with lepton-3 and stm32 is updated on https://github.com/da-nie/STM32F407VGT6AndFlirLepton3
 

Offline reddypragnya

  • Newbie
  • Posts: 2
  • Country: in
Re: Question about FLIR One for Android
« Reply #456 on: February 17, 2019, 03:05:06 pm »
if any one is struggling with building of kernel headers,
Find the kernel version by
uname -a.
And build the kernel as instructed in rasbian site :  https://www.raspberrypi.org/documentation/linux/kernel/building.md
« Last Edit: February 21, 2019, 05:29:13 am by reddypragnya »
 

Offline dROb

  • Newbie
  • Posts: 1
  • Country: ru
Re: Question about FLIR One for Android
« Reply #457 on: February 22, 2019, 07:51:38 am »
Guys, sorry my question is a bit off the main subject, but..

I am going to have an old Flir One for iPhone. I will be using it with Raspberry - the main intention is to get the Lepton from there and interface it over SPI. But at the mean time it is interesting to use it as a complete device. But, unfortunately I will have IOS version. So the question is - can I interface the IOS version from Raspberry? I have seen the post in this thread, that says connecting IOS version to Andoid does not work. I think this is not my case, so would it work with Raspberry?
 

Offline a1b2c3d4e5f6

  • Newbie
  • Posts: 1
  • Country: au
Re: Question about FLIR One for Android
« Reply #458 on: March 20, 2019, 10:33:25 am »
Does anyone know if its possible to access both thermal and visible cameras independently on the Flir Duo using linux OS, e.g. ubuntu or rpi. I need to get two connections like /dev/video0 and /dev/video1 to make it work with another app.

Regards a
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #459 on: March 22, 2019, 07:32:41 am »
You need to write the driver yourself. Ready probably not.
 

Offline reddypragnya

  • Newbie
  • Posts: 2
  • Country: in
Re: Question about FLIR One for Android
« Reply #460 on: April 26, 2019, 08:01:58 am »
I have been trying to make modifications in flir8p1.c code and make executable file to run. But i have been unable to do so. I am using codeblock to run edit and run the c code. The errors notified are header files to be added which i did by downloading them from github and other sources. But then again it shows error of unable to find certain syntax in jconfig.h. 
Seems like it is bout the header files, please help.
 

Offline gusisin

  • Newbie
  • Posts: 2
  • Country: gb
Re: Question about FLIR One for Android
« Reply #461 on: July 09, 2019, 11:52:36 am »
Tomas, Firstly THANK YOU!!!! the work you have done on the FLIR cameras is amazing. I have been playing with your code and when I process the raw data it seems that the temperature slop is a little off. As I understand it (from my Lepton SPI experiences the raw data from the sensor is Deg Kelvin * 100. So to convert to Deg C is

Raw temp - 273.15 = Deg C.

Using a laser spot meter I get the following

Measured temp (Laser)                             Two Byte raw value               Kelvin                     Centigrade
                                                  (seems to be missing some resolution)
         20.5                                                             3387                            338.7                            64
          0 (Ice)                                                         2236                            223.6                           -50
         37.2 (my mouth :-)                                       3757                            375.7                            101 :'(

As I understand it the raw values come in in two bytes an LSByte and an MSByte. I downloaded the SDK for android to check and sure enough to convert raw to Celsius is (raw/100) -273.15.

When you were testing did you find any issues with the values? When I use my flie one pro on my phone the spot meter is spot on.

Can you help with an idea?

Thanks
Gus
 

Offline gusisin

  • Newbie
  • Posts: 2
  • Country: gb
FLIR one pro new part number IR problem
« Reply #462 on: April 11, 2020, 07:06:45 am »
@tomas123 and all,
I think FLIR are fighting back.

I am building an application for search and rescue that uses two Flir one pro devices connected to a single raspberry pi. I have it working and its great. There is however a new issue.

When I use the device part number 435-0007-01 (made in China) all is wonderful both visible and IR images show as expected. When I then use cameras with the part number 435-0013-03 (made in Estonia) the visible is still fine and the IT displays as what I think looks like a random memory segment.

In a test I connected one of each and displayed the images so you can see what I mean. when I run an lsusb -v against both devices the output and endpoints are identical. I suspect that it might be a timing issue does anyone have an idea??

Thanks in advance

Gus
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #463 on: May 15, 2020, 04:34:03 pm »
Hi @gusisin

Having the same issue with an RPI4 and the Flirone Pro LT part no - 435-0013-03 M/N 0013, (although mine's is made in China).

Did you manage to get anywhere with yours? I'm going to try an RPI3 and see if I fair any better.
 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #464 on: May 16, 2020, 05:55:09 am »
@aund

Any chance you can save the bulk transfer data to a file for analysis?

Looks like at the start it's got some typical header, and then interestingly a continuous colour palette band, before it turns in to the noise.
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #465 on: May 16, 2020, 08:31:14 am »
Thanks for replying Inflex. Unfortunately following a reboot on two different devices I'm getting the following when trying to start ffmpeg on both

Code: [Select]
ffmpeg -f video4linux2 -i /dev/video3 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method epzs -b 2600k -bt 256k -f rtp rtp://192.168.0.131:1234

results in

Code: [Select]
[video4linux2,v4l2 @ 0x14822b0] ioctl(VIDIOC_G_FMT): Invalid argument
/dev/video3: Invalid argument



The v4l2loopback module is loaded and I can see the 3 video devices created.

Can you give me a steer on how to do the bulk transfer and once I've resolved the above I'll upload the file.

Thanks!
 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #466 on: May 16, 2020, 08:54:39 am »
Sounds like your V4L2 device names have moved around.

What does the following command give you?

   v4l2-ctl --list-devices


I'm not sure which source code you're using, but you might have to tweak/change it to suite the new v4l2 loopback numbers?

Thanks for replying Inflex. Unfortunately following a reboot on two different devices I'm getting the following when trying to s
Code: [Select]
[video4linux2,v4l2 @ 0x14822b0] ioctl(VIDIOC_G_FMT): Invalid argument
/dev/video3: Invalid argument


Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #467 on: May 16, 2020, 09:23:11 am »
Thanks - got it fixed - I just needed to power cycle the camera - doh!

Can you give me a steer on how to do the bulk transfer and once I've resolved the above I'll upload the file.

Cheers
 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #468 on: May 16, 2020, 09:49:35 am »
Thanks - got it fixed - I just needed to power cycle the camera - doh!

Can you give me a steer on how to do the bulk transfer and once I've resolved the above I'll upload the file.

Cheers

You could try something like the following added in ( the last block is the block to add, the other bits of code are for you to know where roughly to add it :)



Code: [Select]
uint32_t FrameSize   = g->buf85[ 8] + (g->buf85[ 9] << 8) + (g->buf85[10] << 16) + (g->buf85[11] << 24);
uint32_t ThermalSize = g->buf85[12] + (g->buf85[13] << 8) + (g->buf85[14] << 16) + (g->buf85[15] << 24);
uint32_t JpgSize     = g->buf85[16] + (g->buf85[17] << 8) + (g->buf85[18] << 16) + (g->buf85[19] << 24);
uint32_t StatusSize  = g->buf85[20] + (g->buf85[21] << 8) + (g->buf85[22] << 16) + (g->buf85[23] << 24);

if ( (FrameSize+28) > (g->buf85pointer) ) {
// wait for next chunk
//
return 0;
}

        //  Write a framesize block of code to a file called frame.data
        //
{
int fo;
fo = open("frame.data", O_CREAT, O_WRONLY);
if (fo) {
write(fo, g->buf85, FrameSize );
close(fo);
}
}
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 
The following users thanked this post: aund

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #469 on: May 16, 2020, 09:52:24 am »
I should note, you probably want to kill this with ctrl-c in the middle of it running so that it can dump a working frame and hopefully it'll be the right size :)
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #470 on: May 16, 2020, 12:10:39 pm »
Thanks again Inflex.

Unfortunately the frame.data file size is 0. I haven't touched c in about 20 years but I think the buf85 object isn't being written to the file for some reason.

This is what I added into flir8p1.c

Code: [Select]
  uint32_t StatusSize  = buf85[20] + (buf85[21] << 8) + (buf85[22] << 16) + (buf85[23] << 24);

  printf("FrameSize= %d (+28=%d), ThermalSize %d, JPG %d, StatusSize %d, Pointer %d\n",FrameSize,FrameSize+28, ThermalSize, JpgSize,StatusSize,buf85pointer);

  if ( (FrameSize+28) > (buf85pointer) )
  {
    // wait for next chunk
    return;
  }

  // Write a framsize block of code to a file called frame.data
  //
  {
        int fo;
        fo = open("frame.data", O_CREAT, O_WRONLY);
        if (fo) {
                printf("Frame size is: %d\n", FrameSize);
                printf("Buffer is: %d\n", buf85);
                write(fo, buf85, FrameSize );
                close(fo);
                }
        }

  int i,v;
  // get a full frame, first print the status
  t1=t2;


and this is what I got out

Code: [Select]
Frame size is: 80412
Buffer is: 148308
FrameSize= 80540 (+28=80568), ThermalSize 10332, JPG 70040, StatusSize 168, Pointer 28
FrameSize= 80540 (+28=80568), ThermalSize 10332, JPG 70040, StatusSize 168, Pointer 10360
FrameSize= 80540 (+28=80568), ThermalSize 10332, JPG 70040, StatusSize 168, Pointer 80568
Frame size is: 80540
Buffer is: 148308
FrameSize= 80683 (+28=80711), ThermalSize 10332, JPG 70184, StatusSize 167, Pointer 28
FrameSize= 80683 (+28=80711), ThermalSize 10332, JPG 70184, StatusSize 167, Pointer 10360
FrameSize= 80683 (+28=80711), ThermalSize 10332, JPG 70184, StatusSize 167, Pointer 80711
Frame size is: 80683
Buffer is: 148308
FrameSize= 80484 (+28=80512), ThermalSize 10332, JPG 69984, StatusSize 168, Pointer 28
FrameSize= 80484 (+28=80512), ThermalSize 10332, JPG 69984, StatusSize 168, Pointer 10360
^C
root@raspberrypi:/home/pi/temp/flir8p1-gpl# ls -lrt frame.data
---------x 1 root root 0 May 16 12:45 frame.data

 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #471 on: May 16, 2020, 12:14:29 pm »
My bad, the open() call is slightly wrong, should have been;

fo = open("frame.data", O_CREAT|O_WRONLY, 0644);
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 
The following users thanked this post: aund

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #472 on: May 16, 2020, 12:23:18 pm »
Awesome,

Got some data now

 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #473 on: May 16, 2020, 12:23:37 pm »
Quote
FrameSize= 80540 (+28=80568), ThermalSize 10332, JPG 70040, StatusSize 168, Pointer 28

Just hit me... what's the chance you've been supplied the LT version with 80x60 sensor?

PRO 160x120 version has a 160|4|160|4 row structure for the IR, but yours will be 160|4 byte only, and with 10332 bytes for the sensor, that makes 63 rows of data, perfect fit :\
« Last Edit: May 16, 2020, 12:25:08 pm by Inflex »
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #474 on: May 16, 2020, 12:34:34 pm »
Just extracted the JPEG frame out, so the data is good; I haven't however loaded the IR data in to my interpreter yet but I'd say that is what's happened, you've got the LT version.
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #475 on: May 16, 2020, 12:38:52 pm »
Ah thank you. When I switched the video ref in ffmpeg I can see the optical image.

So assuming I have the LT is it just a case of changing the right variables to match?

 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #476 on: May 16, 2020, 12:40:05 pm »
Ah thank you. When I switched the video ref in ffmpeg I can see the optical image.
So assuming I have the LT is it just a case of changing the right variables to match?

Yes, it'll be a very small output frame (80x60 + 8 at the bottom if you want the text, and only 13 characters).
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 
The following users thanked this post: aund

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #477 on: May 17, 2020, 01:28:39 pm »
It is indeed the LT model.

I've tried a few things now to get up and running

1) Changing the VIDEO_DEVICE2 resolutions to match

Code: [Select]
#define VIDEO_DEVICE2 "/dev/video3" // colorized thermal image
#define FRAME_WIDTH2  80
#define FRAME_HEIGHT2 60

This yields the attached pic which is my hand (just legible). I don't have extreme frost byte so I think the colour range is off somewhere.  There are various hard coded references to what I assume is fixed height and width through the code (i.e. 160, 120  & 128).

2) I've tried changes all references of 160 -> 80, 120 -> 60 & 128 - > 64. This is obviously quite a bad stab in the dark which shows how little I understand of how the image is put together and unsurprisingly just results in errors when trying to run.

I think I'm a little of of my depth so I'm going to see if I can get my hands on the non LT model instead.

Thanks again for all your help.

 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #478 on: May 17, 2020, 01:57:53 pm »
Hello Aund,

   I'm just cleaning up the workshop and then I'll come back and have a look at the IR data block that you sent through last night; did you want to send me a copy of your code that you're using and I'll try see if I can spot something obvious (or attach it here, just the main C file)
Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #479 on: May 17, 2020, 02:17:11 pm »
Here you go - thanks!

Do you need an updated frame dump with the new resolutions in place? I did try that but ffmpeg now errors with "[video4linux2,v4l2 @ 0x23ad2b0] ioctl(VIDIOC_G_FMT): Invalid argument
/dev/video3: Invalid argument" when I put the framedump code in place, so it's commented out for now.
 

Offline Inflex

  • Regular Contributor
  • *
  • Posts: 166
  • Country: au
    • Charters Towers Phone & Computer Repairs
Re: Question about FLIR One for Android
« Reply #480 on: May 17, 2020, 04:29:07 pm »
Here you go - thanks!

   All good - just getting in late now (02H28) after cleaning up in the workshop, I'll have a look at the code in the morning.

Paul.

Magicsmoke abuser | What I repair daily on YouTube | FlexBV
- BoardView
| Paul Daniels
 

Offline Mowj

  • Newbie
  • Posts: 1
  • Country: ir
Re: Question about FLIR One for Android
« Reply #481 on: May 19, 2020, 04:36:00 pm »
I want to thank all those who shared information on FLIR One here. It really made my work possible. I would also like to share some more info that I gained about the usb software interface. Some (most?) of the info below are repeated from the previous posts for the sake of completeness.

All messages are preceded by a header.
All headers are comprised of 32-bit words in little-endian order.
Headers of config endpoints have 4 words, those of file endpoints have 6 words, and those of frame endpoints are 7 words.
The first word is always the magic number (0x1cc for config, 0x5510 for file, 0xbeef for frame).
The second word appears to be always one. I'm still not sure about its meaning.
The third word is always the payload (message) size in bytes.
The last word is always the CRC-32 of all but the last word of header with the following parameters (this is the conventional CRC-32):
Polynomial: 0x04C11DB7,  Init: 0xFFFFFFFF,  Reflect Input: true,  Reflect Output: true,  XOR Output: 0xFFFFFFFF

For file headers:
The fourth word is the stream identifier.
The fifth word is the conventional CRC-32 of the file itself.

For frame headers:
The fourth word is the size of thermal image.
The fifth word is the size of visual (jpeg) image.
The sixth word is the size of status string.

After issuing a command to the config endpoint, you can query it for a response.
For commands of type 'setOption', the response is of type 'setOptionStatus' and indicates the new value of the option (-1 if the option does not exist).
For commands of type 'openFile', the response is of type 'openFileStatus' and indicates the stream identifier of the opened file. The stream identifier is essentially the return value of the fopen function. Negative values indicate different error codes. Non-negative values could be used by a readFile command to read the opened file.
Analysis of the sdk binary reveals that there are also 'reboot' and 'upgradeFirmware' commands with corresponding responses 'rebootStatus' and 'upgradeFirmwareStatus'. But I haven't worked out the required arguments for these commands.
« Last Edit: May 26, 2020, 06:18:35 am by Mowj »
 

Offline da-nie

  • Contributor
  • Posts: 44
  • Country: ru
Re: Question about FLIR One for Android
« Reply #482 on: May 20, 2020, 05:36:26 pm »
I created new Flir One Gen 2 control programm for Linux.

Programm used Qt5 and libusb (Run through "sudo" if you do not have sufficient user rights.).


 

Offline mojpismonosa

  • Newbie
  • Posts: 1
  • Country: hr
Re: Question about FLIR One for Android
« Reply #483 on: June 03, 2020, 11:43:01 pm »
Hi everyone!

Thanks for hard work in enabling this little thermal cam to be used on systems other than the manufacturer itself cared to!

I've been using the 'clean code' version from github (https://github.com/fnoop/flirone-v4l2), been stuck on "invalid argument" thing for a while, and got it that it is a thing of the v4l2loopback kernel module, not the code itself. After compiling latest version like https://www.dpin.de/nf/thermal-camera-on-linux-flir-one-pro/ did (from https://github.com/umlaeute/v4l2loopback/releases) and running the ./flirone as superuser (sudo or root user, couldn't get it to work otherwise using udev rules no matter what) on kernel 5.x, Ubuntu 18.04, it's been working flawlessly!

The question I have is -
Is the some way one could trigger the Non-uniform-calibration (NUC) as Android app (the stock one from FLIR) can? Or, at least detect (from frames) when the NUC is happening or did happen?

Thank you very much!
 

Offline victorffs

  • Newbie
  • Posts: 2
  • Country: br
Re: Question about FLIR One for Android
« Reply #484 on: June 16, 2020, 04:23:06 am »
Hi guys!
Firs I would like to congratulate everyone that helped on this post. That's an amazing initiative and you are awesome!
I'm would like to know if someone could get the Flir One Pro LT version working with Linux.
I'm trying to use the Pro LT with an raspberry Pi 4 but i'm having some issues. Here is some comments about:

1 - The Pro LT didnt work with the V4L on RPI4 but I could workaround using the MJPEG Streamer as suggested by @thomas123 before
2 - The normal camera (real.jpg) is working fine, but I cant get the image from the thermal camera (thermal.jpg). I get the same issues that some guys replied here before, an image with some colored glitches:
1003793-0
(obs. I've covered the thermal camera with my fingers and noticed some changes on the glitches patterns, so probably the image is being received but need to be correctly decoded)
3 - I've tried to change the the references for resolution on the source code from 160x120 to 80x60 but still getting the same issue.

I've saw that @aund could put the Pro LT version to work, but I cant do the same here.
Is there any other changes that I should do beyond the resolution?

Please, someone could help me?
Thank you in advance!
« Last Edit: June 16, 2020, 04:26:44 am by victorffs »
 

Offline aund

  • Newbie
  • Posts: 9
  • Country: gb
Re: Question about FLIR One for Android
« Reply #485 on: June 16, 2020, 03:30:11 pm »
Hi Victorffs,

I actually gave up on trying to change the source code to fit the dimensions of the FLIR1 as I simply don't have enough knowledge of how the video stream is put together (coupled with not being a C programmer).

@Inflex might be able to give you some pointers as he very kindly pointed me in the right direction with some of this.

I only got as about as far as you are now, sorry I couldn't be more help and good luck!
 

Offline victorffs

  • Newbie
  • Posts: 2
  • Country: br
Re: Question about FLIR One for Android
« Reply #486 on: June 17, 2020, 05:13:58 pm »
Thanks for your answer @aund!
I'm considering change my version LT to the PRO, but its more expensive and isn't available for now at my distributor (he said that probably on 1th july will be available)
So, I'll try to keep using the LT until july, if not works I will try to change the camera.
@Inflex do you have some suggestions to make the LT work?

Regards!
 

Offline Propretor

  • Contributor
  • Posts: 34
  • Country: ru
Re: Question about FLIR One for Android
« Reply #487 on: December 03, 2020, 08:12:35 am »
Guys, and who has not tried to run the Flir One Pro Gen3 without a battery?
First, supply power to Type-C and connect to a smartphone without a battery.
If everything is OK, then you can make one connection internally between the Type-C charger and micro-USB / Type-C data.
Alteration will make a siktermal out of flir :)
I haven't used flirting for about a year and the battery has completely run out. Now the flir cannot even charge the built-in battery to 100% - the green LED does not stop blinking for 6 hours, and then the orange one turns on. Nevertheless, there is still 10-20 percent of the previous capacity in the battery. And the thermal imager does not work for long.
The question is in the vandal-free analysis of the subject.
Is there a parsing order in pictures or videos?
 

Offline soumitra.kbc@gmail.com

  • Newbie
  • Posts: 1
  • Country: in
Re: Question about FLIR One for Android
« Reply #488 on: August 29, 2021, 06:43:44 pm »
Could obtain the stream (both Thermal & Visual) from FLIR Pro for Android to the Raspberry Pi following the blog. Thanks all for the contribution. But how to obtain the temperature matrix for further analysis of the obtained Thermal images?
 

Offline luporl

  • Newbie
  • Posts: 2
  • Country: br
Re: Question about FLIR One for Android
« Reply #489 on: May 19, 2022, 04:38:13 pm »
Hello,

I was trying to make a Flir One Gen3 camera work on Linux and I ended up finding this forum thread and the code in https://github.com/fnoop/flirone-v4l2.

Unfortunately it didn't work and I got results similar to those that tried to use it with the Pro LT version.

But after spending some time experimenting with the code, I've managed to get a version that works with the Flir One Gen3 camera, that have a sensor with 80x60 resolution.
As this is the same resolution of the Pro LT models, maybe it will work with them too.

So, if anyone wants to try it out, here it is: https://github.com/luporl/flirone-v4l2

Best regards!
 
The following users thanked this post: anthonymg

Offline anthonymg

  • Newbie
  • Posts: 2
  • Country: pe
Re: Question about FLIR One for Android
« Reply #490 on: October 14, 2022, 09:05:26 pm »
Hi,

Thanks for that @luporl, I was also trying to adapt the code to work with the FLIR ONE GEN 3. However, I still have a persistent problem. Some of the frames in the transmission appear similar to the attached image and consequently the temperature values are nan values or incorrect values. Currently, I am stuck on this. In your adaptation have you been able to overcome this problem?

 

Offline anthonymg

  • Newbie
  • Posts: 2
  • Country: pe
Re: Question about FLIR One for Android
« Reply #491 on: October 25, 2022, 02:46:28 pm »
Hi,
After a few weeks trying to find the bug. I have noticed that inside the loop where libusb_bulk_transfer is called to get the data in the buffer the information is sometimes not complete. The complete data that should be received should be of the size 28 + FrameSize where FrameSize = ThermalSizer + JpgSize + StatusSize. However, when gathering the information from the data that comes in the buffer, it seems that some information was lost and they do not complete this ideal size. Or on other occasions it seems that the information that was lost was from the next header and the size of the information between two headers is much larger than it should be.

I'm using the code from https://github.com/fnoop/flirone-v4l2 , with modifications from @luporl for a flir one gen 3 , compiling it on a raspberry pi 3 model b

What could I do to solve this problem?
 

Offline luporl

  • Newbie
  • Posts: 2
  • Country: br
Re: Question about FLIR One for Android
« Reply #492 on: December 01, 2022, 05:34:08 pm »
Hi @anthonymg,

I haven't seem the issues you mention, about nan or incorrect temperature values.
I saw something similar with the original code, that is for cameras with higher resolutions, then with flir one gen 3 less data would be read and the remaining bytes in buf85[] would be garbage.
But I've only tested it on an x86 laptop, haven't tried it on any raspberry pi boards.

The ThermalSize should always be the same. JpgSize varies, because of compression.
And buf85pointer should always start counting, and be reset, after the 4 magic bytes are found.

I guess you're running using RPi 3 in little-endian mode, right? If not, then the lines that get the sizes from buf85[] would have to be changed.

Other than that, it's hard to know what could be the problem. Maybe you're not reading fast enough from usb or some usb frames are being lost?
 

Offline YacineBrahim

  • Newbie
  • Posts: 1
  • Country: se
Re: Question about FLIR One for Android
« Reply #493 on: February 26, 2023, 03:20:36 pm »
Any one can help please to provide a clean software to run FLIR ONE PRO camera on Linux Machine. That will be very much appreciated. Thanks
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf