IR Touch screen

Anything related to hardware, devices, drivers and how to use them with Ultibo.
User avatar
Rassamaha78
Posts: 46
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Thu Jun 07, 2018 3:46 pm

For your purpose is the simple mouse mode useful for getting started with?

Yes, I just need mouse emulation, I do not use the double-touch function.
User avatar
Ultibo
Site Admin
Posts: 2079
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Tue Jun 12, 2018 4:15 am

Rassamaha78 wrote:Yes, I just need mouse emulation, I do not use the double-touch function.

I've uploaded to our new Drivers repository an experimental driver for the USB IR Touch device as per the HID reports you provided.

If you download this unit from GitHub, save it to your project folder and include it in the uses clause of your project then it should automatically register and create a mouse device from your touchscreen.

If I have everything correct then it should work with the mouse cursor example, at least enough to know what else needs to be changed.

Let me know the results.
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Rassamaha78
Posts: 46
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Tue Jun 12, 2018 1:15 pm

I did some experiments with the driver, here are the results:
1. If connect only the IR panel to the Raspberry Pi, it does not work as before. If connect a USB mouse and IR panel at the same time, both devices start working.
2. If run the mouse cursor example, then when I move the mouse, I see offsets ( OffsetX, OffsetY ), mostly small values (1 to 32), if touch the screen with finger, then the offsets take values from 0 to 32766. Probably this is not an offset, and the relative coordinates transmitted by the IR panel ?

Of course, when using the panel, I do not see the cursor on the screen, because it goes off the screen.

I made some photos, that you would understand what they are talking about, they find a zip archives in the attachment:

IR_Top_Left.JPG - The finger touches the upper-left corner of the screen
IR_Center_Center.JPG - The finger touches the center of the screen
IR_Bottom_Right.JPG - The finger touches the bottom right of the screen

IR_Top_Left.zip
(220.48 KiB) Downloaded 21 times

IR_Center_Center.zip
(289.95 KiB) Downloaded 16 times

IR_Bottom_Right.zip
(313.71 KiB) Downloaded 28 times
pik33
Posts: 788
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: IR Touch screen

Postby pik33 » Tue Jun 12, 2018 6:11 pm

the offsets take values from 0 to 32766


Writing a mouse procedures for my project I discovered three different types of mice. They all send dx, dy in their reports, but then these dx and dy can be 8 (boot mode standard), 12 and 16 bit.
If the screen uses 16-bit then 32766 can be a valid value.
User avatar
Ultibo
Site Admin
Posts: 2079
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Tue Jun 12, 2018 11:43 pm

Thanks for the test results, that's a very good start.

There are a couple of things to resolve but it looks like it should work, this is also providing valuable information for creating a more generic Ultibo mouse driver that can recognize these types of devices and correctly handle them without changes.

Rassamaha78 wrote:1. If connect only the IR panel to the Raspberry Pi, it does not work as before. If connect a USB mouse and IR panel at the same time, both devices start working.

We need to work out why that is, are you able to setup a test with logging enabled and just plug in the IR panel alone to see if any errors are logged?

Rassamaha78 wrote:2. If run the mouse cursor example, then when I move the mouse, I see offsets ( OffsetX, OffsetY ), mostly small values (1 to 32), if touch the screen with finger, then the offsets take values from 0 to 32766. Probably this is not an offset, and the relative coordinates transmitted by the IR panel ?

I suspected from the decode of the HID report that the device would return absolute coordinates instead of offsets, there is a flag in the mouse API that is intended to indicate this so I'll update the driver and also update the example because it doesn't currently account for absolute.

We also need to handle scaling somewhere so that 0 to 32767 can be scaled relative to the width and height of the screen. Since the scaling is totally dependent on the screen size this might be better handled in the code that consumes the mouse data rather than the driver so I'll try adding it to the example to see how it works.
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Rassamaha78
Posts: 46
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Wed Jun 13, 2018 4:09 am

We need to work out why that is, are you able to setup a test with logging enabled and just plug in the IR panel alone to see if any errors are logged?


Logs in the attached file:

Mouse_and_IR.log - Mouse and IR is connected
IR_Only.log - Only the IR panel is connected

Ultibo_logs.zip
(1.59 KiB) Downloaded 20 times
User avatar
Ultibo
Site Admin
Posts: 2079
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Fri Jun 15, 2018 6:05 am

Ultibo wrote:I suspected from the decode of the HID report that the device would return absolute coordinates instead of offsets, there is a flag in the mouse API that is intended to indicate this so I'll update the driver and also update the example because it doesn't currently account for absolute.

We also need to handle scaling somewhere so that 0 to 32767 can be scaled relative to the width and height of the screen. Since the scaling is totally dependent on the screen size this might be better handled in the code that consumes the mouse data rather than the driver so I'll try adding it to the example to see how it works.

I've committed an update to the Drivers repository to add support for absolute X and Y values to this driver, if you download it again it should improve the behavior.

The change for absolute X and Y also includes a change to the mouse API itself (the TMouseData structure has been expanded) so you will need to download and build the latest RTL (from today) in order to test the updated driver.

The mouse cursor example has also been updated to support absolute X and Y and now does scaling of the X and Y values against the size of the screen, get the new copy from the Examples repository on GitHub.

Let us know what the results are after these updates.

Rassamaha78 wrote:Logs in the attached file:

I'm still looking into this, can you also provide a log of plugging in (and unplugging) the IR Touch Screen after booting the Pi (ie power on the Pi, wait until it boots and then plug in the touch screen)?

You also said that the touch screen works if another USB mouse is connected, can you test if connecting a USB keyboard or USB flash drive instead has the same affect?
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Rassamaha78
Posts: 46
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Mon Jun 18, 2018 12:56 am

I tried, but nothing has changed at all, the values of the Offsets is still from 0 to 32766.

I checked with which devices the panel is starting to work:
    IR panel Only - not work
    IR panel + USB Flash Drive - not work
    IR panel + USB Keyboard - not work
    IR panel + USB Mouse (Logitech RX-300) - working

Maybe I missed some action when updating the example ?

User avatar
Ultibo
Site Admin
Posts: 2079
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Mon Jun 18, 2018 2:09 am

Rassamaha78 wrote:I tried, but nothing has changed at all, the values of the Offsets is still from 0 to 32766.

Sorry, I probably should have made that clearer.

The offset values displayed will still be between 0 and 32767 but the calculated cursor X and Y position should now be scaled to the size of the screen (and the pointer will hopefully follow your finger on the screen).

You might want to add an extra line in the example above the call to FramebufferDeviceUpdateCursor() to print out the calculated cursor X and Y values so you can see them.

Rassamaha78 wrote:I checked with which devices the panel is starting to work:
    IR panel Only - not work
    IR panel + USB Flash Drive - not work
    IR panel + USB Keyboard - not work
    IR panel + USB Mouse (Logitech RX-300) - working

If you are using the mouse cursor example to test you should also add the Keyboard and Storage units to the uses clause, otherwise the only USB driver included is the mouse which might explain those results.

Can you also obtain a log of plugging in the IR panel after the Ultibo application has booted?
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Ultibo
Site Admin
Posts: 2079
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Mon Jul 16, 2018 11:53 am

Hi @Rassamaha78,

Just wondering what your results were with this and if you have any further information or feedback, it would be great to know if you got this working so we can use the information to help with creating a generic driver.
Ultibo.org | Make something amazing
https://ultibo.org

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest