6 #include <linux/module.h>
7 #include <linux/slab.h>
16 #define SWIMS_USB_REQUEST_SetSwocMode 0x0B
17 #define SWIMS_USB_REQUEST_GetSwocInfo 0x0A
18 #define SWIMS_USB_INDEX_SetMode 0x0000
19 #define SWIMS_SET_MODE_Modem 0x0001
21 #define TRU_NORMAL 0x01
22 #define TRU_FORCE_MS 0x02
23 #define TRU_FORCE_MODEM 0x03
25 static unsigned int swi_tru_install = 1;
28 " 2=Force CD-Rom, 3=Force Modem)");
38 static bool containsFullLinuxPackage(
struct swoc_info *swocInfo)
47 static int sierra_set_ms_mode(
struct usb_device *
udev,
__u16 eSWocMode)
50 US_DEBUGP(
"SWIMS: %s",
"DEVICE MODE SWITCH\n");
58 USB_CTRL_SET_TIMEOUT);
63 static int sierra_get_swoc_info(
struct usb_device *
udev,
68 US_DEBUGP(
"SWIMS: Attempting to get TRU-Install info.\n");
77 USB_CTRL_SET_TIMEOUT);
84 static void debug_swoc(
struct swoc_info *swocInfo)
97 struct usb_device *udev = interface_to_usbdev(intf);
104 US_DEBUGP(
"SWIMS: Allocation failure\n");
108 result = sierra_get_swoc_info(udev, swocInfo);
115 debug_swoc(swocInfo);
117 "REV=%02d SKU=%04X VER=%04X\n",
131 struct usb_device *
udev;
141 US_DEBUGP(
"SWIMS: sierra_ms_init called\n");
145 US_DEBUGP(
"SWIMS: %s",
"Forcing Modem Mode\n");
148 US_DEBUGP(
"SWIMS: Failed to switch to modem mode.\n");
153 US_DEBUGP(
"SWIMS: %s",
"Forcing Mass Storage Mode\n");
158 US_DEBUGP(
"SWIMS: %s",
"Normal SWoC Logic\n");
163 US_DEBUGP(
"SWIMS: %s",
"Allocation failure\n");
170 result = sierra_get_swoc_info(udev, swocInfo);
172 US_DEBUGP(
"SWIMS: %s",
"Failed SWoC query\n");
175 }
while (retries && result < 0);
179 "Completely failed SWoC query\n");
184 debug_swoc(swocInfo);
189 if (!containsFullLinuxPackage(swocInfo)) {
191 "Switching to Modem Mode\n");
192 result = sierra_set_ms_mode(udev,
195 US_DEBUGP(
"SWIMS: Failed to switch modem\n");