EC20 » History » Version 1
zecke, 09/26/2016 06:06 PM
1 | 1 | zecke | h1. Wiki |
---|---|---|---|
2 | |||
3 | Switching on adb (or fastboot or debug to NMEA console) |
||
4 | |||
5 | <pre> |
||
6 | AT+QLINUXCMD="/usr/bin/usb_uartdiag" |
||
7 | AT+QFASTBOOT |
||
8 | AT+QLINUXCMD="echo foo > /dev/ttyGS0" |
||
9 | </pre> |
||
10 | |||
11 | |||
12 | Changing qcserial.c to have adb and ttyUSBs.. |
||
13 | |||
14 | <pre> |
||
15 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
||
16 | index 51da652..2d8d09e 100644 |
||
17 | --- a/drivers/usb/serial/qcserial.c |
||
18 | +++ b/drivers/usb/serial/qcserial.c |
||
19 | @@ -176,8 +176,9 @@ static const struct usb_device_id id_table[] = { |
||
20 | }; |
||
21 | MODULE_DEVICE_TABLE(usb, id_table); |
||
22 | |||
23 | -static int handle_quectel_ec20(struct device *dev, int ifnum) |
||
24 | +static int handle_quectel_ec20(struct usb_device *usbdev, int ifnum) |
||
25 | { |
||
26 | + struct device *dev = &usbdev->dev; |
||
27 | int altsetting = 0; |
||
28 | |||
29 | /* |
||
30 | @@ -201,10 +202,12 @@ static int handle_quectel_ec20(struct device *dev, int ifnum) |
||
31 | dev_dbg(dev, "Quectel EC20 Modem port found\n"); |
||
32 | break; |
||
33 | case 4: |
||
34 | - case 5: |
||
35 | /* Don't claim the QMI/net or debug interface */ |
||
36 | altsetting = -1; |
||
37 | break; |
||
38 | + case 5: |
||
39 | + usb_set_interface(usbdev, ifnum, 0); |
||
40 | + altsetting = -1; |
||
41 | } |
||
42 | |||
43 | return altsetting; |
||
44 | @@ -285,7 +288,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
||
45 | case QCSERIAL_G2K: |
||
46 | /* handle non-standard layouts */ |
||
47 | if ((nintf == 5 || nintf == 6) && id->idProduct == QUECTEL_EC20_PID) { |
||
48 | - altsetting = handle_quectel_ec20(dev, ifnum); |
||
49 | + altsetting = handle_quectel_ec20(serial->dev, ifnum); |
||
50 | goto done; |
||
51 | } |
||
52 | |||
53 | </pre> |
||
54 | |||
55 | |||
56 | <pre> |
||
57 | Not working userspace code |
||
58 | |||
59 | #include <libusb.h> |
||
60 | |||
61 | #include <stdio.h> |
||
62 | #include <stdlib.h> |
||
63 | |||
64 | int main(int argc, char **argv) |
||
65 | { |
||
66 | struct libusb_device_handle *devh; |
||
67 | int rc; |
||
68 | |||
69 | rc = libusb_init(NULL); |
||
70 | printf("%d\n", rc); |
||
71 | |||
72 | devh = libusb_open_device_with_vid_pid(NULL, 0x05c6, 0x9215); |
||
73 | if (!devh) { |
||
74 | abort(); |
||
75 | } |
||
76 | rc = libusb_claim_interface(devh, 5); |
||
77 | printf("%d\n", rc); |
||
78 | //rc = libusb_detach_kernel_driver(devh, 5); |
||
79 | //printf("%d\n", rc); |
||
80 | rc = libusb_set_interface_alt_setting(devh, 5, 0); |
||
81 | printf("%d\n", rc); ====> currently prints -5 but is like the one above.. |
||
82 | return EXIT_FAILURE; |
||
83 | } |