• Resolved

Linux/AM5728: DLP module not recognized

Prodigy 130 points

Replies: 13

Views: 396

Part Number: AM5728

Tool/software: Linux

Connect dlp4500 module with am5728 evm board, write test function directly to verify that dlp4500 module can be recognized, fail to call hid_open (0x04510x6401, null) or hid_enumerate (0x04551, 0x6401). Is there no dlp driver code on the am5728 evm board? Where can I find the driver code for dlp4500, thank you!

  • When connecting the dlp module via am5728 evm usb, the following information is printed on 5728 evm:

    root@am57xx-evm:~# [ 3935.038160] usb 1-1.2: new full-speed USB device number 5 using xhci-hcd
    [ 3935.145094] usb 1-1.2: New USB device found, idVendor=0451, idProduct=6401
    [ 3935.152032] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 3935.159529] usb 1-1.2: Product: DLPC350
    [ 3935.163392] usb 1-1.2: Manufacturer: Texas Instruments Inc.
    [ 3935.169132] usb 1-1.2: SerialNumber: LCR2
    [ 3935.190619] hid-generic 0003:0451:6401.0005: hiddev0: USB HID v1.11 Device [Texas Instruments Inc. DLPC350] on usb-xhci-hcd.1.auto-1.2/input0
    [ 3935.210376] input: Texas Instruments Inc. DLPC350 as /devices/platform/44000000.ocp/48880000.omap_dwc3_1/48890000.usb/xhci-hcd.1.auto/usb1/1-1/1-1.2/1-1.2:1.1/0003:0451:6401.0006/input/input5
    [ 3935.278477] hid-generic 0003:0451:6401.0006: input: USB HID v1.11 Keyboard [Texas Instruments Inc. DLPC350] on usb-xhci-hcd.1.auto-1.2/input1

    root@am57xx-evm:~#

    dlp is identified as the USB HID v1.1 keyboard, and the obvious 5728 core drive is incorrect。

    Connect dlp4500 module with am5728 evm board, write test function directly to verify that dlp4500 module can be recognized, fail to call hid_open (0x04510x6401, null) or hid_enumerate (0x04551, 0x6401)

    root@am57xx-evm:~# ./hid_test_1
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    unable to open device
    Unable to read manufacturer string
    Manufacturer String:
    Unable to read product string
    Product String:
    Unable to read serial number string
    Serial Number String: (0)
    Unable to read indexed string 1
    Indexed String 1:
    ioctl (SFEATURE): Bad file descriptor
    Unable to send a feature report.

    the test code: 

    #include <stdio.h>
    #include <wchar.h>
    #include <string.h>
    #include <stdlib.h>
    #include "hidapi.h"
    
    
    // Headers needed for sleeping.
    #include <unistd.h>
    
    
    
    
    int main(int argc, char* argv[])
    {
    	int res;
    	unsigned char buf[256];
    	#define MAX_STR 255
    	wchar_t wstr[MAX_STR];
    	hid_device *handle;
            struct hid_device_info *hid_info;
    	int i;
    
    
    
    
    	struct hid_device_info *devs, *cur_dev;
    	
    	if (hid_init())
    		return -1;
    
    
    	devs = hid_enumerate(0x0, 0x0);
    	cur_dev = devs;	
    	while (cur_dev) {
    		printf("Device Found\n  type: %04hx %04hx\n  path: %s\n  serial_number: %ls", cur_dev->vendor_id, cur_dev->product_id, cur_dev->path, cur_dev->serial_number);
    		printf("\n");
    		printf("  Manufacturer: %ls\n", cur_dev->manufacturer_string);
    		printf("  Product:      %ls\n", cur_dev->product_string);
    		printf("  Release:      %hx\n", cur_dev->release_number);
    		printf("  Interface:    %d\n",  cur_dev->interface_number);
    		printf("\n");
    		cur_dev = cur_dev->next;
    	}
    	hid_free_enumeration(devs);
    
    
    	// Set up the command buffer.
    	memset(buf,0x00,sizeof(buf));
    	buf[0] = 0x01;
    	buf[1] = 0x81;
    	
    
    
    	// Open the device using the VID, PID,
    	// and optionally the Serial number.
    //modify by qkl
    #if 0
    	handle = hid_open(0x0451, 0x6401, NULL);
    	if (!handle) {
    		printf("unable to open device\n");
     		return 1;
    	}
    #endif
    
    
    for (i = 0; i < 10; i++)
    {
    	//handle = hid_open(0x0451, 0x6401, NULL);
            hid_info = hid_enumerate(0x0451, 0x6401);
    	if (!hid_info) {
    		printf("unable to open device\n");
                    sleep(2);
     		continue;
    	}
            else
           {
             printf("hid open dlp ok!\n");
             break;
           }
    }
    
    
    
    
    	// Read the Manufacturer String
    	wstr[0] = 0x0000;
    	res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
    	if (res < 0)
    		printf("Unable to read manufacturer string\n");
    	printf("Manufacturer String: %ls\n", wstr);
    
    
    	// Read the Product String
    	wstr[0] = 0x0000;
    	res = hid_get_product_string(handle, wstr, MAX_STR);
    	if (res < 0)
    		printf("Unable to read product string\n");
    	printf("Product String: %ls\n", wstr);
    
    
    	// Read the Serial Number String
    	wstr[0] = 0x0000;
    	res = hid_get_serial_number_string(handle, wstr, MAX_STR);
    	if (res < 0)
    		printf("Unable to read serial number string\n");
    	printf("Serial Number String: (%d) %ls", wstr[0], wstr);
    	printf("\n");
    
    
    	// Read Indexed String 1
    	wstr[0] = 0x0000;
    	res = hid_get_indexed_string(handle, 1, wstr, MAX_STR);
    	if (res < 0)
    		printf("Unable to read indexed string 1\n");
    	printf("Indexed String 1: %ls\n", wstr);
    
    
    	// Set the hid_read() function to be non-blocking.
    	hid_set_nonblocking(handle, 1);
    	
    	// Try to read from the device. There shoud be no
    	// data here, but execution should not block.
    	res = hid_read(handle, buf, 17);
    
    
    	// Send a Feature Report to the device
    	buf[0] = 0x2;
    	buf[1] = 0xa0;
    	buf[2] = 0x0a;
    	buf[3] = 0x00;
    	buf[4] = 0x00;
    	res = hid_send_feature_report(handle, buf, 17);
    	if (res < 0) {
    		printf("Unable to send a feature report.\n");
    	}
    
    
    	memset(buf,0,sizeof(buf));
    
    
    	// Read a Feature Report from the device
    	buf[0] = 0x2;
    	res = hid_get_feature_report(handle, buf, sizeof(buf));
    	if (res < 0) {
    		printf("Unable to get a feature report.\n");
    		printf("%ls", hid_error(handle));
    	}
    	else {
    		// Print out the returned buffer.
    		printf("Feature Report\n   ");
    		for (i = 0; i < res; i++)
    			printf("%02hhx ", buf[i]);
    		printf("\n");
    	}
    
    
    	memset(buf,0,sizeof(buf));
    
    
    	// Toggle LED (cmd 0x80). The first byte is the report number (0x1).
    	buf[0] = 0x1;
    	buf[1] = 0x80;
    	res = hid_write(handle, buf, 17);
    	if (res < 0) {
    		printf("Unable to write()\n");
    		printf("Error: %ls\n", hid_error(handle));
    	}
    	
    
    
    	// Request state (cmd 0x81). The first byte is the report number (0x1).
    	buf[0] = 0x1;
    	buf[1] = 0x81;
    	hid_write(handle, buf, 17);
    	if (res < 0)
    		printf("Unable to write() (2)\n");
    
    
    	// Read requested state. hid_read() has been set to be
    	// non-blocking by the call to hid_set_nonblocking() above.
    	// This loop demonstrates the non-blocking nature of hid_read().
    	res = 0;
    	while (res == 0) {
    		res = hid_read(handle, buf, sizeof(buf));
    		if (res == 0)
    			printf("waiting...\n");
    		if (res < 0)
    			printf("Unable to read()\n");
    		#ifdef WIN32
    		Sleep(500);
    		#else
    		usleep(500*1000);
    		#endif
    	}
    
    
    	printf("Data read:\n   ");
    	// Print out the returned buffer.
    	for (i = 0; i < res; i++)
    		printf("%02hhx ", buf[i]);
    	printf("\n");
    
    
    	hid_close(handle);
    
    
    	/* Free static HIDAPI objects. */
    	hid_exit();
    
    
    	return 0;
    }
  • In reply to ccsq ccsq:

    Hello ccsq,

    Is this the same as your previous question? Are you using the USB HID libraries? Is this your custom code? Also, have you been able to connect the DLP4500EVM to the PC using our GUI?

    Thanks,
    Kyle

  • In reply to Kyle Rakos:

    Yes, as with the previous problem, the dlp module cannot be recognized on am5728 board of Chuanglong.
    because the call to hid_open () failed.  Test function uses hidtest in hidapi-master open source。
     Running the test function on the ti am5728 evm board failed to call hid_open ().
     So I  ask if the hid driver on the am5728 board supports dlp,
     If not, where can I download the dlp driver code on the 5728 board?
     If the driver is ok, is it the library? Usb1.0 and udev libraries are currently used.
     Dlp4500 module: using GUI in both windowns and ubuntu can be correctly identified.
     The written hidtest can also read the dlp information correctly under ubuntu, as follows:
    [root@tl hid_test]# ./hid_test_u
    Device Found
      type: 0e0f 0003
      path: /dev/hidraw0
      serial_number:
      Manufacturer: VMware
      Product:      VMware Virtual USB Mouse
      Release:      103
      Interface:    0

    Device Found
      type: 0451 6401
      path: /dev/hidraw1
      serial_number: LCR2
      Manufacturer: Texas Instruments Inc.
      Product:      DLPC350
      Release:      0
      Interface:    0

    Device Found
      type: 0451 6401
      path: /dev/hidraw2
      serial_number: LCR2
      Manufacturer: Texas Instruments Inc.
      Product:      DLPC350
      Release:      0
      Interface:    1

    hid open dlp ok!
    Manufacturer String: Texas Instruments Inc.
    Product String: DLPC350
    Serial Number String: (76) LCR2
    Unable to read indexed string 1
    Indexed String 1:
    Feature Report
      
    waiting...
    waiting...
    waiting...
    waiting...

  • In reply to ccsq ccsq:

    Hello,

    Let us look into this a bit more. However, have you confirmed with the HID driver they support this platform? It's on Github at https://github.com/signal11/hidapi.

    Thanks,

    Kyle

  • In reply to Kyle Rakos:

    Hi Kyle,

         Okay, thank you very much! The HIDAPI used in GUI is an application, which requires the support of the kernel, but the driver of TIDLP4500 cannot be found in the kernel? But from the routine that TI5728EVM board connects with DLP4500, you can see that the two can communicate. Can you help verify the environment. Thank you!

  • In reply to ccsq ccsq:

    The previous problem mentioned that when the dlp4500 module is connected to the am5728 single board through the USB port, the am5728 single board can not recognize the dlp module because the application program of the am5728 single board fails to call the hid_open () function.

    Then analyzing the HIDAPI code, the hid_open () function is implemented by calling the hid_enumerate () function. hid_enumerate () needs to open a device of type hidraw, and when the dlp module is connected to am5728 through the USB port, am5728 recognizes the dlp module as a hiddev0, which leads to the failure of the program execution. However, the dlp module is inserted into the Ubuntu, and the dlp module can be correctly identified as the hidraw device on the Ubuntu, and the correct connection can be made.

     

    What changes need to be made on the am5728 evm board in order to identify the dlp module as a hidraw device?

     

    The dlp4500 module is connected to the am5728 evm veneer through the USB port, and the test process is as follows:

    root@am57xx-evm:~# lsusb

    Bus 001 Device 004: ID 0451:6401 Texas Instruments, Inc.  ----- can recognize the dlp module

    Bus 002 Device 002: ID 0451:8140 Texas Instruments, Inc.

    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

    Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc.

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    root@am57xx-evm:~#

    root@am57xx-evm:~#

    root@am57xx-evm:~# ls /dev | grep usb            

    usb

    root@am57xx-evm:~# ls /dev | grep hid

    root@am57xx-evm:~# ls /dev/usb   ----- The dlp module can be recognized, but it is identified as a hiddev0 device

    hiddev0

    root@am57xx-evm:~#

    root@am57xx-evm:~#

    root@am57xx-evm:~#

    root@am57xx-evm:~# cat /proc/bus/input/devices

    I: Bus=0003 Vendor=0451 Product=6401 Version=0111

    N: Name="Texas Instruments Inc. DLPC350"

    P: Phys=usb-xhci-hcd.1.auto-1.2/input1

    S: Sysfs=/devices/platform/44000000.ocp/48880000.omap_dwc3_1/48890000.usb/xhci-hcd.1.auto/usb1/1-1/1-1.2/1-1.2:1.1/0003:0451:6401.0004/input/input4

    U: Uniq=LCR2

    H: Handlers=sysrq kbd mouse1 event3

    B: PROP=0

    B: EV=120017

    B: KEY=1f0000 0 0 800000 0 e0b0ffdf 1cfffff ffffffff fffffffe

    B: REL=3

    B: MSC=10

    B: LED=1f

     

    root@am57xx-evm:~# ./hid_dev_test ----- Write test function, open hiddev0 device, can open dlp device.

    /dev/usb/hiddev0 infor

    HIDIOCGVERSION: 1.4

    HIDIOCGDEVINFO: bustype=3 busnum=1 devnum=4 ifnum=0

            vendor=0x0451 product=0x6401 version=0x0000

            num_applications=1

    HIDIOCGNAME: Texas Instruments Inc. DLPC350

    Reports of type Input (1):

     Report id: 0 (1 fields)

     Field: 0: app: ff00ff00 phys 0000 flags 0 (64 usages) unit 0 exp 0

    root@am57xx-evm:~# ./arm_hid_test ----- Write test function, open dlp device through hid_open(0x0451, 0x6401, NULL), and cannot open dlp device.

    unable to open device

    unable to open device

    unable to open device

    The dlp4500 module is connected to the ubuntu through the USB port, and the test process is as follows:

    [root@tl hid_test]# lsusb

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    Bus 002 Device 004: ID 0451:6401 Texas Instruments, Inc. ----- can recognize the dlp module

    Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

    Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse

    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    [root@tl hid_test]#

    [root@tl hid_test]# cat /proc/bus/input/devices

    I: Bus=0003 Vendor=0451 Product=6401 Version=0111

    N: Name="Texas Instruments Inc. DLPC350"

    P: Phys=usb-0000:02:00.0-2.1/input1

    S: Sysfs=/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.1/0003:0451:6401.0003/input/input5

    U: Uniq=LCR2

    H: Handlers=sysrq kbd mouse2 event4

    B: PROP=0

    B: EV=120017

    B: KEY=1f0000 0 80000000000000 e0b0ffdf01cfffff fffffffffffffffe

    B: REL=3

    B: MSC=10

    B: LED=1f

    [root@tl hid_test]# ls /dev/usb ----- The dlp module can be recognized, but it is identified as a hiddev0 device

     

    hiddev0

    [root@tl hid_test]# ls /dev | grep usb

    usb

    [root@tl hid_test]#

    [root@tl hid_test]# ls /dev | grep hid ----- the dlp module can be identified while also identified as the hiraw1 and hiraw2 devices

    hidraw0

    hidraw1

    hidraw2

    uhid

    [root@tl hid_test]# ./hid_test ---- The test function is written and the dlp device is opened by the hid _ open (0x0451, 0x6401, NULL) and the dlp device can be opened.

     

    hid_init ok

    udev_new ok

    udev_enumerate_add_match_subsystem ok

    udev_enumerate_get_list_entry ok

    qkl vendor_id=0, product_id = 0

    qkl vendor_id=0, product_id = 0

    qkl vendor_id=0, product_id = 0

    Device Found

    type: 0e0f 0003

    path: /dev/hidraw0

    serial_number:

    Manufacturer: VMware

    Product:     VMware Virtual USB Mouse

    Release:     103

    Interface:   0

     

    Device Found

    type: 0451 6401

    path: /dev/hidraw1

    serial_number: LCR2

    Manufacturer: Texas Instruments Inc.

    Product:     DLPC350

    Release:     0

    Interface:   0

     

    Device Found

    type: 0451 6401

    path: /dev/hidraw2

    serial_number: LCR2

    Manufacturer: Texas Instruments Inc.

    Product:     DLPC350

    Release:     0

    Interface:   1

     

    no device

    hid_init ok

    udev_new ok

    udev_enumerate_add_match_subsystem ok

    udev_enumerate_get_list_entry ok

    qkl vendor_id=451, product_id = 6401

    qkl vendor_id=451, product_id = 6401

    dlp device is ok

    hid_init ok

    udev_new ok

    udev_enumerate_add_match_subsystem ok

    udev_enumerate_get_list_entry ok

    qkl vendor_id=451, product_id = 6401

    qkl vendor_id=451, product_id = 6401

    hid open dlp ok!

    Manufacturer String: Texas Instruments Inc.

    Product String: DLPC350

    Serial Number String: (76) LCR2

    Unable to read indexed string 1

    Indexed String 1:

    Feature Report

    [root@tl app_test]# ./hiddev ----- Write test function, open hiddev0 device, can open dlp device.

     

    /dev/usb/hiddev0 infor

    HIDIOCGVERSION: 1.4

    HIDIOCGDEVINFO: bustype=3 busnum=2 devnum=4 ifnum=0

        vendor=0x0451 product=0x6401 version=0x0000

        num_applications=1

    HIDIOCGNAME: Texas Instruments Inc. DLPC350

    Reports of type Input (1):

  • In reply to ccsq ccsq:

    Hi ccsq, 

    Kindly wait for a few more days, we'll get back to you soon. 

    Thanks & Regards

    Hirak.

  • In reply to Hirak Biswas:

    Hi,

    We recently had issues with connecting on Winodws 10 with the GUI as hid_open() was filing sometimes after enumeration. So we had to modify the code and use the hid_open_path() to connect to the hardware, attaching code snapshot - you may want to check if it helps fixing the issue -

    int DLPC350_USB_Open()
    {
        // Open the device using the VID, PID,
        struct hid_device_info *hid_info;
        hid_info = hid_enumerate(MY_VID, MY_PID);
        if(hid_info == NULL)
        {
            USBConnected = 0;
            return -1;
        }
    
        DeviceHandle = NULL;
    
        if(0 == hid_info->interface_number)
        {
            DeviceHandle = hid_open_path(hid_info->path);
        }
        else
        {
            struct hid_device_info *hid_next_info = hid_info->next;
    
            if(hid_next_info != NULL)
            {
                DeviceHandle = hid_open_path(hid_next_info->path);
            }
        }
    
        if(DeviceHandle == NULL)
        {
            USBConnected = 0;
            return -1;
        }
    
        USBConnected = 1;
    
        return 0;
    }

    Regards,

    Sanjeev

    If a post answers your question, please click on "Verify Answer" button

  • In reply to Sanjeev:

    sorry, I used E2E the first time, I don't know the process yet. I understand until today after tony.tang explained it.

    Sanjeev recommends modifying the implementation of the DLPC350_USB_Open () function, which does not solve this problem.
    Because the hid_open () implementation also calls the hid_enumerate () function.
    My question is:

    Then analyzing the HIDAPI code, the hid_open () function is implemented by calling the hid_enumerate () function. hid_enumerate () needs to open a device of type hidraw, and when the dlp module is connected to am5728 through the USB port, am5728 recognizes the dlp module as a hiddev0, which leads to the failure of the program execution. However, the dlp module is inserted into the Ubuntu, and the dlp module can be correctly identified as the hidraw device on the Ubuntu, and the correct connection can be made.

    What changes need to be made on the am5728 evm board in order to identify the dlp module as a hidraw device?

     

     

  • In reply to ccsq ccsq:

    Hi ccsq ccsq,

    I got your point, on am5728 evm it is recognized as hiddevo instead of hidraw device (detects on Ubuntu). This is question to the am5728 evm, inside DLP we don't have expertise on the kernel on the am5728 evm, let me move this thread to other forum, kindly wait for response.

    Regards,

    Sanjeev

    If a post answers your question, please click on "Verify Answer" button