Skip to content

Instantly share code, notes, and snippets.

@ivoronin
Created April 24, 2012 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ivoronin/2480119 to your computer and use it in GitHub Desktop.
Save ivoronin/2480119 to your computer and use it in GitHub Desktop.
GobiSerial patch
Index: gobiserial-dkms_20110729~1026/GobiSerial.c
===================================================================
--- gobiserial-dkms_20110729~1026.orig/GobiSerial.c 2012-05-09 23:11:02.000000000 +0400
+++ gobiserial-dkms_20110729~1026/GobiSerial.c 2012-05-13 04:08:50.930148737 +0400
@@ -49,6 +49,7 @@
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include <linux/version.h>
+#include <linux/module.h>
//---------------------------------------------------------------------------
// Global veriable and defination
@@ -63,7 +64,7 @@
#define MAX_BULK_EPS 6
// Debug flag
-static int debug;
+bool debug;
// Global pointer to usb_serial_generic_close function
// This function is not exported, which is why we have to use a pointer
@@ -153,6 +154,8 @@
{
{ USB_DEVICE( 0x05c6, 0x920c ) }, // Gobi 3000 QDL device
{ USB_DEVICE( 0x05c6, 0x920d ) }, // Gobi 3000 Composite Device
+ { USB_DEVICE( 0x0408, 0xd00a ) }, // Quanta 1QDLZZZ0ST2 (Yota Router), Old firmware
+ { USB_DEVICE( 0x0408, 0xd009 ) }, // Quanta 1QDLZZZ0ST2 (Yota Router)
{ } // Terminating entry
};
MODULE_DEVICE_TABLE( usb, GobiVIDPIDTable );
@@ -200,6 +203,12 @@
#endif
};
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION( 3,4,0 ))
+static struct usb_serial_driver * const gGobiDevices[] = {
+ &gGobiDevice, NULL
+};
+#endif
+
//---------------------------------------------------------------------------
// USB serial core overridding Methods
//---------------------------------------------------------------------------
@@ -247,7 +256,8 @@
nInterfaceNum = pSerial->interface->cur_altsetting->desc.bInterfaceNumber;
DBG( "This Interface = %d\n", nInterfaceNum );
- if (nNumInterfaces == 1)
+ // Dirty hack for Quanta 1QDLZZZ0ST2
+ if (nNumInterfaces == 1 || ( pID->idVendor == 0x0408 && pID->idProduct == 0xd00a ))
{
// QDL mode?
if (nInterfaceNum == 1 || nInterfaceNum == 0)
@@ -403,7 +413,7 @@
}
if (bytesWrote != sizeof( startMessage ))
{
- DBG( "invalid write size %d, %d\n",
+ DBG( "invalid write size %d, %lu\n",
bytesWrote,
sizeof( startMessage ) );
return -EIO;
@@ -479,7 +489,7 @@
}
if (bytesWrote != sizeof( stopMessage ))
{
- DBG( "invalid write size %d, %d\n",
+ DBG( "invalid write size %d, %lu\n",
bytesWrote,
sizeof( stopMessage ) );
}
@@ -703,12 +713,17 @@
gGobiDevice.num_ports = NUM_BULK_EPS;
// Registering driver to USB serial core layer
+#if (LINUX_VERSION_CODE < KERNEL_VERSION( 3,4,0 ))
nRetval = usb_serial_register( &gGobiDevice );
+#else
+ nRetval = usb_serial_register_drivers( &GobiDriver, gGobiDevices);
+#endif
if (nRetval != 0)
{
return nRetval;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION( 3,4,0 ))
// Registering driver to USB core layer
nRetval = usb_register( &GobiDriver );
if (nRetval != 0)
@@ -716,6 +731,7 @@
usb_serial_deregister( &gGobiDevice );
return nRetval;
}
+#endif
// This will be shown whenever driver is loaded
printk( KERN_INFO "%s: %s\n", DRIVER_DESC, DRIVER_VERSION );
@@ -737,8 +753,12 @@
static void __exit GobiExit( void )
{
gpClose = NULL;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION( 3,4,0 ))
usb_deregister( &GobiDriver );
usb_serial_deregister( &gGobiDevice );
+#else
+ usb_serial_deregister_drivers( &GobiDriver, gGobiDevices );
+#endif
}
// Calling kernel module to init our driver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment