Skip to content

Instantly share code, notes, and snippets.

@ilpianista
Forked from ivoronin/gobinet.patch
Last active August 29, 2015 14:19
Show Gist options
  • Save ilpianista/baa7cbcd6753a10b55ab to your computer and use it in GitHub Desktop.
Save ilpianista/baa7cbcd6753a10b55ab to your computer and use it in GitHub Desktop.
GobiNet patch to build with Linux 4.0.0
diff -Naur GobiNet.old/GobiUSBNet.c GobiNet/GobiUSBNet.c
--- GobiNet.old/GobiUSBNet.c 2015-04-22 19:45:17.553791454 +0200
+++ GobiNet/GobiUSBNet.c 2015-04-22 19:46:29.299686755 +0200
@@ -66,11 +66,15 @@
#define DRIVER_AUTHOR "Qualcomm Innovation Center"
#define DRIVER_DESC "GobiNet"
+#ifdef bool
+#undef bool
+#endif
+
// Debug flag
-int debug;
+bool debug;
// Allow user interrupts
-int interruptible = 1;
+bool interruptible = true;
// Number of IP packets which may be queued up for transmit
int txQueueLength = 100;
@@ -349,9 +353,8 @@
return -ENODEV;
}
- // Verify correct interface (0 or 5)
- if ( (pIntf->cur_altsetting->desc.bInterfaceNumber != 0)
- && (pIntf->cur_altsetting->desc.bInterfaceNumber != 5) )
+ // Verify correct interface
+ if ( !test_bit(pIntf->cur_altsetting->desc.bInterfaceNumber, &pDev->driver_info->data) )
{
DBG( "invalid interface %d\n",
pIntf->cur_altsetting->desc.bInterfaceNumber );
@@ -1002,13 +1005,31 @@
/*=========================================================================*/
// Struct driver_info
/*=========================================================================*/
+static const struct driver_info GobiNetInfo_intf2 =
+{
+ .description = "GobiNet Ethernet Device",
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
+ .bind = GobiNetDriverBind,
+ .unbind = GobiNetDriverUnbind,
+ .data = BIT(2)
+};
+
+static const struct driver_info GobiNetInfo_intf3 =
+{
+ .description = "GobiNet Ethernet Device",
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
+ .bind = GobiNetDriverBind,
+ .unbind = GobiNetDriverUnbind,
+ .data = BIT(3)
+};
+
static const struct driver_info GobiNetInfo =
{
.description = "GobiNet Ethernet Device",
- .flags = FLAG_ETHER,
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
.bind = GobiNetDriverBind,
.unbind = GobiNetDriverUnbind,
- .data = 0,
+ .data = BIT(0)|BIT(5)
};
/*=========================================================================*/
@@ -1021,6 +1042,16 @@
USB_DEVICE( 0x05c6, 0x920d ),
.driver_info = (unsigned long)&GobiNetInfo
},
+ // Quanta 1QDLZZZ0ST2 (Yota Router), Old firmware
+ {
+ USB_DEVICE( 0x0408, 0xd00a ),
+ .driver_info = (unsigned long)&GobiNetInfo_intf2
+ },
+ // Quanta 1QDLZZZ0ST2 (Yota Router)
+ {
+ USB_DEVICE( 0x0408, 0xd009 ),
+ .driver_info = (unsigned long)&GobiNetInfo_intf3
+ },
//Terminating entry
{ }
};
@@ -1242,10 +1273,6 @@
MODULE_LICENSE("Dual BSD/GPL");
-#ifdef bool
-#undef bool
-#endif
-
module_param( debug, bool, S_IRUGO | S_IWUSR );
MODULE_PARM_DESC( debug, "Debuging enabled or not" );
diff -Naur GobiNet.old/QMIDevice.c GobiNet/QMIDevice.c
--- GobiNet.old/QMIDevice.c 2015-04-22 19:45:17.553791454 +0200
+++ GobiNet/QMIDevice.c 2015-04-22 19:47:32.987566195 +0200
@@ -138,6 +138,7 @@
.ioctl = UserspaceIOCTL,
#else
.unlocked_ioctl = UnlockedUserspaceIOCTL,
+ .compat_ioctl = UnlockedUserspaceIOCTL,
#endif
.open = UserspaceOpen,
.flush = UserspaceClose,
@@ -2154,7 +2155,7 @@
if (IsDeviceValid( pFilpData->mpDev ) == false)
{
DBG( "Invalid device! Updating f_ops\n" );
- pFilp->f_op = pFilp->f_dentry->d_inode->i_fop;
+ pFilp->f_op = file_inode(pFilp)->i_fop;
return -ENXIO;
}
@@ -2275,7 +2276,7 @@
}
// Fallthough. If f_count == 1 no need to do more checks
- if (atomic_read( &pFilp->f_count ) != 1)
+ if (atomic_read( (const atomic_t*)&pFilp->f_count ) != 1)
{
rcu_read_lock();
for_each_process( pEachTask )
@@ -2312,7 +2313,7 @@
if (IsDeviceValid( pFilpData->mpDev ) == false)
{
DBG( "Invalid device! Updating f_ops\n" );
- pFilp->f_op = pFilp->f_dentry->d_inode->i_fop;
+ pFilp->f_op = file_inode(pFilp)->i_fop;
return -ENXIO;
}
@@ -2370,7 +2371,7 @@
if (IsDeviceValid( pFilpData->mpDev ) == false)
{
DBG( "Invalid device! Updating f_ops\n" );
- pFilp->f_op = pFilp->f_dentry->d_inode->i_fop;
+ pFilp->f_op = file_inode(pFilp)->i_fop;
return -ENXIO;
}
@@ -2450,7 +2451,7 @@
if (IsDeviceValid( pFilpData->mpDev ) == false)
{
DBG( "Invalid device! Updating f_ops\n" );
- pFilp->f_op = pFilp->f_dentry->d_inode->i_fop;
+ pFilp->f_op = file_inode(pFilp)->i_fop;
return -ENXIO;
}
@@ -2528,7 +2529,7 @@
if (IsDeviceValid( pFilpData->mpDev ) == false)
{
DBG( "Invalid device! Updating f_ops\n" );
- pFilp->f_op = pFilp->f_dentry->d_inode->i_fop;
+ pFilp->f_op = file_inode(pFilp)->i_fop;
return POLLERR;
}
@@ -2597,7 +2598,7 @@
if (pDev->mQMIDev.mbCdevIsInitialized == true)
{
// Should never happen, but always better to check
- dbg( "device already exists\n" );
+ DBG( "device already exists\n" );
return -EEXIST;
}
@@ -2786,9 +2787,9 @@
for (count = 0; count < pFDT->max_fds; count++)
{
pFilp = pFDT->fd[count];
- if (pFilp != NULL && pFilp->f_dentry != NULL)
+ if (pFilp != NULL && pFilp->f_path.dentry != NULL)
{
- if (pFilp->f_dentry->d_inode == pOpenInode)
+ if (file_inode(pFilp) == pOpenInode)
{
// Close this file handle
rcu_assign_pointer( pFDT->fd[count], NULL );
diff -Naur GobiNet.old/QMI.h GobiNet/QMI.h
--- GobiNet.old/QMI.h 2015-04-22 19:45:17.553791454 +0200
+++ GobiNet/QMI.h 2015-04-22 19:46:29.299686755 +0200
@@ -65,6 +65,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
===========================================================================*/
+#include <linux/module.h>
#pragma once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment