mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-27 18:41:15 +08:00
🌴 Sync 2026-06-07 11:19:41
This commit is contained in:
parent
b320837c85
commit
3cab85cfd8
@ -1,14 +1,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mihomo-meta
|
||||
PKG_VERSION:=1.19.26
|
||||
PKG_RELEASE:=6
|
||||
PKG_VERSION:=1.19.27
|
||||
PKG_RELEASE:=7
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/MetaCubeX/mihomo.git
|
||||
PKG_SOURCE_VERSION:=v1.19.26
|
||||
PKG_SOURCE_VERSION:=v1.19.27
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL3.0+
|
||||
@ -18,7 +18,7 @@ PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
|
||||
PKG_BUILD_VERSION:=v1.19.26
|
||||
PKG_BUILD_VERSION:=v1.19.27
|
||||
PKG_BUILD_TIME:=$(shell date -u -Iseconds)
|
||||
|
||||
GO_PKG:=github.com/metacubex/mihomo
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quectel-gobinet
|
||||
PKG_VERSION:=1.6.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/usb-net-gobinet
|
||||
SUBMENU:=USB Support
|
||||
TITLE:=Gobinet driver for Quectel modules
|
||||
DEPENDS:=+kmod-usb-net
|
||||
FILES:=$(PKG_BUILD_DIR)/GobiNet.ko
|
||||
AUTOLOAD:=$(call AutoLoad,81,GobiNet)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,usb-net-gobinet))
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
||||
obj-m := GobiNet.o
|
||||
GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o
|
||||
|
||||
PWD := $(shell pwd)
|
||||
OUTPUTDIR=/lib/modules/`uname -r`/kernel/drivers/net/usb/
|
||||
|
||||
ifeq ($(ARCH),)
|
||||
ARCH := $(shell uname -m)
|
||||
endif
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE :=
|
||||
endif
|
||||
ifeq ($(KDIR),)
|
||||
KDIR := /lib/modules/$(shell uname -r)/build
|
||||
ifeq ($(ARCH),i686)
|
||||
ifeq ($(wildcard $KDIR/arch/$ARCH),)
|
||||
ARCH=i386
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
$(shell rm -rf usbnet.h)
|
||||
ifneq ($(wildcard $(KDIR)/drivers/usb/net/usbnet.h),)
|
||||
$(shell ln -s $(KDIR)/drivers/usb/net/usbnet.h usbnet.h)
|
||||
endif
|
||||
ifneq ($(wildcard $(KDIR)/drivers/net/usb/usbnet.h),)
|
||||
$(shell ln -s $(KDIR)/drivers/net/usb/usbnet.h usbnet.h)
|
||||
endif
|
||||
|
||||
default:
|
||||
ln -sf makefile Makefile
|
||||
$(MAKE) ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(KDIR) M=$(PWD) modules
|
||||
|
||||
install: default
|
||||
mkdir -p $(OUTPUTDIR)
|
||||
cp -f GobiNet.ko $(OUTPUTDIR)
|
||||
depmod
|
||||
modprobe -r GobiNet
|
||||
modprobe GobiNet
|
||||
|
||||
clean:
|
||||
rm -rf Makefile usbnet.h
|
||||
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,337 +0,0 @@
|
||||
/*===========================================================================
|
||||
FILE:
|
||||
QMI.h
|
||||
|
||||
DESCRIPTION:
|
||||
Qualcomm QMI driver header
|
||||
|
||||
FUNCTIONS:
|
||||
Generic QMUX functions
|
||||
ParseQMUX
|
||||
FillQMUX
|
||||
|
||||
Generic QMI functions
|
||||
GetTLV
|
||||
ValidQMIMessage
|
||||
GetQMIMessageID
|
||||
|
||||
Get sizes of buffers needed by QMI requests
|
||||
QMUXHeaderSize
|
||||
QMICTLGetClientIDReqSize
|
||||
QMICTLReleaseClientIDReqSize
|
||||
QMICTLReadyReqSize
|
||||
QMIWDSSetEventReportReqSize
|
||||
QMIWDSGetPKGSRVCStatusReqSize
|
||||
QMIDMSGetMEIDReqSize
|
||||
QMICTLSyncReqSize
|
||||
|
||||
Fill Buffers with QMI requests
|
||||
QMICTLGetClientIDReq
|
||||
QMICTLReleaseClientIDReq
|
||||
QMICTLReadyReq
|
||||
QMIWDSSetEventReportReq
|
||||
QMIWDSGetPKGSRVCStatusReq
|
||||
QMIDMSGetMEIDReq
|
||||
QMICTLSetDataFormatReq
|
||||
QMICTLSyncReq
|
||||
|
||||
Parse data from QMI responses
|
||||
QMICTLGetClientIDResp
|
||||
QMICTLReleaseClientIDResp
|
||||
QMIWDSEventResp
|
||||
QMIDMSGetMEIDResp
|
||||
|
||||
Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Code Aurora Forum nor
|
||||
the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
===========================================================================*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*=========================================================================*/
|
||||
// Definitions
|
||||
/*=========================================================================*/
|
||||
|
||||
extern int quec_debug;
|
||||
// DBG macro
|
||||
#define DBG( format, arg... ) do { \
|
||||
if (quec_debug == 1)\
|
||||
{ \
|
||||
printk( KERN_INFO "GobiNet::%s " format, __FUNCTION__, ## arg ); \
|
||||
} }while(0)
|
||||
|
||||
#if 0
|
||||
#define VDBG( format, arg... ) do { \
|
||||
if (debug == 1)\
|
||||
{ \
|
||||
printk( KERN_INFO "GobiNet::%s " format, __FUNCTION__, ## arg ); \
|
||||
} } while(0)
|
||||
#else
|
||||
#define VDBG( format, arg... ) do { } while(0)
|
||||
#endif
|
||||
|
||||
#define INFO( format, arg... ) do { \
|
||||
printk( KERN_INFO "GobiNet::%s " format, __FUNCTION__, ## arg ); \
|
||||
}while(0)
|
||||
|
||||
// QMI Service Types
|
||||
#define QMICTL 0
|
||||
#define QMIWDS 1
|
||||
#define QMIDMS 2
|
||||
#define QMINAS 3
|
||||
#define QMIUIM 11
|
||||
#define QMIWDA 0x1A
|
||||
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned short
|
||||
#define u32 unsigned int
|
||||
#define u64 unsigned long long
|
||||
|
||||
#define bool u8
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define ENOMEM 12
|
||||
#define EFAULT 14
|
||||
#define EINVAL 22
|
||||
#ifndef ENOMSG
|
||||
#define ENOMSG 42
|
||||
#endif
|
||||
#define ENODATA 61
|
||||
|
||||
#define TLV_TYPE_LINK_PROTO 0x10
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sQMUX
|
||||
//
|
||||
// Structure that defines a QMUX header
|
||||
/*=========================================================================*/
|
||||
typedef struct sQMUX
|
||||
{
|
||||
/* T\F, always 1 */
|
||||
u8 mTF;
|
||||
|
||||
/* Size of message */
|
||||
u16 mLength;
|
||||
|
||||
/* Control flag */
|
||||
u8 mCtrlFlag;
|
||||
|
||||
/* Service Type */
|
||||
u8 mQMIService;
|
||||
|
||||
/* Client ID */
|
||||
u8 mQMIClientID;
|
||||
|
||||
}__attribute__((__packed__)) sQMUX;
|
||||
|
||||
#if 0
|
||||
/*=========================================================================*/
|
||||
// Generic QMUX functions
|
||||
/*=========================================================================*/
|
||||
|
||||
// Remove QMUX headers from a buffer
|
||||
int ParseQMUX(
|
||||
u16 * pClientID,
|
||||
void * pBuffer,
|
||||
u16 buffSize );
|
||||
|
||||
// Fill buffer with QMUX headers
|
||||
int FillQMUX(
|
||||
u16 clientID,
|
||||
void * pBuffer,
|
||||
u16 buffSize );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Generic QMI functions
|
||||
/*=========================================================================*/
|
||||
|
||||
// Get data buffer of a specified TLV from a QMI message
|
||||
int GetTLV(
|
||||
void * pQMIMessage,
|
||||
u16 messageLen,
|
||||
u8 type,
|
||||
void * pOutDataBuf,
|
||||
u16 bufferLen );
|
||||
|
||||
// Check mandatory TLV in a QMI message
|
||||
int ValidQMIMessage(
|
||||
void * pQMIMessage,
|
||||
u16 messageLen );
|
||||
|
||||
// Get the message ID of a QMI message
|
||||
int GetQMIMessageID(
|
||||
void * pQMIMessage,
|
||||
u16 messageLen );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Get sizes of buffers needed by QMI requests
|
||||
/*=========================================================================*/
|
||||
|
||||
// Get size of buffer needed for QMUX
|
||||
u16 QMUXHeaderSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMICTLGetClientIDReq
|
||||
u16 QMICTLGetClientIDReqSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMICTLReleaseClientIDReq
|
||||
u16 QMICTLReleaseClientIDReqSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMICTLReadyReq
|
||||
u16 QMICTLReadyReqSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMIWDSSetEventReportReq
|
||||
u16 QMIWDSSetEventReportReqSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMIWDSGetPKGSRVCStatusReq
|
||||
u16 QMIWDSGetPKGSRVCStatusReqSize( void );
|
||||
|
||||
u16 QMIWDSSetQMUXBindMuxDataPortSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMIDMSGetMEIDReq
|
||||
u16 QMIDMSGetMEIDReqSize( void );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMIWDASetDataFormatReq
|
||||
u16 QMIWDASetDataFormatReqSize( int qmap_mode );
|
||||
|
||||
// Get size of buffer needed for QMUX + QMICTLSyncReq
|
||||
u16 QMICTLSyncReqSize( void );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Fill Buffers with QMI requests
|
||||
/*=========================================================================*/
|
||||
|
||||
// Fill buffer with QMI CTL Get Client ID Request
|
||||
int QMICTLGetClientIDReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u8 transactionID,
|
||||
u8 serviceType );
|
||||
|
||||
// Fill buffer with QMI CTL Release Client ID Request
|
||||
int QMICTLReleaseClientIDReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u8 transactionID,
|
||||
u16 clientID );
|
||||
|
||||
// Fill buffer with QMI CTL Get Version Info Request
|
||||
int QMICTLReadyReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u8 transactionID );
|
||||
|
||||
// Fill buffer with QMI WDS Set Event Report Request
|
||||
int QMIWDSSetEventReportReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 transactionID );
|
||||
|
||||
// Fill buffer with QMI WDS Get PKG SRVC Status Request
|
||||
int QMIWDSGetPKGSRVCStatusReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 transactionID );
|
||||
|
||||
u16 QMIWDSSetQMUXBindMuxDataPortReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u8 MuxId,
|
||||
u16 transactionID );
|
||||
|
||||
// Fill buffer with QMI DMS Get Serial Numbers Request
|
||||
int QMIDMSGetMEIDReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 transactionID );
|
||||
|
||||
// Fill buffer with QMI WDA Set Data Format Request
|
||||
int QMIWDASetDataFormatReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
bool bRawIPMode, int qmap_mode, u32 rx_size,
|
||||
u16 transactionID );
|
||||
|
||||
#if 0
|
||||
int QMIWDASetDataQmapReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 transactionID );
|
||||
#endif
|
||||
|
||||
int QMICTLSyncReq(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 transactionID );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Parse data from QMI responses
|
||||
/*=========================================================================*/
|
||||
|
||||
// Parse the QMI CTL Get Client ID Resp
|
||||
int QMICTLGetClientIDResp(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u16 * pClientID );
|
||||
|
||||
// Verify the QMI CTL Release Client ID Resp is valid
|
||||
int QMICTLReleaseClientIDResp(
|
||||
void * pBuffer,
|
||||
u16 buffSize );
|
||||
|
||||
// Parse the QMI WDS Set Event Report Resp/Indication or
|
||||
// QMI WDS Get PKG SRVC Status Resp/Indication
|
||||
int QMIWDSEventResp(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
u32 * pTXOk,
|
||||
u32 * pRXOk,
|
||||
u32 * pTXErr,
|
||||
u32 * pRXErr,
|
||||
u32 * pTXOfl,
|
||||
u32 * pRXOfl,
|
||||
u64 * pTXBytesOk,
|
||||
u64 * pRXBytesOk,
|
||||
bool * pbLinkState,
|
||||
bool * pbReconfigure );
|
||||
|
||||
// Parse the QMI DMS Get Serial Numbers Resp
|
||||
int QMIDMSGetMEIDResp(
|
||||
void * pBuffer,
|
||||
u16 buffSize,
|
||||
char * pMEID,
|
||||
int meidSize );
|
||||
|
||||
// Parse the QMI DMS Get Serial Numbers Resp
|
||||
int QMIWDASetDataFormatResp(
|
||||
void * pBuffer,
|
||||
u16 buffSize, bool bRawIPMode, int *qmap_enabled, int *rx_size, int *tx_size);
|
||||
|
||||
// Pasre the QMI CTL Sync Response
|
||||
int QMICTLSyncResp(
|
||||
void *pBuffer,
|
||||
u16 buffSize );
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,368 +0,0 @@
|
||||
/*===========================================================================
|
||||
FILE:
|
||||
QMIDevice.h
|
||||
|
||||
DESCRIPTION:
|
||||
Functions related to the QMI interface device
|
||||
|
||||
FUNCTIONS:
|
||||
Generic functions
|
||||
IsDeviceValid
|
||||
PrintHex
|
||||
GobiSetDownReason
|
||||
GobiClearDownReason
|
||||
GobiTestDownReason
|
||||
|
||||
Driver level asynchronous read functions
|
||||
ResubmitIntURB
|
||||
ReadCallback
|
||||
IntCallback
|
||||
StartRead
|
||||
KillRead
|
||||
|
||||
Internal read/write functions
|
||||
ReadAsync
|
||||
UpSem
|
||||
ReadSync
|
||||
WriteSyncCallback
|
||||
WriteSync
|
||||
|
||||
Internal memory management functions
|
||||
GetClientID
|
||||
ReleaseClientID
|
||||
FindClientMem
|
||||
AddToReadMemList
|
||||
PopFromReadMemList
|
||||
AddToNotifyList
|
||||
NotifyAndPopNotifyList
|
||||
AddToURBList
|
||||
PopFromURBList
|
||||
|
||||
Internal userspace wrapper functions
|
||||
UserspaceunlockedIOCTL
|
||||
|
||||
Userspace wrappers
|
||||
UserspaceOpen
|
||||
UserspaceIOCTL
|
||||
UserspaceClose
|
||||
UserspaceRead
|
||||
UserspaceWrite
|
||||
UserspacePoll
|
||||
|
||||
Initializer and destructor
|
||||
RegisterQMIDevice
|
||||
DeregisterQMIDevice
|
||||
|
||||
Driver level client management
|
||||
QMIReady
|
||||
QMIWDSCallback
|
||||
SetupQMIWDSCallback
|
||||
QMIDMSGetMEID
|
||||
|
||||
Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Code Aurora Forum nor
|
||||
the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
===========================================================================*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Pragmas
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Include Files
|
||||
//---------------------------------------------------------------------------
|
||||
#include "Structs.h"
|
||||
#include "QMI.h"
|
||||
|
||||
/*=========================================================================*/
|
||||
// Generic functions
|
||||
/*=========================================================================*/
|
||||
|
||||
#ifdef __QUECTEL_INTER__
|
||||
|
||||
// Basic test to see if device memory is valid
|
||||
static bool IsDeviceValid( sGobiUSBNet * pDev );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Driver level asynchronous read functions
|
||||
/*=========================================================================*/
|
||||
|
||||
// Resubmit interrupt URB, re-using same values
|
||||
static int ResubmitIntURB( struct urb * pIntURB );
|
||||
|
||||
// Read callback
|
||||
// Put the data in storage and notify anyone waiting for data
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,18 ))
|
||||
static void ReadCallback( struct urb * pReadURB );
|
||||
#else
|
||||
static void ReadCallback(struct urb *pReadURB, struct pt_regs *regs);
|
||||
#endif
|
||||
|
||||
// Inturrupt callback
|
||||
// Data is available, start a read URB
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,18 ))
|
||||
static void IntCallback( struct urb * pIntURB );
|
||||
#else
|
||||
static void IntCallback(struct urb *pIntURB, struct pt_regs *regs);
|
||||
#endif
|
||||
|
||||
/*=========================================================================*/
|
||||
// Internal read/write functions
|
||||
/*=========================================================================*/
|
||||
|
||||
// Start asynchronous read
|
||||
// Reading client's data store, not device
|
||||
static int ReadAsync(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
u16 transactionID,
|
||||
void (*pCallback)(sGobiUSBNet *, u16, void *),
|
||||
void * pData );
|
||||
|
||||
// Notification function for synchronous read
|
||||
static void UpSem(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
void * pData );
|
||||
|
||||
// Start synchronous read
|
||||
// Reading client's data store, not device
|
||||
static int ReadSync(
|
||||
sGobiUSBNet * pDev,
|
||||
void ** ppOutBuffer,
|
||||
u16 clientID,
|
||||
u16 transactionID );
|
||||
|
||||
// Write callback
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,18 ))
|
||||
static void WriteSyncCallback( struct urb * pWriteURB );
|
||||
#else
|
||||
static void WriteSyncCallback(struct urb *pWriteURB, struct pt_regs *regs);
|
||||
#endif
|
||||
|
||||
// Start synchronous write
|
||||
static int WriteSync(
|
||||
sGobiUSBNet * pDev,
|
||||
char * pInWriteBuffer,
|
||||
int size,
|
||||
u16 clientID );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Internal memory management functions
|
||||
/*=========================================================================*/
|
||||
|
||||
// Create client and allocate memory
|
||||
static int GetClientID(
|
||||
sGobiUSBNet * pDev,
|
||||
u8 serviceType );
|
||||
|
||||
// Release client and free memory
|
||||
static void ReleaseClientID(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID );
|
||||
|
||||
// Find this client's memory
|
||||
static sClientMemList * FindClientMem(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID );
|
||||
|
||||
// Add Data to this client's ReadMem list
|
||||
static bool AddToReadMemList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
u16 transactionID,
|
||||
void * pData,
|
||||
u16 dataSize );
|
||||
|
||||
// Remove data from this client's ReadMem list if it matches
|
||||
// the specified transaction ID.
|
||||
static bool PopFromReadMemList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
u16 transactionID,
|
||||
void ** ppData,
|
||||
u16 * pDataSize );
|
||||
|
||||
// Add Notify entry to this client's notify List
|
||||
static bool AddToNotifyList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
u16 transactionID,
|
||||
void (* pNotifyFunct)(sGobiUSBNet *, u16, void *),
|
||||
void * pData );
|
||||
|
||||
// Remove first Notify entry from this client's notify list
|
||||
// and Run function
|
||||
static bool NotifyAndPopNotifyList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
u16 transactionID );
|
||||
|
||||
// Add URB to this client's URB list
|
||||
static bool AddToURBList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
struct urb * pURB );
|
||||
|
||||
// Remove URB from this client's URB list
|
||||
static struct urb * PopFromURBList(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Internal userspace wrappers
|
||||
/*=========================================================================*/
|
||||
|
||||
// Userspace unlocked ioctl
|
||||
static long UserspaceunlockedIOCTL(
|
||||
struct file * pFilp,
|
||||
unsigned int cmd,
|
||||
unsigned long arg );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Userspace wrappers
|
||||
/*=========================================================================*/
|
||||
|
||||
// Userspace open
|
||||
static int UserspaceOpen(
|
||||
struct inode * pInode,
|
||||
struct file * pFilp );
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION( 2,6,36 ))
|
||||
// Userspace ioctl
|
||||
static int UserspaceIOCTL(
|
||||
struct inode * pUnusedInode,
|
||||
struct file * pFilp,
|
||||
unsigned int cmd,
|
||||
unsigned long arg );
|
||||
#endif
|
||||
|
||||
// Userspace close
|
||||
#define quectel_no_for_each_process
|
||||
#ifdef quectel_no_for_each_process
|
||||
static int UserspaceClose(
|
||||
struct inode * pInode,
|
||||
struct file * pFilp );
|
||||
#else
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,14 ))
|
||||
static int UserspaceClose(
|
||||
struct file * pFilp,
|
||||
fl_owner_t unusedFileTable );
|
||||
#else
|
||||
static int UserspaceClose( struct file * pFilp );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Userspace read (synchronous)
|
||||
static ssize_t UserspaceRead(
|
||||
struct file * pFilp,
|
||||
char __user * pBuf,
|
||||
size_t size,
|
||||
loff_t * pUnusedFpos );
|
||||
|
||||
// Userspace write (synchronous)
|
||||
static ssize_t UserspaceWrite(
|
||||
struct file * pFilp,
|
||||
const char __user * pBuf,
|
||||
size_t size,
|
||||
loff_t * pUnusedFpos );
|
||||
|
||||
static unsigned int UserspacePoll(
|
||||
struct file * pFilp,
|
||||
struct poll_table_struct * pPollTable );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Driver level client management
|
||||
/*=========================================================================*/
|
||||
|
||||
// Check if QMI is ready for use
|
||||
static bool QMIReady(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 timeout );
|
||||
|
||||
// QMI WDS callback function
|
||||
static void QMIWDSCallback(
|
||||
sGobiUSBNet * pDev,
|
||||
u16 clientID,
|
||||
void * pData );
|
||||
|
||||
// Fire off reqests and start async read for QMI WDS callback
|
||||
static int SetupQMIWDSCallback( sGobiUSBNet * pDev );
|
||||
|
||||
// Register client, send req and parse MEID response, release client
|
||||
static int QMIDMSGetMEID( sGobiUSBNet * pDev );
|
||||
|
||||
// Register client, send req and parse Data format response, release client
|
||||
static int QMIWDASetDataFormat( sGobiUSBNet * pDev, int qmap_mode, int *rx_urb_size );
|
||||
#endif
|
||||
|
||||
// Print Hex data, for debug purposes
|
||||
void QuecPrintHex(
|
||||
void * pBuffer,
|
||||
u16 bufSize );
|
||||
|
||||
// Sets mDownReason and turns carrier off
|
||||
void QuecGobiSetDownReason(
|
||||
sGobiUSBNet * pDev,
|
||||
u8 reason );
|
||||
|
||||
// Clear mDownReason and may turn carrier on
|
||||
void QuecGobiClearDownReason(
|
||||
sGobiUSBNet * pDev,
|
||||
u8 reason );
|
||||
|
||||
// Tests mDownReason and returns whether reason is set
|
||||
bool QuecGobiTestDownReason(
|
||||
sGobiUSBNet * pDev,
|
||||
u8 reason );
|
||||
|
||||
// Start continuous read "thread"
|
||||
int QuecStartRead( sGobiUSBNet * pDev );
|
||||
|
||||
// Kill continuous read "thread"
|
||||
void QuecKillRead( sGobiUSBNet * pDev );
|
||||
|
||||
/*=========================================================================*/
|
||||
// Initializer and destructor
|
||||
/*=========================================================================*/
|
||||
|
||||
// QMI Device initialization function
|
||||
int QuecRegisterQMIDevice( sGobiUSBNet * pDev );
|
||||
|
||||
// QMI Device cleanup function
|
||||
void QuecDeregisterQMIDevice( sGobiUSBNet * pDev );
|
||||
|
||||
int QuecQMIWDASetDataFormat( sGobiUSBNet * pDev, int qmap_mode, int *rx_urb_size );
|
||||
|
||||
#define PrintHex QuecPrintHex
|
||||
#define GobiSetDownReason QuecGobiSetDownReason
|
||||
#define GobiClearDownReason QuecGobiClearDownReason
|
||||
#define GobiTestDownReason QuecGobiTestDownReason
|
||||
#define StartRead QuecStartRead
|
||||
#define KillRead QuecKillRead
|
||||
#define RegisterQMIDevice QuecRegisterQMIDevice
|
||||
#define DeregisterQMIDevice QuecDeregisterQMIDevice
|
||||
@ -1,78 +0,0 @@
|
||||
Gobi3000 network driver 2011-07-29-1026
|
||||
|
||||
This readme covers important information concerning
|
||||
the Gobi Net driver.
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. What's new in this release
|
||||
2. Known issues
|
||||
3. Known platform issues
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
1. WHAT'S NEW
|
||||
|
||||
This Release (Gobi3000 network driver 2011-07-29-1026)
|
||||
a. Signal the device to leave low power mode on enumeration
|
||||
b. Add "txQueueLength" parameter, which will set the Tx Queue Length
|
||||
c. Send SetControlLineState message during driver/device removal
|
||||
d. Change to new date-based versioning scheme
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.60) 06/29/2011
|
||||
a. Add UserspacePoll() function, to support select()
|
||||
b. Fix possible deadlock on GobiUSBNetTXTimeout()
|
||||
c. Fix memory leak on data transmission
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.50) 05/18/2011
|
||||
a. Add support for kernels up to 2.6.38
|
||||
b. Add support for dynamic interface binding
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.40) 02/28/2011
|
||||
a. In cases of QMI read errors, discard the error and continue reading.
|
||||
b. Add "interruptible" parameter, which may be disabled for debugging purposes.
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.30) 01/05/2011
|
||||
a. Fix rare kernel PANIC if a process terminates while file handle close
|
||||
or device removal is in progress.
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.20) 11/01/2010
|
||||
a. Fix possible kernel WARNING if device removed before QCWWANDisconnect().
|
||||
b. Fix multiple memory leaks in error cases.
|
||||
|
||||
Prior Release (Gobi3000 network driver 1.0.10) 09/17/2010
|
||||
a. Initial release
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
2. KNOWN ISSUES
|
||||
|
||||
No known issues.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
3. KNOWN PLATFORM ISSUES
|
||||
|
||||
a. Enabling autosuspend:
|
||||
Autosuspend is supported by the Gobi3000 module and its drivers,
|
||||
but by default it is not enabled by the open source kernel. As such,
|
||||
the Gobi3000 module will not enter autosuspend unless the
|
||||
user specifically turns on autosuspend with the command:
|
||||
echo auto > /sys/bus/usb/devices/.../power/level
|
||||
b. Ksoftirq using 100% CPU:
|
||||
There is a known issue with the open source usbnet driver that can
|
||||
result in infinite software interrupts. The fix for this is to test
|
||||
(in the usbnet_bh() function) if the usb_device can submit URBs before
|
||||
attempting to submit the response URB buffers.
|
||||
c. NetworkManager does not recognize connection after resume:
|
||||
After resuming from sleep/hibernate, NetworkManager may not recognize new
|
||||
network connections by the Gobi device. This is a system issue not specific
|
||||
to the Gobi device, which may result in dhcp not being run and the default
|
||||
route not being updated. One way to fix this is to simply restart the
|
||||
NetworkManager service.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -1,166 +0,0 @@
|
||||
Release Notes
|
||||
|
||||
[V1.6.3]
|
||||
Date: 9/26/2021
|
||||
enhancement:
|
||||
1. change version to 1.6.3
|
||||
fix:
|
||||
|
||||
[V1.6.2.16]
|
||||
Date: 9/17/2021
|
||||
enhancement:
|
||||
fix:
|
||||
1. add sdx6x platform support
|
||||
|
||||
[V1.6.2.15]
|
||||
Date: 3/23/2021
|
||||
enhancement:
|
||||
fix:
|
||||
1. add sdx12 platform support
|
||||
|
||||
[V1.6.2.14]
|
||||
Date: 3/18/2021
|
||||
enhancement:
|
||||
fix:
|
||||
1. fix kasam: use-after-free when do modem reboot stress test
|
||||
2. wait qmi_sync_thread() finish in DeregisterQMIDevice(), usb will disconnect when driver is still in qmi_sync_thread()
|
||||
|
||||
[V1.6.2.13]
|
||||
Date: 12/31/2020
|
||||
enhancement:
|
||||
fix:
|
||||
1. fix quectel-CM open error when driver is still in qmi_sync_thread() but SOC enter sleep.
|
||||
|
||||
[V1.6.2.12]
|
||||
Date: 12/31/2020
|
||||
enhancement:
|
||||
fix:
|
||||
1. for multi-pdn-call, can not ping when usb resume for usb suspend state.
|
||||
|
||||
[V1.6.2.11]
|
||||
Date: 11/7/2020
|
||||
enhancement:
|
||||
1. support QUECTEL_QMI_MERGE, for some SOC, control endpoint only support read max 64 bytes QMI.
|
||||
for QMI that size > 64, we need read serval times, and merge.
|
||||
fix:
|
||||
|
||||
[V1.6.2.10]
|
||||
Date: 9/15/2020
|
||||
enhancement:
|
||||
fix:
|
||||
1. for X55, fix panic on kernel V2.6 ~ V3.2
|
||||
|
||||
[V1.6.2.9]
|
||||
Date: 7/24/2020
|
||||
enhancement:
|
||||
fix:
|
||||
1. for X55, fix errors on Big Endian SOC.
|
||||
|
||||
[V1.6.2.8]
|
||||
Date: 7/2/2020
|
||||
enhancement:
|
||||
1. support QMAPV5, UL AGG (porting from qmi_wwan_q)
|
||||
fix:
|
||||
1. fix errors kernel V2.6 .
|
||||
|
||||
[V1.6.2.7]
|
||||
Date: 6/9/2020
|
||||
enhancement:
|
||||
fix:
|
||||
1. when send qmi ctl request, clear qmi ctl response which's TID is same
|
||||
|
||||
[V1.6.2.6]
|
||||
Date: 5/19/2020
|
||||
enhancement:
|
||||
1. support bridge mode for multi-pdn-call
|
||||
fix:
|
||||
|
||||
[V1.6.2.5]
|
||||
Date: 4/26/2020
|
||||
enhancement:
|
||||
1. fix netcard name as usbX (from ethX)
|
||||
fix:
|
||||
|
||||
......
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.5.0]
|
||||
Date: 2018/04/17
|
||||
enhancement::
|
||||
1. support EG20&RG500
|
||||
2. fix set rx_urb_size as 1520. do not change accroding to MTU
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.4.3]
|
||||
Date: 2018/04/16
|
||||
enhancement::
|
||||
1. increase QMAP's rx_urb_size to 32KB
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.4.2]
|
||||
Date: 2018/04/03
|
||||
bug fix:
|
||||
1. fix qmi client can not be released when quectel-CM killed by ¡®kill -9¡¯
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.4.1]
|
||||
Date: 2018/02/20
|
||||
bug fix:
|
||||
1. fix a compiler error on Kernel lager than 4.11
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.4.0]
|
||||
Date: 2018/12/17
|
||||
bug fix:
|
||||
1. fix a USB DMA error when built as GobiNet.ko on Kernel lager than 4.15
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.8]
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.7]
|
||||
Date: 2018/09/25
|
||||
enhancement:
|
||||
1. check skb length in tx_fixup functions.
|
||||
2. when QMAP enabled, set FLAG_RX_ASSEMBLE to advoid 'RX errors' of ifconfig
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.6]
|
||||
Date: 2018/09/11
|
||||
enhancement:
|
||||
1. support EG12 EM12
|
||||
2. optimization QMAP source code
|
||||
3. fix compile errors and warnnings on kernel version 4.15
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.5]
|
||||
Date: 2018/05/12
|
||||
enhancement:
|
||||
1. provide two method to enable QMAP function.
|
||||
1.1 set module parameters 'qmap_mode' to X(1~4) to enable QMAP.
|
||||
1.2 ifconfig usb0 down, then 'echo X > /sys/class/usbX/qmap_mode' to enable QMAP
|
||||
for above two method, X(1) used to enable 'IP Aggregation' and X(2~4) to enable 'IP Mux'
|
||||
2. support bridge mode, also provide two method to enable bridge mode.
|
||||
2.1 set module parameters 'bridge_mode' to 1 to enable bridge mode.
|
||||
2.2 'echo 1 > /sys/class/usbX/bridge_mode' to enable bridge mode.
|
||||
bridge mode setups:
|
||||
brctl addbr br0; brctl addif br0 eth0; brctl addif usb0; ./quectel-CM; ifconfig br0 up; ifconfig eth0 up
|
||||
then connect eth0 to PC by ethernet cable. and PC run DHCP tool to obtain network public IP address.
|
||||
|
||||
'WCDMA<E_QConnectManager_Linux&Android_V1.1.40' and later version is required to use QMAP and bridge mode.
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.4]
|
||||
Date: 2018/05/07
|
||||
enhancement:
|
||||
1. support use 'AT$QCRMCALL=1,1' to setup data call.
|
||||
when use 'AT$QCRMCALL=1,1', must set module parameters 'qcrmcall_mode' to 1,
|
||||
and GobiNet Driver will do not tx&rx QMI.
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.3]
|
||||
Date: 2018/04/04
|
||||
optimization:
|
||||
1. optimization QMAP source code
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.2]
|
||||
Date: 2018/03/23
|
||||
enhancement:
|
||||
1. support Qualcomm Mux and Aggregation Protocol (QMAP)
|
||||
1.1 IP Mux: GobiNet Driver register multiple netcards, one netcards corresponding to one PDP.
|
||||
and GobiNet Driver will tx/rx multiple IP packets maybe belong to different PDPs in one URB.
|
||||
1.2 IP Aggregation: GobiNet Driver will rx multiple IP packets in one URB, used to increase throughput theoretically by reducing the number of usb interrupts.
|
||||
the max rx URB size of MDM9x07 is 4KB, the max rx URB size of MDM9x40&SDX20 is 16KB
|
||||
|
||||
[Quectel_WCDMA<E_Linux&Android_GobiNet_Driver_V1.3.1]
|
||||
Date: 2017/11/20
|
||||
enhancement:
|
||||
1. support BG96
|
||||
@ -1,529 +0,0 @@
|
||||
/*===========================================================================
|
||||
FILE:
|
||||
Structs.h
|
||||
|
||||
DESCRIPTION:
|
||||
Declaration of structures used by the Qualcomm Linux USB Network driver
|
||||
|
||||
FUNCTIONS:
|
||||
none
|
||||
|
||||
Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Code Aurora Forum nor
|
||||
the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
===========================================================================*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Pragmas
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Include Files
|
||||
//---------------------------------------------------------------------------
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#define QUECTEL_WWAN_QMAP 4 //MAX is 7
|
||||
#ifdef QUECTEL_WWAN_QMAP
|
||||
#define QUECTEL_QMAP_MUX_ID 0x81
|
||||
#endif
|
||||
|
||||
//#define QUECTEL_QMI_MERGE
|
||||
|
||||
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
|
||||
#define QUECTEL_BRIDGE_MODE
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION( 2,6,21 ))
|
||||
static inline void skb_reset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac.raw = skb->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION( 2,6,22 ))
|
||||
#define bool u8
|
||||
#ifndef URB_FREE_BUFFER
|
||||
#define URB_FREE_BUFFER_BY_SELF //usb_free_urb will not free, should free by self
|
||||
#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* usb_endpoint_type - get the endpoint's transfer type
|
||||
* @epd: endpoint to be checked
|
||||
*
|
||||
* Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
|
||||
* to @epd's transfer type.
|
||||
*/
|
||||
static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
|
||||
{
|
||||
return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION( 2,6,18 ))
|
||||
/**
|
||||
* usb_endpoint_dir_in - check if the endpoint has IN direction
|
||||
* @epd: endpoint to be checked
|
||||
*
|
||||
* Returns true if the endpoint is of type IN, otherwise it returns false.
|
||||
*/
|
||||
static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
|
||||
{
|
||||
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_endpoint_dir_out - check if the endpoint has OUT direction
|
||||
* @epd: endpoint to be checked
|
||||
*
|
||||
* Returns true if the endpoint is of type OUT, otherwise it returns false.
|
||||
*/
|
||||
static inline int usb_endpoint_dir_out(
|
||||
const struct usb_endpoint_descriptor *epd)
|
||||
{
|
||||
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
|
||||
* @epd: endpoint to be checked
|
||||
*
|
||||
* Returns true if the endpoint is of type interrupt, otherwise it returns
|
||||
* false.
|
||||
*/
|
||||
static inline int usb_endpoint_xfer_int(
|
||||
const struct usb_endpoint_descriptor *epd)
|
||||
{
|
||||
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
||||
USB_ENDPOINT_XFER_INT);
|
||||
}
|
||||
|
||||
static inline int usb_autopm_set_interface(struct usb_interface *intf)
|
||||
{ return 0; }
|
||||
|
||||
static inline int usb_autopm_get_interface(struct usb_interface *intf)
|
||||
{ return 0; }
|
||||
|
||||
static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
|
||||
{ return 0; }
|
||||
|
||||
static inline void usb_autopm_put_interface(struct usb_interface *intf)
|
||||
{ }
|
||||
static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
|
||||
{ }
|
||||
static inline void usb_autopm_enable(struct usb_interface *intf)
|
||||
{ }
|
||||
static inline void usb_autopm_disable(struct usb_interface *intf)
|
||||
{ }
|
||||
static inline void usb_mark_last_busy(struct usb_device *udev)
|
||||
{ }
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION( 2,6,24 ))
|
||||
#include "usbnet.h"
|
||||
#else
|
||||
#include <linux/usb/usbnet.h>
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 2,6,25 ))
|
||||
#include <linux/fdtable.h>
|
||||
#else
|
||||
#include <linux/file.h>
|
||||
#endif
|
||||
|
||||
// Used in recursion, defined later below
|
||||
struct sGobiUSBNet;
|
||||
|
||||
|
||||
#if defined(QUECTEL_WWAN_QMAP)
|
||||
#define QUECTEL_UL_DATA_AGG 1
|
||||
|
||||
#if defined(QUECTEL_UL_DATA_AGG)
|
||||
struct ul_agg_ctx {
|
||||
/* QMIWDS_ADMIN_SET_DATA_FORMAT_RESP TLV_0x17 and TLV_0x18 */
|
||||
uint ul_data_aggregation_max_datagrams; //UplinkDataAggregationMaxDatagramsTlv
|
||||
uint ul_data_aggregation_max_size; //UplinkDataAggregationMaxSizeTlv
|
||||
uint dl_minimum_padding;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sReadMemList
|
||||
//
|
||||
// Structure that defines an entry in a Read Memory linked list
|
||||
/*=========================================================================*/
|
||||
typedef struct sReadMemList
|
||||
{
|
||||
/* Data buffer */
|
||||
void * mpData;
|
||||
|
||||
/* Transaction ID */
|
||||
u16 mTransactionID;
|
||||
|
||||
/* Size of data buffer */
|
||||
u16 mDataSize;
|
||||
|
||||
/* Next entry in linked list */
|
||||
struct sReadMemList * mpNext;
|
||||
|
||||
} sReadMemList;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sNotifyList
|
||||
//
|
||||
// Structure that defines an entry in a Notification linked list
|
||||
/*=========================================================================*/
|
||||
typedef struct sNotifyList
|
||||
{
|
||||
/* Function to be run when data becomes available */
|
||||
void (* mpNotifyFunct)(struct sGobiUSBNet *, u16, void *);
|
||||
|
||||
/* Transaction ID */
|
||||
u16 mTransactionID;
|
||||
|
||||
/* Data to provide as parameter to mpNotifyFunct */
|
||||
void * mpData;
|
||||
|
||||
/* Next entry in linked list */
|
||||
struct sNotifyList * mpNext;
|
||||
|
||||
} sNotifyList;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sURBList
|
||||
//
|
||||
// Structure that defines an entry in a URB linked list
|
||||
/*=========================================================================*/
|
||||
typedef struct sURBList
|
||||
{
|
||||
/* The current URB */
|
||||
struct urb * mpURB;
|
||||
|
||||
/* Next entry in linked list */
|
||||
struct sURBList * mpNext;
|
||||
|
||||
} sURBList;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sClientMemList
|
||||
//
|
||||
// Structure that defines an entry in a Client Memory linked list
|
||||
// Stores data specific to a Service Type and Client ID
|
||||
/*=========================================================================*/
|
||||
typedef struct sClientMemList
|
||||
{
|
||||
/* Client ID for this Client */
|
||||
u16 mClientID;
|
||||
|
||||
/* Linked list of Read entries */
|
||||
/* Stores data read from device before sending to client */
|
||||
sReadMemList * mpList;
|
||||
|
||||
/* Linked list of Notification entries */
|
||||
/* Stores notification functions to be run as data becomes
|
||||
available or the device is removed */
|
||||
sNotifyList * mpReadNotifyList;
|
||||
|
||||
/* Linked list of URB entries */
|
||||
/* Stores pointers to outstanding URBs which need canceled
|
||||
when the client is deregistered or the device is removed */
|
||||
sURBList * mpURBList;
|
||||
|
||||
/* Next entry in linked list */
|
||||
struct sClientMemList * mpNext;
|
||||
|
||||
/* Wait queue object for poll() */
|
||||
wait_queue_head_t mWaitQueue;
|
||||
|
||||
} sClientMemList;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sURBSetupPacket
|
||||
//
|
||||
// Structure that defines a USB Setup packet for Control URBs
|
||||
// Taken from USB CDC specifications
|
||||
/*=========================================================================*/
|
||||
typedef struct sURBSetupPacket
|
||||
{
|
||||
/* Request type */
|
||||
u8 mRequestType;
|
||||
|
||||
/* Request code */
|
||||
u8 mRequestCode;
|
||||
|
||||
/* Value */
|
||||
u16 mValue;
|
||||
|
||||
/* Index */
|
||||
u16 mIndex;
|
||||
|
||||
/* Length of Control URB */
|
||||
u16 mLength;
|
||||
|
||||
} sURBSetupPacket;
|
||||
|
||||
// Common value for sURBSetupPacket.mLength
|
||||
#define DEFAULT_READ_URB_LENGTH 0x1000
|
||||
|
||||
#ifdef QUECTEL_QMI_MERGE
|
||||
#define MERGE_PACKET_IDENTITY 0x2c7c
|
||||
#define MERGE_PACKET_VERSION 0x0001
|
||||
#define MERGE_PACKET_MAX_PAYLOAD_SIZE 56
|
||||
typedef struct sQMIMsgHeader {
|
||||
u16 idenity;
|
||||
u16 version;
|
||||
u16 cur_len;
|
||||
u16 total_len;
|
||||
} sQMIMsgHeader;
|
||||
|
||||
typedef struct sQMIMsgPacket {
|
||||
sQMIMsgHeader header;
|
||||
u16 len;
|
||||
char buf[DEFAULT_READ_URB_LENGTH];
|
||||
} sQMIMsgPacket;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION( 2,6,29 ))
|
||||
/*=========================================================================*/
|
||||
// Struct sAutoPM
|
||||
//
|
||||
// Structure used to manage AutoPM thread which determines whether the
|
||||
// device is in use or may enter autosuspend. Also submits net
|
||||
// transmissions asynchronously.
|
||||
/*=========================================================================*/
|
||||
typedef struct sAutoPM
|
||||
{
|
||||
/* Thread for atomic autopm function */
|
||||
struct task_struct * mpThread;
|
||||
|
||||
/* Signal for completion when it's time for the thread to work */
|
||||
struct completion mThreadDoWork;
|
||||
|
||||
/* Time to exit? */
|
||||
bool mbExit;
|
||||
|
||||
/* List of URB's queued to be sent to the device */
|
||||
sURBList * mpURBList;
|
||||
|
||||
/* URB list lock (for adding and removing elements) */
|
||||
spinlock_t mURBListLock;
|
||||
|
||||
/* Length of the URB list */
|
||||
atomic_t mURBListLen;
|
||||
|
||||
/* Active URB */
|
||||
struct urb * mpActiveURB;
|
||||
|
||||
/* Active URB lock (for adding and removing elements) */
|
||||
spinlock_t mActiveURBLock;
|
||||
|
||||
/* Duplicate pointer to USB device interface */
|
||||
struct usb_interface * mpIntf;
|
||||
|
||||
} sAutoPM;
|
||||
#endif
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sQMIDev
|
||||
//
|
||||
// Structure that defines the data for the QMI device
|
||||
/*=========================================================================*/
|
||||
typedef struct sQMIDev
|
||||
{
|
||||
/* Device number */
|
||||
dev_t mDevNum;
|
||||
|
||||
/* Device class */
|
||||
struct class * mpDevClass;
|
||||
|
||||
/* cdev struct */
|
||||
struct cdev mCdev;
|
||||
|
||||
/* is mCdev initialized? */
|
||||
bool mbCdevIsInitialized;
|
||||
|
||||
/* Pointer to read URB */
|
||||
struct urb * mpReadURB;
|
||||
|
||||
//#define READ_QMI_URB_ERROR
|
||||
#ifdef READ_QMI_URB_ERROR
|
||||
struct timer_list mReadUrbTimer;
|
||||
#endif
|
||||
|
||||
#ifdef QUECTEL_QMI_MERGE
|
||||
sQMIMsgPacket * mpQmiMsgPacket;
|
||||
#endif
|
||||
|
||||
/* Read setup packet */
|
||||
sURBSetupPacket * mpReadSetupPacket;
|
||||
|
||||
/* Read buffer attached to current read URB */
|
||||
void * mpReadBuffer;
|
||||
|
||||
/* Inturrupt URB */
|
||||
/* Used to asynchronously notify when read data is available */
|
||||
struct urb * mpIntURB;
|
||||
|
||||
/* Buffer used by Inturrupt URB */
|
||||
void * mpIntBuffer;
|
||||
|
||||
/* Pointer to memory linked list for all clients */
|
||||
sClientMemList * mpClientMemList;
|
||||
|
||||
/* Spinlock for client Memory entries */
|
||||
spinlock_t mClientMemLock;
|
||||
|
||||
/* Transaction ID associated with QMICTL "client" */
|
||||
atomic_t mQMICTLTransactionID;
|
||||
|
||||
} sQMIDev;
|
||||
|
||||
typedef struct {
|
||||
u32 qmap_enabled;
|
||||
u32 dl_data_aggregation_max_datagrams;
|
||||
u32 dl_data_aggregation_max_size ;
|
||||
u32 ul_data_aggregation_max_datagrams;
|
||||
u32 ul_data_aggregation_max_size;
|
||||
u32 dl_minimum_padding;
|
||||
} QMAP_SETTING;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sGobiUSBNet
|
||||
//
|
||||
// Structure that defines the data associated with the Qualcomm USB device
|
||||
/*=========================================================================*/
|
||||
typedef struct sGobiUSBNet
|
||||
{
|
||||
atomic_t refcount;
|
||||
|
||||
/* Net device structure */
|
||||
struct usbnet * mpNetDev;
|
||||
#ifdef QUECTEL_WWAN_QMAP
|
||||
unsigned link_state;
|
||||
int qmap_mode;
|
||||
int qmap_size;
|
||||
int qmap_version;
|
||||
struct net_device *mpQmapNetDev[QUECTEL_WWAN_QMAP];
|
||||
struct tasklet_struct txq;
|
||||
|
||||
QMAP_SETTING qmap_settings;
|
||||
#if defined(QUECTEL_UL_DATA_AGG)
|
||||
struct ul_agg_ctx agg_ctx;
|
||||
#endif
|
||||
|
||||
#ifdef QUECTEL_BRIDGE_MODE
|
||||
int m_qmap_bridge_mode[QUECTEL_WWAN_QMAP];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 1 //def DATA_MODE_RP
|
||||
bool mbMdm9x07;
|
||||
bool mbMdm9x06; //for BG96
|
||||
/* QMI "device" work in IP Mode or ETH Mode */
|
||||
bool mbRawIPMode;
|
||||
#ifdef QUECTEL_BRIDGE_MODE
|
||||
int m_bridge_mode;
|
||||
uint m_bridge_ipv4;
|
||||
unsigned char mHostMAC[6];
|
||||
#endif
|
||||
int m_qcrmcall_mode;
|
||||
#endif
|
||||
|
||||
struct completion mQMIReadyCompletion;
|
||||
bool mbQMIReady;
|
||||
bool mbProbeDone;
|
||||
bool mbQMISyncIng;
|
||||
|
||||
/* Usb device interface */
|
||||
struct usb_interface * mpIntf;
|
||||
|
||||
/* Pointers to usbnet_open and usbnet_stop functions */
|
||||
int (* mpUSBNetOpen)(struct net_device *);
|
||||
int (* mpUSBNetStop)(struct net_device *);
|
||||
|
||||
/* Reason(s) why interface is down */
|
||||
/* Used by Gobi*DownReason */
|
||||
unsigned long mDownReason;
|
||||
#define NO_NDIS_CONNECTION 0
|
||||
#define CDC_CONNECTION_SPEED 1
|
||||
#define DRIVER_SUSPENDED 2
|
||||
#define NET_IFACE_STOPPED 3
|
||||
|
||||
/* QMI "device" status */
|
||||
bool mbQMIValid;
|
||||
|
||||
bool mbDeregisterQMIDevice;
|
||||
|
||||
/* QMI "device" memory */
|
||||
sQMIDev mQMIDev;
|
||||
|
||||
/* Device MEID */
|
||||
char mMEID[14];
|
||||
struct hrtimer timer;
|
||||
struct tasklet_struct bh;
|
||||
unsigned long
|
||||
pending_num : 8,
|
||||
pending_size : 16;
|
||||
struct sk_buff *pending_pool[16];
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION( 2,6,29 ))
|
||||
/* AutoPM thread */
|
||||
sAutoPM mAutoPM;
|
||||
#endif
|
||||
#endif /* CONFIG_PM */
|
||||
} sGobiUSBNet;
|
||||
|
||||
/*=========================================================================*/
|
||||
// Struct sQMIFilpStorage
|
||||
//
|
||||
// Structure that defines the storage each file handle contains
|
||||
// Relates the file handle to a client
|
||||
/*=========================================================================*/
|
||||
typedef struct sQMIFilpStorage
|
||||
{
|
||||
/* Client ID */
|
||||
u16 mClientID;
|
||||
|
||||
/* Device pointer */
|
||||
sGobiUSBNet * mpDev;
|
||||
|
||||
} sQMIFilpStorage;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user