Difference between revisions of "IoTGateway/Features/Linux/Module"

From ESS-WIKI
Jump to: navigation, search
Line 56: Line 56:
 
=== Quectel UC20 ===
 
=== Quectel UC20 ===
  
3G module Porting (QUECTEL UC20)  
+
3G module Porting (QUECTEL UC20)
  
 
In linux kernel
 
In linux kernel
Line 63: Line 63:
  
 
You need to add the following statements to the “usb_wwan_write” and “usb_wwan_setup_urb” function, as shown below:
 
You need to add the following statements to the “usb_wwan_write” and “usb_wwan_setup_urb” function, as shown below:
<pre>#include "usb-wwan.h"
+
<pre>
 +
#include "usb-wwan.h"
  
 
+ #ifdef CONFIG_ARCH_ADVANTECH
 
+ #ifdef CONFIG_ARCH_ADVANTECH

Revision as of 07:57, 2 November 2016

3G

EWM-C106FT01E

Sierra AirPrime MC8090

The following operations are performed with UBC-221 using U221LBV1050.

  • linux kernel config
set the following lines to meta-advantech/recipes-kernel/linux/linux-yocto-clanton/advantech.cfg
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_SIERRAWIRELESS=m
add the following line to meta-advantech/recipes-kernel/advantech-init/files/advantech.conf
sierra
execute the following command
$ bitbake advantech-init
  • rebuild the kernel
$ bitbake linux-yocto-clanton
  • rebuild the full image
$ bitbake image-full
  • practical test on target board
# pppd connect 'chat -v -s -t 10 "" "AT" "" "ATDT*99#" "CONNECT" ""' \
user username password password /dev/ttyUSB3 460800 nodetach crtscts debug usepeerdns defaultroute &
Sierra AirPrime MC8090 connecting.png
# ifconfig
Sierra AirPrime MC8090 ifconfig.png
# pinc -c5 8.8.8.8
Sierra AirPrime MC8090 ping.png

Telit HE910-D

The following operations are performed with UBC-221 using U221LBV1050.

  • practical test on target board
# modprobe cdc-acm
Telit HE910-D modprobe.png
# dmesg | grep ttyACM
Telit HE910-D dmesg.png
# pppd connect 'chat -v -s -t 10 "" "AT" "" "ATDT*99#" "CONNECT" ""' \
user username password password /dev/ttyACM0 460800 nodetach crtscts debug usepeerdns defaultroute &
# pinc -c5 8.8.8.8
RTENOTITLE RTENOTITLE

Quectel UC20

3G module Porting (QUECTEL UC20)

In linux kernel

1. You need to add the mechanism for processing zero packets during transmission of “usb_wwan.c” file under “[KERNEL]/drivers/usb/serial”.

You need to add the following statements to the “usb_wwan_write” and “usb_wwan_setup_urb” function, as shown below:

…
#include "usb-wwan.h"

+ #ifdef CONFIG_ARCH_ADVANTECH
+ #define HW_bcdUSB 0x0110
+ #define HUAWEI_VENDOR_ID 0x12d1
+ #endif

void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
…
…
…

int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
		   const unsigned char *buf, int count)
{
…
…
	int left, todo;
	struct urb *this_urb = NULL;	/* spurious */
+ #ifdef CONFIG_ARCH_ADVANTECH
+ 	 struct usb_host_endpoint *ep=NULL;
+ #endif
	int err;
	unsigned long flags;
…
…
…
		/* send the data */
		memcpy(this_urb->transfer_buffer, buf, todo);
		this_urb->transfer_buffer_length = todo;

+ #ifdef CONFIG_ARCH_ADVANTECH  
+   if (IS_RSB_6410)
+   {
+       if((HUAWEI_VENDOR_ID == port->serial->dev->descriptor.idVendor)
+       	&& (HW_bcdUSB != port->serial->dev->descriptor.bcdUSB)){
+       	ep = usb_pipe_endpoint(this_urb->dev, this_urb->pipe);
+       	if(ep && (0 != this_urb->transfer_buffer_length)
+       		&& (0 == this_urb->transfer_buffer_length %
+       		ep->desc.wMaxPacketSize)){
+       		this_urb->transfer_flags |= URB_ZERO_PACKET;
+       	}
+       }
+   }
+ #endif

		spin_lock_irqsave(&intfdata->susp_lock, flags);
		if (intfdata->suspended) {
			usb_anchor_urb(this_urb, &portdata->delayed);
…
…
…
}
…
…
…
/* Helper functions used by usb_wwan_setup_urbs */
static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
				      int endpoint,
				      int dir, void *ctx, char *buf, int len,
				      void (*callback) (struct urb *))
{
	struct usb_serial *serial = port->serial;
	struct urb *urb;

	urb = usb_alloc_urb(0, GFP_KERNEL);	/* No ISO */
	if (!urb)
		return NULL;

	/* Fill URB using supplied data. */
	usb_fill_bulk_urb(urb, serial->dev,
			  usb_sndbulkpipe(serial->dev, endpoint) | dir,
			  buf, len, callback, ctx);

+ #ifdef CONFIG_ARCH_ADVANTECH
+   if (IS_RSB_6410)
+   {
+     	if (dir == USB_DIR_OUT) {
+     		struct usb_device_descriptor *desc = &serial->dev->descriptor;
+     		if (desc->idVendor == 0x05C6 && (desc->idProduct == 0x9003 || desc->idProduct ==
+     			0x9090 || desc->idProduct == 0x9215))
+     			urb->transfer_flags |= URB_ZERO_PACKET;
+     	}
+   }
+ #endif
	return urb;
}

2. Add UC15/UC20/EC20's Vendor ID and Product ID in "option_ids[]" in the file "drivers/usb/serial/option.c":

static const struct usb_device_id option_ids[] = {
…
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9090) }, //for Quectel UC15
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003) }, //for Quectel UC20
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9215) }, //for Quectel EC20
…
}

4G

AM Telecom AMM561KT

The following operations are performed with UBC-222(U222LBV2011).

  • linux kernel config

Device Drivers --->
[*] USB support --->
<M> Support for Host-side USB
[*] Network device support --->
USB Network Adapters --->
<M> Multi-purpose USB Networking Framework
<M> Host for RNDIS and ActiveSync devices (EXPERIMENTAL)

  • load drivers
# rmmod usbserial
# modprobe rndis_host
# modprobe usbserial vendor=0x1ECB product=0x0205

e.g. put the 3 lines to /etc/rc.local
AMM561KT load drivers.png

  • list usb devices
# lsusb
# ll /dev/ttyUSB[012]

AMM561KT list usb devices.png

Bluetooth

EWM-W155H01E

Please refer to Bluetooth Testing Guide for Quark Platform for all operations performed using UBC-222 with U222LBV2011.

WiFi

EWM-W142F01E

EWM-W151H01E

EWM-W155H01E

USB

EMIO-200U3

Set CONFIG_USB_XHCI_HCD=y in kernel config