24 #include <linux/slab.h>
25 #include <linux/module.h>
32 #define ZCD_FORCE_MODEM 0x01
33 #define ZCD_ALLOW_MS 0x02
40 #define RESPONSE_LEN 1024
42 static int option_rezero(
struct us_data *us)
44 const unsigned char rezero_msg[] = {
45 0x55, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12,
46 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x01,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
53 US_DEBUGP(
"Option MS: %s",
"DEVICE MODE SWITCH\n");
59 memcpy(buffer, rezero_msg,
sizeof(rezero_msg));
62 buffer,
sizeof(rezero_msg),
NULL);
87 static int option_inquiry(
struct us_data *us)
89 const unsigned char inquiry_msg[] = {
90 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
91 0x24, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x12,
92 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
98 US_DEBUGP(
"Option MS: %s",
"device inquiry for vendor name\n");
104 memcpy(buffer, inquiry_msg,
sizeof(inquiry_msg));
107 buffer,
sizeof(inquiry_msg),
NULL);
121 result =
memcmp(buffer+8,
"Option", 6);
124 result =
memcmp(buffer+8,
"ZCOPTION", 8);
141 US_DEBUGP(
"Option MS: option_ms_init called\n");
146 result = option_inquiry(us);
148 US_DEBUGP(
"Option MS: vendor is not Option or not determinable,"
149 " no action taken\n");
152 US_DEBUGP(
"Option MS: this is a genuine Option device,"
157 US_DEBUGP(
"Option MS: %s",
"Forcing Modem Mode\n");
158 result = option_rezero(us);
160 US_DEBUGP(
"Option MS: Failed to switch to modem mode.\n");
164 US_DEBUGP(
"Option MS: %s",
"Allowing Mass Storage Mode if device"