Re: LTE umsm

2016-05-21 Thread Chris Cappuccio
Martin Pieuchot [m...@openbsd.org] wrote:
> On 20/05/16(Fri) 09:47, Chris Cappuccio wrote:
> > So to just remove the ifaceno check, here's the diff.
> > 
> > This matches u3g behaviour for SIERRA TRUINSTALL devices. There is
> > still a bit of hardcoded stuff that needs to be reviewed in umsm
> > for other devices. I think yuo@ was trying to match some of these
> > style checks when he added support for these devices (but it
> > does not appear to be necessary to isolate based on ifaceno for
> > u3g)
> 
> Did you try this with the corresponding device?
> 

I tested the 313U and 770S. 



Re: LTE umsm

2016-05-21 Thread Martin Pieuchot
On 20/05/16(Fri) 09:47, Chris Cappuccio wrote:
> So to just remove the ifaceno check, here's the diff.
> 
> This matches u3g behaviour for SIERRA TRUINSTALL devices. There is
> still a bit of hardcoded stuff that needs to be reviewed in umsm
> for other devices. I think yuo@ was trying to match some of these
> style checks when he added support for these devices (but it
> does not appear to be necessary to isolate based on ifaceno for
> u3g)

Did you try this with the corresponding device?

> Index: umsm.c
> ===
> RCS file: /cvs/src/sys/dev/usb/umsm.c,v
> retrieving revision 1.104
> diff -u -p -u -r1.104 umsm.c
> --- umsm.c29 Sep 2015 08:34:28 -  1.104
> +++ umsm.c20 May 2016 16:37:08 -
> @@ -115,6 +115,7 @@ struct umsm_type {
>  
>  static const struct umsm_type umsm_devs[] = {
>   {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, 0},
> + {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_AIRCARD_313U }, 0},
>  
>   {{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_A2502 }, 0},
>   {{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_ADU_500A }, 0},
> @@ -247,6 +248,7 @@ static const struct umsm_type umsm_devs[
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305}, 0},
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, DEV_TRUINSTALL},
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8355}, 0},
> + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_770S}, 0},
>  
>   {{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
>   {{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS_2 }, DEV_UMASS3},
> @@ -358,8 +360,7 @@ umsm_attach(struct device *parent, struc
>  umsm_huawei_changemode(uaa->device);
>   printf("%s: umass only mode. need to reattach\n",
>   sc->sc_dev.dv_xname);
> - } else if ((sc->sc_flag & DEV_TRUINSTALL) &&
> - uaa->ifaceno == 0) {
> + } else if (sc->sc_flag & DEV_TRUINSTALL) {
>   umsm_truinstall_changemode(uaa->device);
>   printf("%s: truinstall mode. need to reattach\n",
>   sc->sc_dev.dv_xname);
> 



Re: LTE umsm

2016-05-20 Thread Chris Cappuccio
So to just remove the ifaceno check, here's the diff.

This matches u3g behaviour for SIERRA TRUINSTALL devices. There is
still a bit of hardcoded stuff that needs to be reviewed in umsm
for other devices. I think yuo@ was trying to match some of these
style checks when he added support for these devices (but it
does not appear to be necessary to isolate based on ifaceno for
u3g)

Index: umsm.c
===
RCS file: /cvs/src/sys/dev/usb/umsm.c,v
retrieving revision 1.104
diff -u -p -u -r1.104 umsm.c
--- umsm.c  29 Sep 2015 08:34:28 -  1.104
+++ umsm.c  20 May 2016 16:37:08 -
@@ -115,6 +115,7 @@ struct umsm_type {
 
 static const struct umsm_type umsm_devs[] = {
{{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, 0},
+   {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_AIRCARD_313U }, 0},
 
{{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_A2502 }, 0},
{{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_ADU_500A }, 0},
@@ -247,6 +248,7 @@ static const struct umsm_type umsm_devs[
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305}, 0},
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, DEV_TRUINSTALL},
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8355}, 0},
+   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_770S}, 0},
 
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS_2 }, DEV_UMASS3},
@@ -358,8 +360,7 @@ umsm_attach(struct device *parent, struc
 umsm_huawei_changemode(uaa->device);
printf("%s: umass only mode. need to reattach\n",
sc->sc_dev.dv_xname);
-   } else if ((sc->sc_flag & DEV_TRUINSTALL) &&
-   uaa->ifaceno == 0) {
+   } else if (sc->sc_flag & DEV_TRUINSTALL) {
umsm_truinstall_changemode(uaa->device);
printf("%s: truinstall mode. need to reattach\n",
sc->sc_dev.dv_xname);



Re: LTE umsm

2016-05-20 Thread Chris Cappuccio
Martin Pieuchot [m...@openbsd.org] wrote:
> On 19/05/16(Thu) 19:27, Chris Cappuccio wrote:
> > Here is a patch to support some newer LTE umsm devices
> > 
> > Yes, the 313U actually has an SD card slot. And yes, it actually
> > changes vendor ID to Airprime after the umsm_truinstall_changemode
> > takes place.
> > 
> > Matching ifaceno == 9 for newer USB_PRODUCT_SIERRA_TRUINSTALL devices
> > is necessary. They don't show up as 0. (It's possible that Huawei will
> > will need the same treatment in umsm_attach if they use newer umsm chips)
> 
> No.  Hardcoding interface number is not the way to go.  Interfaces
> descriptors have a class, subclass and protocol that should be looked
> at. 
> 
> In 3 months a new device will show up with different interfaces layout and
> we will have to hardcode something else?
> 

I agree in principle, however in practice, the goal is to run
umsm_truinstall_changemode to get the device to present itself in a useful
manner.

Before umsm_truinstall_changemode, the class is UICLASS_MASS, subclass
UISUBCLASS_SCSI, and protocol UIPROTO_MASS_BBB. That's a USB disk.

FreeBSD's u3g driver is similar. We could match FreeBSD behavior by simply
removing the ifnaceno check. Then we are just matching on
USB_PRODUCT_SIERRA_TRUINSTALL and UICLASS_MASS.

Chris



Re: LTE umsm

2016-05-20 Thread Martin Pieuchot
On 19/05/16(Thu) 19:27, Chris Cappuccio wrote:
> Here is a patch to support some newer LTE umsm devices
> 
> Yes, the 313U actually has an SD card slot. And yes, it actually
> changes vendor ID to Airprime after the umsm_truinstall_changemode
> takes place.
> 
> Matching ifaceno == 9 for newer USB_PRODUCT_SIERRA_TRUINSTALL devices
> is necessary. They don't show up as 0. (It's possible that Huawei will
> will need the same treatment in umsm_attach if they use newer umsm chips)

No.  Hardcoding interface number is not the way to go.  Interfaces
descriptors have a class, subclass and protocol that should be looked
at. 

In 3 months a new device will show up with different interfaces layout and
we will have to hardcode something else?


> 
> umsm0 at uhub5 port 3 configuration 1 interface 9 "Sierra Wireless, 
> Incorporated USB MMC Storage" rev 2.00/0.00 addr 5
> umsm0: truinstall mode. need to reattach
> umsm0 detached
> umsm0 at uhub5 port 3 configuration 1 interface 0 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom1 at umsm0
> umsm1 at uhub5 port 3 configuration 1 interface 1 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom2 at umsm1
> umsm2 at uhub5 port 3 configuration 1 interface 2 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom3 at umsm2
> umsm3 at uhub5 port 3 configuration 1 interface 3 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom4 at umsm3
> umsm4 at uhub5 port 3 configuration 1 interface 4 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom5 at umsm4
> umass1 at uhub5 port 3 configuration 1 interface 9 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> umass1: using SCSI over Bulk-Only
> scsibus3 at umass1: 2 targets, initiator 0
> sd5 at scsibus3 targ 1 lun 0:  SCSI2 0/direct removable 
> serial.0f3d68aa615000291196
> umsm5 at uhub5 port 3 configuration 1 interface 7 "Sierra Wireless, 
> Incorporated AirCard 313U" rev 2.00/0.06 addr 5
> ucom6 at umsm5
> 
> Aircard 770S:
> 
> umsm0 at uhub5 port 3 configuration 1 interface 9 "NETGEAR, Inc. AirCard 
> 770S" rev 2.00/0.06 addr 5
> umsm0: truinstall mode. need to reattach
> umsm0 detached
> umsm0 at uhub5 port 3 configuration 1 interface 3 "NETGEAR, Inc. AirCard 
> 770S" rev 2.00/0.06 addr 5
> ucom1 at umsm0
> umsm1 at uhub5 port 3 configuration 1 interface 8 "NETGEAR, Inc. AirCard 
> 770S" rev 2.00/0.06 addr 5
> ucom2 at umsm1
> umsm2 at uhub5 port 3 configuration 1 interface 0 "NETGEAR, Inc. AirCard 
> 770S" rev 2.00/0.06 addr 5
> ucom3 at umsm2
> 
> Index: umsm.c
> ===
> RCS file: /cvs/src/sys/dev/usb/umsm.c,v
> retrieving revision 1.104
> diff -u -p -u -r1.104 umsm.c
> --- umsm.c29 Sep 2015 08:34:28 -  1.104
> +++ umsm.c20 May 2016 02:05:54 -
> @@ -115,6 +115,7 @@ struct umsm_type {
>  
>  static const struct umsm_type umsm_devs[] = {
>   {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, 0},
> + {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_AIRCARD_313U }, 0},
>  
>   {{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_A2502 }, 0},
>   {{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_ADU_500A }, 0},
> @@ -247,6 +248,7 @@ static const struct umsm_type umsm_devs[
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305}, 0},
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, DEV_TRUINSTALL},
>   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8355}, 0},
> + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_770S}, 0},
>  
>   {{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
>   {{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS_2 }, DEV_UMASS3},
> @@ -359,7 +361,7 @@ umsm_attach(struct device *parent, struc
>   printf("%s: umass only mode. need to reattach\n",
>   sc->sc_dev.dv_xname);
>   } else if ((sc->sc_flag & DEV_TRUINSTALL) &&
> - uaa->ifaceno == 0) {
> + (uaa->ifaceno == 0 || uaa->ifaceno == 9)) {
>   umsm_truinstall_changemode(uaa->device);
>   printf("%s: truinstall mode. need to reattach\n",
>   sc->sc_dev.dv_xname);
> 



LTE umsm

2016-05-19 Thread Chris Cappuccio
Here is a patch to support some newer LTE umsm devices

Yes, the 313U actually has an SD card slot. And yes, it actually
changes vendor ID to Airprime after the umsm_truinstall_changemode
takes place.

Matching ifaceno == 9 for newer USB_PRODUCT_SIERRA_TRUINSTALL devices
is necessary. They don't show up as 0. (It's possible that Huawei will
will need the same treatment in umsm_attach if they use newer umsm chips)

ok?

Aircard 313U:

umsm0 at uhub5 port 3 configuration 1 interface 9 "Sierra Wireless, 
Incorporated USB MMC Storage" rev 2.00/0.00 addr 5
umsm0: truinstall mode. need to reattach
umsm0 detached
umsm0 at uhub5 port 3 configuration 1 interface 0 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom1 at umsm0
umsm1 at uhub5 port 3 configuration 1 interface 1 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom2 at umsm1
umsm2 at uhub5 port 3 configuration 1 interface 2 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom3 at umsm2
umsm3 at uhub5 port 3 configuration 1 interface 3 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom4 at umsm3
umsm4 at uhub5 port 3 configuration 1 interface 4 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom5 at umsm4
umass1 at uhub5 port 3 configuration 1 interface 9 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
umass1: using SCSI over Bulk-Only
scsibus3 at umass1: 2 targets, initiator 0
sd5 at scsibus3 targ 1 lun 0:  SCSI2 0/direct removable 
serial.0f3d68aa615000291196
umsm5 at uhub5 port 3 configuration 1 interface 7 "Sierra Wireless, 
Incorporated AirCard 313U" rev 2.00/0.06 addr 5
ucom6 at umsm5

Aircard 770S:

umsm0 at uhub5 port 3 configuration 1 interface 9 "NETGEAR, Inc. AirCard 770S" 
rev 2.00/0.06 addr 5
umsm0: truinstall mode. need to reattach
umsm0 detached
umsm0 at uhub5 port 3 configuration 1 interface 3 "NETGEAR, Inc. AirCard 770S" 
rev 2.00/0.06 addr 5
ucom1 at umsm0
umsm1 at uhub5 port 3 configuration 1 interface 8 "NETGEAR, Inc. AirCard 770S" 
rev 2.00/0.06 addr 5
ucom2 at umsm1
umsm2 at uhub5 port 3 configuration 1 interface 0 "NETGEAR, Inc. AirCard 770S" 
rev 2.00/0.06 addr 5
ucom3 at umsm2

Index: umsm.c
===
RCS file: /cvs/src/sys/dev/usb/umsm.c,v
retrieving revision 1.104
diff -u -p -u -r1.104 umsm.c
--- umsm.c  29 Sep 2015 08:34:28 -  1.104
+++ umsm.c  20 May 2016 02:05:54 -
@@ -115,6 +115,7 @@ struct umsm_type {
 
 static const struct umsm_type umsm_devs[] = {
{{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, 0},
+   {{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_AIRCARD_313U }, 0},
 
{{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_A2502 }, 0},
{{ USB_VENDOR_ANYDATA,  USB_PRODUCT_ANYDATA_ADU_500A }, 0},
@@ -247,6 +248,7 @@ static const struct umsm_type umsm_devs[
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305}, 0},
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, DEV_TRUINSTALL},
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8355}, 0},
+   {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_770S}, 0},
 
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS_2 }, DEV_UMASS3},
@@ -359,7 +361,7 @@ umsm_attach(struct device *parent, struc
printf("%s: umass only mode. need to reattach\n",
sc->sc_dev.dv_xname);
} else if ((sc->sc_flag & DEV_TRUINSTALL) &&
-   uaa->ifaceno == 0) {
+   (uaa->ifaceno == 0 || uaa->ifaceno == 9)) {
umsm_truinstall_changemode(uaa->device);
printf("%s: truinstall mode. need to reattach\n",
sc->sc_dev.dv_xname);