Interested?

GT-1P Communication on Linux

Introduction

This describes USB communication methods for the GT-1P modules using Linux:

USB Information

GTWV050VHB00PGT800X480A-1303PGT1280X800A-1303P
Vendor ID0x0EDA0x0EDA0x0EDA
Product ID0x012DD0x012DE0x012DF
EP IN Address0x810x810x81
EP OUT Address0x020x020x02
Device and Interface Class0xFF (Vendor-specific)0xFF (Vendor-specific)0xFF (Vendor-specific)

Endpoint Information

EndpointTypeMaximum Packet Size
Endpoint 0ControlFull speed: 64 bytes
Endpoint 1Bulk INFull speed: 64 bytes
Endpoint 2Bulk OUTFull speed: 64 bytes
Endpoint 3Interrupt INFull speed: 18 bytes

This device has a single configuration with a single interface and two endpoints for data transfer.

libusb.h – USB Communication Library

For USB communication, we have used libusb.h. This is an open source library that lets users communicate with generic USB devices from user-space.

Website: https://libusb.info/

Installation: sudo apt-get install libusb-1.0-0-dev

This library can be used to open the GT-1P device and perform bulk transfers to send display commands and read responses back from the module.

The following functions are used to establish a test connection with a GT-1P module:

  1. libusb_init(NULL);
    1. This function initializes libusb with the default context.
  2. libusb_open_device_with_vid_pid(NULL, 0x0EDA, 0x12DE);
    1. This function opens a device with a specific vendor and product ID. This example will establish a connection with a GT800X480A-1303P module with the default context.
    2. This function returns the libusb_device_handle, which, for this example, we will call devh.
  3. libusb_claim_interface(devh, 1);
    1. This function claims the desired interface to communicate with. When communicating with the GT-1P module, we need to claim interface 0.

The libusb_bulk_transfer() function is used to write and read data to and from the GT-1P module using libusb.h:

  1. To write a byte of data, use the module’s EP OUT address (0x02).
    1. libusb_bulk_transfer(devh, 0x02, data_byte, 1, &actual_length, timeout);
      1. timeout = 0
  2. To read a byte of data, use the module’s EP IN address (0x81).
    1. libusb_bulk_transfer(devh, 0x81, read_data_array, number_bytes_to_read, &actual_length, timeout);
      1. timeout = 1000

The following functions are used to close and release a fully established USB connection to a GT-CP module using libusb.h:

  1. libusb_release_interface(devh, 1);
    1. This function releases the interface that was previously claimed.
  2. libusb_close(devh);
    1. This function closes the specified device handle.
  3. libusb_exit(NULL);
    1. This function will deinitialize libusb.

 

Brightness Adjustment Example Program Using libusb.h

The example program (main.c) changes the connected display’s brightness based on the user’s terminal arguments. This program utilizes “GT1P_USB_LIB.c” (a libusb wrapper) and “GT1P.c” (a GT-1P command library). The commands found in “GT1P.c” directly relate to the commands found in the GT-1P datasheet.

Run “make” before executing the program with “sudo ./libusb_example <brightness_value> <module_PN>”.

<brightness_value> is the desired brightness percentage ranging from 1 – 100%.

<module_PN> is the connected module’s product number (GTWV050VHB00P, GT800X480A-1303P, or GT1280X800A-1303P).

Once the program is executed, the back-light on the GT-1P module should change based on the desired brightness. (Make sure the module is receiving video signal so you can notice a brightness change.)

If “sudo ./libusb_example 100 GT800X480A-1303P” is used, then the module’s brightness should look like this:

If “sudo ./libusb_example 10 GT800X480A-1303P” is used, then the module’s brightness should look like this:

This brightness example also applies to the generic USB driver example program. (except for the display PN parameter)

Generic USB Driver

When connected to a Linux PC, a GT-1P module does not automatically get assigned to a USB driver.

To attach a generic USB driver to a GT800X480A-1303P module, use:

  • modprobe -r usbserial
  • modprobe usbserial vendor=0x0EDA product=0x12DE

Once a generic USB driver is attached, the GT-1P module is not associated with a device path like /dev/ttyUSB0. You can check your exact device path with the dmesg terminal command after plugging the module into your Linux PC. Look for the “generic converter now attached to ttyUSBX” message.

NOTE: A generic USB driver is intended for evaluation purposes only.

 

Brightness Adjustment Example Program Using Generic USB Driver

The example program (main.c) changes the module’s brightness using terminal parameters and a generic USB driver. The program opens “/dev/ttyUSB0” and write the brightness change command to the device path.

Run “make” before executing the program with “sudo ./generic_example <brightness_value>”.

<brightness_value> is the desired brightness percentage ranging from 1 – 100%.

Once the program is executed, the back-light on the GT-1P module should change based on the desired brightness. (Make sure the module is receiving video signal so you can notice a brightness change.)

Download Example Code

Disclaimer

The software examples above are provided “AS-IS”. We are not responsible for any issues that may occur while using this program.
All software (code and/or examples) on this page is provided for demonstration and evaluation purposes only.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.