AnsweredAssumed Answered

USB gadget serial hotplug

Question asked by Coiln Park on Sep 5, 2017
Latest reply on Sep 7, 2017 by Coiln Park

Hi~

I am using kernel version 4.1.15.2.0.1 with imx6solosabresd custom board.

Until now, I could use USB gadget serial very well.. but I am faced with new usb issue.

while using usb gadget serial, if I pull the usb cable out from the usb port, USB will not recognize that usb cable is not connected.

 

As below, I am using the below modules and fsl-imx-fb image.

u_serial.ko

usb_f_acm.ko

usb_f_obex.ko

usb_f_serial.ko

g_serial.ko

 

I found the solution as below.

1. After disconnecting the usb cable, I did "rmmod g_serial.ko".

2. After connecting the usb cable, I did "insmod g_serial.ko"

 

But, I would like the custom board to do insmod and rmmod itself when the usb cable is connected or not.

So, I made udev rule in /etc/udev/rules.d/10-local.rules

ACTION=="add", KERNEL=="ttyGS0", SUBSYSTEM=="tty", RUN+="/etc/udev/rules.d/automount.sh"

ACTION=="remove", KERNEL=="ttyGS0", SUBSYSTEM=="tty", RUN+="/etc/udev/rules.d/autounmount.sh"

 

in automount.sh file,

insmod g_serial.ko

 

in autounmount.sh file,

rmmod g_serial.ko

 

But, it is not working. ㅜ.ㅜ

I need your help..

 

Best regards,

Colin Park

Outcomes