Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Raspberry Pi4 and USB joystick - Support HID devices plugged into OTG hubs: (1 Item)
   
Raspberry Pi4 and USB joystick - Support HID devices plugged into OTG hubs  
Hi 

I want to connect a USB joystick (GWFSM003 by GWS) to a Raspberry pi4 and read the data of the joystick. 
I am using Momentics IDE Version: 7.1.0 and set the target as aarch64le. 
From QNX SDP 7.1: Raspberry Pi 4 Board (http://www.qnx.com/download/group.html?programid=48507 ), I want to use “USB 
OTG host controller” and I made sure that “pci-server” is running before USB driver. In my “rpi4.build” I have the 
following lines
…
## PCI Server: necessary to run this before USB driver
    #######################################################################
    display_msg Starting PCI Server...
    pci-server -c --bus-scan-limit=1
    waitfor /dev/pci 4

    #######################################################################
    ## USB OTG Host Controller driver
    #######################################################################
    sh /proc/boot/usb_start.sh
    mount -t dos /dev/hd0t11 /fs/ub0
….
###########################################################################
## USB-OTG
###########################################################################
/sbin/io-usb-otg=io-usb-otg
/sbin/usb=usb

usb_start.sh {
    #!/bin/sh
    vl805_version=`pci-tool -d 1:0:0 --read="CFG:0x50"`
    version=`echo $vl805_version | sed -e "s/B1:D0:F0 CFG \\[50] //g"`

    if [ $version == "00000000" ]; then
        echo "Inform vc to load vl805 firmware"
        mbox-bcm2711 notifyxhcireset=0x100000 2> /dev/null
    fi
    echo "Starting USB xHCI controller in the host mode (/dev/usb/*)..."
    io-usb-otg -t memory=below1G -d bcm2711-xhci pindex=0,memory=below1G

    ##### 
    io-usb-otg -d hcd-bcm2711-xhci
    #####
    
    waitfor /dev/usb/io-usb-otg 4
    waitfor /dev/usb/devu-hcd-bcm2711-xhci.so 4 4
    #####
	devb-umass cam pnp mem name=below1G disk name=umass	
    #####
}
….
I also added “hiddi” library, and I can build my “rpi4.build” without any error/warning and when I copy the “ifs-
rpi4.bin” into the SD card and turn on Raspberry Pi everything seems to be working. However, the joystick LED doesn’t 
turn on. Moreover, when I connect to Raspberry pi4 using “telent <ip_of_raspberr>” and use “usb” command, I will see
 the joystick (I know the Vendor(0x0e8f) and Product(0x0003)). 
However, when I run my code to receive the data of joystick I will get 

“cjoystick : Connection with HID driver failed: No such file or directory
Invalid device instance.”

I also put my files.
I appreciate if you can help me and address what is the problem and how I can solve it.
Attachment: Text cjoystick.h 1.69 KB Text joystick.cpp 855 bytes Text cjoystick.cpp 9.71 KB Text rpi4.build 21.78 KB