IR Touch screen

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

Re: IR Touch screen

Postby Rassamaha78 » Sun Jul 22, 2018 7:23 am

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


The IR panel still works only if the USB mouse is connected to Raspberry Pi. Tell me, what other actions should I take, and what information to provide, what would help you complete the development of the driver?
User avatar
Ultibo
Site Admin
Posts: 2185
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Mon Jul 23, 2018 12:20 pm

Rassamaha78 wrote:The IR panel still works only if the USB mouse is connected to Raspberry Pi. Tell me, what other actions should I take, and what information to provide, what would help you complete the development of the driver?

There are two separate items that we need to finalize with this, first can you confirm if the latest code allows the touch screen to work correctly so that the scaled X and Y coordinates are within the range of the display and you can move the mouse pointer around the screen by touching (and dragging) with your finger.

The other item to resolve is why the touch screen doesn't appear to work unless a mouse is also connected, it would be great to see a log of plugging in (and unplugging) the touch screen after the Pi has booted both with and without a USB mouse connected.

Beyond the log you could try a range of different tests and see what the results are, does the touch screen work if you plug in it after booting the Pi, does it work if you boot the Pi with a mouse connected and then unplug the mouse before connecting the touch screen, does it work if something other than a mouse is connected (note my comment previously about the drivers included in the example) and so on.

The idea is to methodically work through a sequence of tests and let us know the results since we can't do those tests ourselves. Hopefully something in the results from a careful set of tests will point towards the cause of the problem and give an idea of where to go next.

Thanks.
Ultibo.org | Make something amazing
https://ultibo.org
blueicaro
Posts: 25
Joined: Sun Nov 19, 2017 11:13 am
Location: Spain
Contact:

Re: IR Touch screen

Postby blueicaro » Fri Nov 30, 2018 9:14 pm

HID_Report_0483_5750_0.dat.bz2
(161 Bytes) Downloaded 14 times
Hello, I have a hdmi TFT screen with touch. I used the experimental driver that you talked about in this thread, but the touch doesn't work.
Ultibo can show images on the screen, and show the cursor mouse. But the touch doesn't work.
I connected the TFT to pc with debian, and I got some information using lsusb command.
In Debian, usb touch works nices, Also it's works on windows 7.
Bus 003 Device 003: ID 0483:5750 STMicroelectronics
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x5750
bcdDevice 2.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 124
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1

Bus 003 Device 003: ID 0483:5750 STMicroelectronics
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x5750
bcdDevice 2.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 124
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1

Using the code for usb descriptors for ultibo that you posted I got a file.
BTW, the Tft comes with a dvd and some drives and some info. And the last drives can be downloaded from here https://github.com/goodtft/LCD-show
Can you help me?.
Attachments
Information.bz2
(807 Bytes) Downloaded 14 times
http://wiki.teisrobotics.org
User avatar
Ultibo
Site Admin
Posts: 2185
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Sat Dec 01, 2018 9:14 am

blueicaro wrote:Can you help me?.

Thanks blueicaro,

Yes we can help if you can help us too.

What we'd like to get to is a set of generic USB HID drivers for Keyboard, Mouse, Touch and Joystick (Gamepad) that will work with most common devices.

We'll use the information you provided to create a driver that should work with your touch screen and if you can give us feedback about what works and doesn't work (and we can update and test as we go) that will help a lot to fill in the missing details about how to interact with these devices.

We'll post here when the experimental driver for your device is ready to test.
Ultibo.org | Make something amazing
https://ultibo.org
blueicaro
Posts: 25
Joined: Sun Nov 19, 2017 11:13 am
Location: Spain
Contact:

Re: IR Touch screen

Postby blueicaro » Sat Dec 01, 2018 9:31 am

Thanks for all.

We'll post here when the experimental driver for your device is ready to test.

I wait for you.
What we'd like to get to is a set of generic USB HID drivers for Keyboard, Mouse, Touch and Joystick (Gamepad) that will work with most common devices.

That's cool!. I'm not a expert programmer neither expert in hardware, but I'll be happy in help you, testing, or something what you need.

/BlueIcaro
http://wiki.teisrobotics.org
User avatar
Rassamaha78
Posts: 52
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Sun Mar 10, 2019 6:27 am

I worked on a different project for a long time. Now I’ve returned to Ultibo. I have a IR Touch USB panel, I’m ready to help complete the driver for it, just tell me what should I do?
User avatar
Ultibo
Site Admin
Posts: 2185
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Mon Mar 11, 2019 10:58 pm

Rassamaha78 wrote:I worked on a different project for a long time. Now I’ve returned to Ultibo. I have a IR Touch USB panel, I’m ready to help complete the driver for it, just tell me what should I do?

Welcome back,

Looking back at this thread it seems that as of our last post we were still trying to resolve two items.

1. Does the X and Y scaling now work with the screen size so that coordinates are correct and the mouse pointer movement is correct.

2. Why the device isn't detected unless a mouse is also connected. If you could try some of the tests in our previous post and let us know your results that would be great and should help to make this work completely.
Ultibo.org | Make something amazing
https://ultibo.org
User avatar
Ultibo
Site Admin
Posts: 2185
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: IR Touch screen

Postby Ultibo » Mon Mar 11, 2019 10:59 pm

blueicaro wrote:Thanks for all.

We'll post here when the experimental driver for your device is ready to test.

I wait for you.
What we'd like to get to is a set of generic USB HID drivers for Keyboard, Mouse, Touch and Joystick (Gamepad) that will work with most common devices.

That's cool!. I'm not a expert programmer neither expert in hardware, but I'll be happy in help you, testing, or something what you need.

/BlueIcaro

BlueIcaro, just an update to let you know we haven't forgotten this. We are extremely busy at the moment and it is taking a while to find time to work on things.
Ultibo.org | Make something amazing
https://ultibo.org
blueicaro
Posts: 25
Joined: Sun Nov 19, 2017 11:13 am
Location: Spain
Contact:

Re: IR Touch screen

Postby blueicaro » Sat Mar 16, 2019 4:20 pm

Ultibo wrote:
blueicaro wrote:Thanks for all.

We'll post here when the experimental driver for your device is ready to test.

I wait for you.
What we'd like to get to is a set of generic USB HID drivers for Keyboard, Mouse, Touch and Joystick (Gamepad) that will work with most common devices.

That's cool!. I'm not a expert programmer neither expert in hardware, but I'll be happy in help you, testing, or something what you need.

/BlueIcaro

BlueIcaro, just an update to let you know we haven't forgotten this. We are extremely busy at the moment and it is taking a while to find time to work on things.

Ok. No problem. IF I can help in some thing let me know it.
/BlueIcaro
http://wiki.teisrobotics.org
User avatar
Rassamaha78
Posts: 52
Joined: Wed Dec 20, 2017 1:09 am
Location: Russia

Re: IR Touch screen

Postby Rassamaha78 » Mon Mar 25, 2019 3:00 pm

I returned to work with the IR Touch panel.

I took an example as a basis for tests: "15-MouseCursor", updated from Github.
Results for today:

1. Сoordinates of the cursor are displayed correctly, the cursor follows the finger pointer.
I have attached a small video so that you can see how it works: https://dropmefiles.com/oxOhA
2. If during start-up only the IR panel is connected to Raspberry Pi, then it does not work, it simply does not react to touch.
3. If connect a mouse to Raspberry Pi, both the IR panel and the mouse work.
4. If disсonnect the mouse after Raspberry Pi is loaded, the IR panel continues to work.

Here is all the code I used:

Code: Select all

program MouseCursor;

{$mode objfpc}{$H+}

{$define use_tftp}

uses
  Threads,
  Crt,
  GlobalConst,
  GlobalTypes,
  GlobalConfig,
  Platform,
  Services,
  Console,
  Classes,
  SysUtils,
  UltiboUtils,
  Syscalls,
  VC4,
  Framebuffer,
  RaspberryPi2,
  Mouse,
  DWCOTG,
  HeapManager,
  usbirtouch,
  {$ifdef use_tftp}
  uTFTP,
  {$endif}
  uFTP,
  Winsock2;

var
 Count:LongWord;
 Buttons:String;
 MouseData:TMouseData;

 Handle1:TWindowHandle;
 Handle2:TWindowHandle;

 CursorX:LongInt;
 CursorY:LongInt;

 ScalingX:Double;
 ScalingY:Double;

 ScreenWidth:LongWord;
 ScreenHeight:LongWord;

 FTPServer   : TFTPserver;

 FramebufferDevice    :PFramebufferDevice;
 FramebufferProperties:TFramebufferProperties;

procedure CreateCursor;
var
 Row:LongWord;
 Col:LongWord;
 Offset:LongWord;
 Size:LongWord;
 Cursor:PLongWord;
 Address:LongWord;
begin
  Size:=32 * 32 * 4;
  case BoardGetType of
   BOARD_TYPE_RPIA,BOARD_TYPE_RPIB,
   BOARD_TYPE_RPIA_PLUS,BOARD_TYPE_RPIB_PLUS,
   BOARD_TYPE_RPI_ZERO:begin
     Cursor:=AllocSharedMem(Size);
    end;
   BOARD_TYPE_RPI2B,BOARD_TYPE_RPI3B:begin
     Cursor:=AllocNoCacheMem(Size);
    end;
   else
    begin
     Cursor:=nil;
    end;
  end;

  if Cursor <> nil then
   begin
    Offset:=0;
    for Row:=0 to 31 do
     begin
      for Col:=0 to 31 do
       begin
        if ((Col and 8) xor (Row and 8)) <> 0 then
         begin
          Cursor[Col + Offset]:=$a0ff0000;
         end
        else
         begin
          Cursor[Col + Offset]:=$a00000ff;
         end;
       end;

      Inc(Offset,32);
     end;

    Address:=PhysicalToBusAddress(Cursor);
    CursorSetInfo(32,32,0,0,Pointer(Address),Size);
    FreeMem(Cursor);
   end;
end;

procedure RunFTPServer;
var
 uc: TUserCred;
begin
 FTPServer := TFTPServer.Create;
 uc := FTPServer.AddUser ( 'Admin', '12345', 'C:\' );
 uc.Options := [ foCanAdd, foCanDelete, foCanAddFolder, foCanChangeFolder, foRebootOnImg, foCanDeleteFolder ];
 FTPServer.BoundPort := 21;
 FTPServer.Active := true;
end;

procedure WaitForCDrive;
begin
 while not DirectoryExists('C:\') do
  Sleep( 500 );
end;

function WaitForIPComplete: string;
var
  TCP : TWinsock2TCPClient;
begin
  TCP := TWinsock2TCPClient.Create;
  Result := TCP.LocalAddress;
  if (Result = '') or (Result = '0.0.0.0') or (Result = '255.255.255.255') then
    begin
      while (Result = '') or (Result = '0.0.0.0') or (Result = '255.255.255.255') do
        begin
          sleep (1000);
          Result := TCP.LocalAddress;
        end;
    end;
  TCP.Free;
end;

begin
  Handle1:=ConsoleWindowCreate(ConsoleDeviceGetDefault,CONSOLE_POSITION_LEFT,False);

  Handle2:=ConsoleWindowCreate(ConsoleDeviceGetDefault,CONSOLE_POSITION_RIGHT,True);

  ConsoleWindowWriteLn(Handle1,'Welcome to Example 15 Mouse Cursor');

  ConsoleWindowWriteLn(Handle1,'Wait for "C" Drive...');
  WaitForCDrive();
  ConsoleWindowWriteLn(Handle1,'"C" Drive is Ready.');
  ConsoleWindowWriteLn(Handle1,'Wait for IP complete...');
  ConsoleWindowWriteLn(Handle1,'IP address is: ' + WaitForIPComplete() );
  ConsoleWindowWriteLn(Handle1,'Run FTP Server...');
  RunFTPServer();
  ConsoleWindowWriteLn(Handle1,'FTP Server is Running.');

  FramebufferDevice:=FramebufferDeviceGetDefault;

  FramebufferDeviceGetProperties(FramebufferDevice,@FramebufferProperties);

  ScreenWidth:=FramebufferProperties.PhysicalWidth;
  ScreenHeight:=FramebufferProperties.PhysicalHeight;

  ConsoleWindowWriteLn(Handle1,'Screen is ' + IntToStr(ScreenWidth) + ' pixels wide by ' + IntToStr(ScreenHeight) + ' pixels high');

  //FramebufferDeviceSetCursor(FramebufferDevice,0,0,0,0,nil,0);
  CreateCursor();

  CursorX:=ScreenWidth div 2;
  CursorY:=ScreenHeight div 2;
  FramebufferDeviceUpdateCursor(FramebufferDevice,True,CursorX,CursorY,False);

  while True do
   begin
    if MouseRead(@MouseData,SizeOf(TMouseData),Count) = ERROR_SUCCESS then
     begin
      if MouseData.Buttons = 0 then
       begin
        Buttons:='None';
       end
      else
       begin
        if (MouseData.Buttons and (MOUSE_LEFT_BUTTON or MOUSE_RIGHT_BUTTON)) = (MOUSE_LEFT_BUTTON or MOUSE_RIGHT_BUTTON) then
         begin
          Buttons:='Both';
         end
        else if (MouseData.Buttons and MOUSE_LEFT_BUTTON) = MOUSE_LEFT_BUTTON then
         begin
          Buttons:='Left';
         end
        else if (MouseData.Buttons and MOUSE_RIGHT_BUTTON) = MOUSE_RIGHT_BUTTON then
         begin
          Buttons:='Right';
         end
        else
         begin
          Buttons:='Other';
         end;
       end;

      ConsoleWindowWriteLn(Handle2,'Mouse OffsetX = ' + IntToStr(MouseData.OffsetX) + ' OffsetY = ' + IntToStr(MouseData.OffsetY) + ' Buttons = ' + Buttons);

      if (MouseData.Buttons and MOUSE_ABSOLUTE_X) = MOUSE_ABSOLUTE_X then
       begin
        ScalingX:=MouseData.MaximumX / ScreenWidth;
        if ScalingX <= 0 then ScalingX:=1.0;

        CursorX:=Trunc(MouseData.OffsetX / ScalingX);
       end
      else
       begin
        CursorX:=CursorX + MouseData.OffsetX;
       end;
      if CursorX < 0 then CursorX:=0;
      if CursorX > (ScreenWidth - 1) then CursorX:=ScreenWidth - 1;

      if (MouseData.Buttons and MOUSE_ABSOLUTE_Y) = MOUSE_ABSOLUTE_Y then
       begin
        ScalingY:=MouseData.MaximumY / ScreenHeight;
        if ScalingY <= 0 then ScalingY:=1.0;

        CursorY:=Trunc(MouseData.OffsetY / ScalingY);
       end
      else
       begin
        CursorY:=CursorY + MouseData.OffsetY;
       end;
      if CursorY < 0 then CursorY:=0;
      if CursorY > (ScreenHeight - 1) then CursorY:=ScreenHeight - 1;

      FramebufferDeviceUpdateCursor(FramebufferDevice,True,CursorX,CursorY,False);
     end
    else
     begin
      ConsoleWindowWriteLn(Handle2,'An error occurred reading the mouse, trying again');
     end;
   end;
end.


Tell me what else you need to do to help finish the work on the driver.

Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests