How to use USB OTG as gadget HID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use USB OTG as gadget HID

2,564 Views
chandraevolute
Contributor V

Hi, 

I am using one USB OTG port as device. I can confirm that the OTG port is working when using Mfgtool for flashing images.

When building the kernel the USB gadget can be configured to only Gadget mass storage and UTP. 

After flashing the images and booting, I want the same port to be used as either gadget serial or gadget HID. But we configured the USB as gadget mass storage. If I give other option such as CONFIG_GADGET_SERIAL or HID I am unable to flash the images. 

What is the right option to make it as GADGET MASS STORAGE and GADGET SERIAL?

I tried building the kernel and modules in separate builds, but when I try to do modprobe g_serial

 modprobe g_serial
modprobe: can't load module libcomposite (kernel/drivers/usb/gadget/g_serial.ko): invalid module format 

I am getting this error.

Labels (3)
0 Kudos
5 Replies

1,280 Views
igorpadykov
NXP Employee
NXP Employee

Hi chandra

please try usb hid examples in imx-test (../mxc_usb_test) and description

in attached Linux Manual Chapter 39 CHIPIDEA USB Driver

imx-test
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,280 Views
chandraevolute
Contributor V

Hi igorpadykov

I am able to run modeprobe g_serial and able to see the serial device in /dev folder.

I want to change the baud rate of the same, if  I give the below commands it is throwing error

stty -F /dev/ttyGS0 921600
stty: /dev/ttyGS0: cannot perform all requested operations

Is there any way to change the baudrate. Here the default baudrate is 9600. I want to operate at 921600 bps. 

0 Kudos

1,280 Views
igorpadykov
NXP Employee
NXP Employee

Hi chandra

 

is it working for other baudrates, like 19200, e.t.c.

 

Best regards
igor

0 Kudos

1,280 Views
chandraevolute
Contributor V

Hi igorpadykov

Is there any way  to check whether the g_serial device is connected or not??

0 Kudos

1,280 Views
chandraevolute
Contributor V

The baud rate is not changing to other values.Just only 9600

0 Kudos