在Amlogic S905X5M Android14 平台上移植移远EC25 4G模组1:内核修改
调试步骤:
1.确保硬件能够正常工作:
使用命令lsusb能够看到USB VIDPID
2.能够生成ttyUSB0~ttyUSB2端口:
/common/common14-5.15/common
diff --git a/android/abi_gki_aarch64_amlogic b/android/abi_gki_aarch64_amlogic
index 39ba801ff748…b8d2c72fee0c 100644
— a/android/abi_gki_aarch64_amlogic
+++ b/android/abi_gki_aarch64_amlogic
@@ -2578,3 +2578,6 @@
aml-erofs.ko
register_sysctl
+
-
usb_serial_port_softint
-
arp_create
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index f21fd809e44f…1ca94ff17055 100644
— a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1895,6 +1895,7 @@ static const struct usb_device_id acm_ids[] = {
/* Support for Owen devices /
{ USB_DEVICE(0x03eb, 0x0030), }, / Owen SI30 */ -
{ USB_DEVICE(0x2949, 0x8700), }, /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
#if IS_ENABLED(CONFIG_INPUT_IMS_PCU)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 116d6457d04a…d41cc011749d 100644
— a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2339,7 +2339,7 @@ static void announce_device(struct usb_device *udev)
le16_to_cpu(udev->descriptor.idProduct),
bcdDevice >> 8, bcdDevice & 0xff);
dev_info(&udev->dev,
-
"New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
-
"----------------New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n", udev->descriptor.iManufacturer, udev->descriptor.iProduct, udev->descriptor.iSerialNumber);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index c0a0cca65437…6c319116fbb9 100644
— a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -632,6 +632,24 @@ static void option_instat_callback(struct urb *urb);
static const struct usb_device_id option_ids[] = {
+#if 1 //Added by Quectel
-
{ USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
-
{ USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
-
{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25 */
-
{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
-
{ USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
-
{ USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
-
{ USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
-
{ USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
-
{ USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
-
{ USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */
-
{ USB_DEVICE(0x2C7C, 0x0512) }, /* Quectel EG12/EG18 */
-
{ USB_DEVICE(0x2C7C, 0x6026) }, /* Quectel EC200 */
-
{ USB_DEVICE(0x2C7C, 0x6120) }, /* Quectel UC200 */
-
{ USB_DEVICE(0x2C7C, 0x6000) }, /* Quectel EC200/UC200 */
-
{ USB_DEVICE(0x2C7C, 0x6002) }, /* Quectel EC200S-CN */
-
{ USB_DEVICE(0x2C7C, 0x6005) },
+#endif
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
@@ -2315,6 +2333,9 @@ static struct usb_serial_driver option_1port_device = {
#ifdef CONFIG_PM
.suspend = usb_wwan_suspend,
.resume = usb_wwan_resume,
+#if 0//add by Quectel
-
.reset_resume = usb_wwan_resume,
+#endif
#endif
};
@@ -2338,10 +2359,14 @@ static int option_probe(struct usb_serial *serial,
struct usb_interface_descriptor *iface_desc =
&serial->interface->cur_altsetting->desc;
unsigned long device_flags = id->driver_info;
-
printk("[probe debug]check idVendor is %d and idProduct is %d.\n", id->idVendor, id->idProduct);
- printk(“[probe debug]device_flags is %lu.\n”, device_flags);
-
//msleep(3000); /* Never bind to the CD-Rom emulation interface */ if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE) return -ENODEV;
-
printk("[probe debug]check point1.\n"); /* * Don't bind reserved interfaces (like network ones) which often have
@@ -2350,6 +2375,7 @@ static int option_probe(struct usb_serial *serial,
*/
if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber))
return -ENODEV;
-
printk("[probe debug]check point2.\n"); /* * Allow matching on bNumEndpoints for devices whose interface numbers
@@ -2357,7 +2383,47 @@ static int option_probe(struct usb_serial *serial,
*/
if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2)
return -ENODEV;
-
printk("[probe debug]check point3.\n");
+#if 1 //Added by Quectel
-
//Quectel UC20's interface 4 can be used as USB Network device
-
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)
-
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
-
return -ENODEV;
-
//Quectel EC20's interface 4 can be used as USB Network device
-
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)
-
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
-
return -ENODEV;
-
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
-
//printk("check serial dev is Quectl EC2x.\n");
-
__u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
-
struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
-
printk("check serial dev is Quectl EC2x.\n");
-
if(intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42){
-
//ECM,RNDIS,NCM,MBIM,ACM,UAC,ADB
-
return -ENODEV;
-
}
-
printk("[probe debug]check point4.\n");
-
if((idProduct&0xF000) == 0x0000){
-
//DMD interface 4 is QMI
-
if(intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3 && intf->bInterfaceSubClass == 0xFF &&
-
intf->bInterfaceProtocol == 0xFF)
-
return -ENODEV;
-
}
-
printk("[probe debug]check point5.\n");
-
//Quectel EC200&UC200's interface 0 can be used as USB Network device (ecm, rndis)
-
if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF)
-
return -ENODEV;
-
//Quectel EC25&EC21&EG91&EG95&EG06&EP06&EM06&BG96&AG35&EG12&EG18's interface 4 can be used as USB network device (qmi,ecm,mbim)
-
if ((idProduct != 0x6026 && idProduct != 0x6126 && idProduct != 0x6002)
-
&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
-
return -ENODEV;
-
}
+#endif
-
printk("[probe debug]tty should be register.\n"); /* Store the device flags so we can use them during attach. */ usb_set_serial_data(serial, (void *)device_flags);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 703a9c563557…70abe3fb0e60 100644
— a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -63,7 +63,7 @@ static const struct usb_device_id id_table[] = {
{DEVICE_G1K(0x05c6, 0x9202)}, /* Generic Gobi Modem device /
{DEVICE_G1K(0x05c6, 0x9203)}, / Generic Gobi Modem device /
{DEVICE_G1K(0x05c6, 0x9222)}, / Generic Gobi Modem device */
-
{DEVICE_G1K(0x05c6, 0x9008)}, /* Generic Gobi QDL device */
+// {DEVICE_G1K(0x05c6, 0x9008)}, /* Generic Gobi QDL device /
{DEVICE_G1K(0x05c6, 0x9009)}, / Generic Gobi Modem device /
{DEVICE_G1K(0x05c6, 0x9201)}, / Generic Gobi QDL device /
{DEVICE_G1K(0x05c6, 0x9221)}, / Generic Gobi QDL device /
@@ -88,7 +88,7 @@ static const struct usb_device_id id_table[] = {
{USB_DEVICE(0x03f0, 0x241d)}, / HP Gobi 2000 QDL device (VP412) /
{USB_DEVICE(0x03f0, 0x251d)}, / HP Gobi 2000 Modem device (VP412) /
{USB_DEVICE(0x05c6, 0x9214)}, / Acer Gobi 2000 QDL device (VP413) */
-
{USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
-
//{USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ {USB_DEVICE(0x05c6, 0x9264)}, /* Asus Gobi 2000 QDL device (VR305) */ {USB_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {USB_DEVICE(0x05c6, 0x9234)}, /* Top Global Gobi 2000 QDL device (VR306) */
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index f21f25a8cf6f…a3bc78b48908 100644
— a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -423,6 +423,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
struct usb_serial *serial = port->serial;
struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
struct urb *urb;
+// struct usb_device_descriptor desc = &serial->dev->descriptor;
urb = usb_alloc_urb(0, GFP_KERNEL); / No ISO */
if (!urb)
@@ -435,6 +436,20 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
if (intfdata->use_zlp && dir == USB_DIR_OUT)
urb->transfer_flags |= URB_ZERO_PACKET;
+#if 1 //Added by Quectel for zero packet
-
if (dir == USB_DIR_OUT) {
-
struct usb_device_descriptor *desc = &serial->dev->descriptor;
-
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090))
-
urb->transfer_flags |= URB_ZERO_PACKET;
-
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003))
-
urb->transfer_flags |= URB_ZERO_PACKET;
-
if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215))
-
urb->transfer_flags |= URB_ZERO_PACKET;
-
if (desc->idVendor == cpu_to_le16(0x2C7C))
-
urb->transfer_flags |= URB_ZERO_PACKET;
-
}
+#endif
+
return urb;
}
common/common14-5.15/common$ git diff drivers/net/usb/Makefile
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 4964f7b326fb…93864f5d7612 100644
— a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -37,7 +37,7 @@ obj- ( C O N F I G U S B N E T C X 8231 0 E T H ) + = c x 8231 0 e t h . o o b j − (CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o obj- (CONFIGUSBNETCX82310ETH)+=cx82310eth.oobj−(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
obj- ( C O N F I G U S B N E T H U A W E I C D C N C M ) + = h u a w e i c d c n c m . o o b j − (CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.o obj- (CONFIGUSBNETHUAWEICDCNCM)+=huaweic