Package: sl-modem / 2.9.11~20110321-11

08_ungrab_winmodem.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
Description: Helper module to tell the kernel to keep away from unsupported PCI id numbers.
Origin: http://linmodems.technion.ac.il/packages/smartlink/ungrab-winmodem-20090716.tar.gz
--- /dev/null
+++ b/ungrab-winmodem/Readme.txt
@@ -0,0 +1,42 @@
+---------------
+
+Ungrab-Winmodem
+
+---------------
+
+This loadable module was written by Sasha Khapyorsky  - April 14, 2005
+
+Purpose:
+=======
+Release slmodem devices which have been detected by Linux as if they were true
+hardware modems and assigned by Linux to work with the standard serial driver.
+
+When is it helpful?
+===================
+When you see something like:
+here the "modprobe slamr debug=3" outout:
+slamr: unsupported module, tainting kernel.
+slamr: module license 'Smart Link Ltd.' taints kernel.
+slamr: SmartLink AMRMO modem.
+slamr: device 10b9:5457 is grabbed by driver serial
+
+or the same after two commands   modprobe slamr
+                                 dmesg | grep slamr
+
+Installation:
+=============
+
+You must be root or superuser
+
+make
+make install
+
+Usage:
+======
+
+modprobe ungrab-winmodem
+
+The modprobe command MUST be given BEFORE loading slamr
+
+This text written by Jacques Goldberg
+Questions: discuss@linmodems.org    , Subject: ungrab-winmodem
--- /dev/null
+++ b/ungrab-winmodem/ungrab-winmodem.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2005, linmodems.org
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * Sasha K (sashak@smlink.com)
+ *
+ * ungrab-winmodem.c - try to release softmodem device when grabbed by others.
+ *
+ 
+  *	20070505: -Renamed Motorola device 5600
+  * http://archives.linmodems.org/26589
+  * Marvin Stodolsky (marvin.stodolsky@gmail.com)
+  * Alvaro Aguirre (alvaro.aguirre@gmail.com)
+  */
+
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+#include <linux/config.h>
+#endif
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+#define pci_find_device pci_get_device
+#endif
+
+#define PCI_DEVICE_ID_ALI5457			0x5457
+#define PCI_DEVICE_ID_ALI5459			0x5459
+#define PCI_DEVICE_ID_ALI545A			0x545A
+
+#define PCI_VENDOR_ID_SMARTLINK                 0x2000		
+#define PCI_VENDOR_ID_SMARTLINK_1		0x163c
+#define PCI_VENDOR_ID_SMARTLINK_2		0x10a5
+#define PCI_VENDOR_ID_SMARTLINK_3		0x2003
+#define PCI_DEVICE_ID_SL2800			0x2800
+#define PCI_DEVICE_ID_SL1900			0x3052
+#define PCI_DEVICE_ID_ND92XPA                   0x8800 /* ND92XPA */
+#define PCI_VENDOR_ID_MOTOROLA                  0x1057 /* Motorola */
+#define PCI_VENDOR_ID_SLI1543                   0x1543 /* Silicon Inst 1543:3052 sub 1543:3000 */
+
+
+static struct pci_device_id softmodem_pci_tbl [] = {
+	/* 1543:3052 */
+	{PCI_VENDOR_ID_SLI1543, PCI_DEVICE_ID_SL1900, PCI_ANY_ID, PCI_ANY_ID },
+	/* 1057:3052 */
+	{PCI_VENDOR_ID_MOTOROLA, PCI_DEVICE_ID_SL1900, PCI_ANY_ID, PCI_ANY_ID },
+	/* 163c:3052 */
+	{PCI_VENDOR_ID_SMARTLINK_1, PCI_DEVICE_ID_SL1900, PCI_ANY_ID, PCI_ANY_ID },
+	/* 10a5:3052 */
+	{PCI_VENDOR_ID_SMARTLINK_2, PCI_DEVICE_ID_SL1900, PCI_ANY_ID, PCI_ANY_ID },
+	/* 10b9:5459 */
+	{PCI_VENDOR_ID_AL, PCI_DEVICE_ID_ALI5459, PCI_ANY_ID, PCI_ANY_ID },
+	/* 10b9:5457 */
+	{PCI_VENDOR_ID_AL, PCI_DEVICE_ID_ALI5457, PCI_ANY_ID, PCI_ANY_ID },
+	/* 10b9:545a */
+	{PCI_VENDOR_ID_AL, PCI_DEVICE_ID_ALI545A, PCI_ANY_ID, PCI_ANY_ID },
+	/* 2000:2800 */
+	{PCI_VENDOR_ID_SMARTLINK, PCI_DEVICE_ID_SL2800, PCI_ANY_ID, PCI_ANY_ID },
+	/* 2003:8800 */
+	{PCI_VENDOR_ID_SMARTLINK_3, PCI_DEVICE_ID_ND92XPA, PCI_ANY_ID, PCI_ANY_ID },
+	/* pctel HSP1688 */
+	{ 0x134d, 0x2189, PCI_ANY_ID, PCI_ANY_ID },
+	/* phillips pci modem */
+	{ 0x1131, 0x3400, PCI_ANY_ID, PCI_ANY_ID },
+	{0,}
+};
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
+#define pci_match_id(tbl, dev) pci_match_device(tbl, dev)
+#endif
+
+static int __init softmodem_release_init(void)
+{
+	struct pci_dev *dev = NULL;
+	struct device *reldev;
+        while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+		if(pci_match_id(softmodem_pci_tbl, dev) && pci_dev_driver(dev) &&
+		   (reldev = get_device(&dev->dev)) ) {
+			printk(KERN_INFO "device %04x:%04x is grabbed by driver %s: try to release\n",
+				  dev->vendor, dev->device,
+				  (reldev&&reldev->driver) ? reldev->driver->name : "unknown");
+			device_release_driver(reldev);
+			put_device(reldev);
+		}
+	}
+	return 0;
+}
+
+static void __exit softmodem_release_exit(void)
+{
+}
+
+module_init(softmodem_release_init);
+module_exit(softmodem_release_exit);
+
+MODULE_AUTHOR("linmodems.org");
+MODULE_DESCRIPTION("No driver - just try release softmodem device");
+MODULE_LICENSE("GPL");
--- /dev/null
+++ b/ungrab-winmodem/Makefile
@@ -0,0 +1,23 @@
+
+KERNEL_VER:=$(shell uname -r)
+KERNEL_DIR:=/lib/modules/$(KERNEL_VER)/build
+INSTALL_DIR:=/lib/modules/$(KERNEL_VER)/extra
+
+obj-m := ungrab-winmodem.o
+
+
+all:
+	$(MAKE) modules -C $(KERNEL_DIR) SUBDIRS=$(shell pwd)
+
+clean:
+	$(RM) *.o *.ko *.mod.* .*.cmd *~
+	$(RM) -r .tmp_versions
+
+install: all
+	install -D -m 644 ungrab-winmodem.ko $(INSTALL_DIR)/ungrab-winmodem.ko
+	/sbin/depmod -a
+uninstall:
+	modprobe -r ungrab-winmodem ; echo -n
+	$(RM) $(INSTALL_DIR)/ungrab-winmodem.ko
+	/sbin/depmod -a
+
--- /dev/null
+++ b/ungrab-winmodem/updates.txt
@@ -0,0 +1,10 @@
+
+20082701 - Support for Motorola chipset 1057:3052 retained, and Silicon Instr. 1543:3052 added.
+After testing support removed for 1053:3000, Broadcom and vendor=11d4 Analog Devices Inc (Motorola proxy) removed. 
+Marv Stodolsky
+
+20090716 - Thanks to Philippe Vouters
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+#define pci_find_device pci_get_device
+#endif
+