Re: Huawei E353 as HiLink device

2017-02-05 Thread Karl Pettersson
On Sun, Feb 05, 2017 at 12:46:51PM +, Stuart Henderson wrote:
> On 2017-02-03, Karl Pettersson  wrote:
> > I have a Huwaei E353 USB device, which I use to connect with the tre.se
> > Internet provider. This device initially attaches as a mass storage
> > device with product id 1f01. Under Linux, it is then switched to HiLink
> > Ethernet mode with the usb_modeswitch program. OpenBSD 6.0 instead makes the
> > device attach as a umsm modem device (after initially identifying it as
> > a UMASS5 storage device), and I have been unable to connect
> > using ppp in that mode. Maybe the device is not supposed to be used
> > that way: AT^SETPORT=? does not even list modem mode as
> > available.
> >
> > I made the following changes to src/sys/dev/usb/umsm.c, after the
> > settings in the device_reference.txt for usb_modeswitch (l 2632):
> >
> > *** 704,709 
> > --- 704,711 
> > cbw.bCBWFlags = CBWFLAGS_OUT;
> > cbw.CBWCDB[0] = 0x11;
> > cbw.CBWCDB[1] = 0x06;
> > +   cbw.CBWCDB[2] = 0x20;
> > +   cbw.CBWCDB[8] = 0x01;
> > break;
> > case DEV_UMASS6:/* ZTE */
> > USETDW(cbw.dCBWDataTransferLength, 0x20);
> >
> > After I recompiled the kernel with these changes, the device correctly
> > attaches as a cdce Ethernet device, and after giving the following 
> > commands, I
> > can use my Internet connection normally:
> >
> > # ifconfig cdce0 up
> > # dhclient cdce0
> >
> > So, these changes should perhaps be merged with the default kernel?
> >
> > Regards,
> > Karl Pettersson
> >
> >
> 
> This code is used by 11 different entries in umsm(4)'s device id table,
> some of which may not support this, so would either need matching against
> only this device id, or testing with a wide range of other Huaweis.
> 
> Even then, presumably there are some devices with this product id which
> *do* work (it may be that the mobile provider can programme the device to
> provide only certain modes). So those users would need notice in release
> notes etc about the change of device type, otherwise they might not be
> able to get into a remote machine following an upgrade..
>

Yes, in usbdevs (l. 2214), the 1f01 id is connected with a different
Huawei device (E303), and in the usb_modeswitch file, it is connected
with E353 with tre.se and yet another different device (E355s-1), while
E353 with unspecified provider has id 151a. So, I certainly agree that
testing with different devices would be necessary before merging my
additions.



Re: Huawei E353 as HiLink device

2017-02-05 Thread Stuart Henderson
On 2017-02-03, Karl Pettersson  wrote:
> I have a Huwaei E353 USB device, which I use to connect with the tre.se
> Internet provider. This device initially attaches as a mass storage
> device with product id 1f01. Under Linux, it is then switched to HiLink
> Ethernet mode with the usb_modeswitch program. OpenBSD 6.0 instead makes the
> device attach as a umsm modem device (after initially identifying it as
> a UMASS5 storage device), and I have been unable to connect
> using ppp in that mode. Maybe the device is not supposed to be used
> that way: AT^SETPORT=? does not even list modem mode as
> available.
>
> I made the following changes to src/sys/dev/usb/umsm.c, after the
> settings in the device_reference.txt for usb_modeswitch (l 2632):
>
> *** 704,709 
> --- 704,711 
>   cbw.bCBWFlags = CBWFLAGS_OUT;
>   cbw.CBWCDB[0] = 0x11;
>   cbw.CBWCDB[1] = 0x06;
> + cbw.CBWCDB[2] = 0x20;
> + cbw.CBWCDB[8] = 0x01;
>   break;
>   case DEV_UMASS6:/* ZTE */
>   USETDW(cbw.dCBWDataTransferLength, 0x20);
>
> After I recompiled the kernel with these changes, the device correctly
> attaches as a cdce Ethernet device, and after giving the following commands, I
> can use my Internet connection normally:
>
> # ifconfig cdce0 up
> # dhclient cdce0
>
> So, these changes should perhaps be merged with the default kernel?
>
> Regards,
> Karl Pettersson
>
>

This code is used by 11 different entries in umsm(4)'s device id table,
some of which may not support this, so would either need matching against
only this device id, or testing with a wide range of other Huaweis.

Even then, presumably there are some devices with this product id which
*do* work (it may be that the mobile provider can programme the device to
provide only certain modes). So those users would need notice in release
notes etc about the change of device type, otherwise they might not be
able to get into a remote machine following an upgrade..



Huawei E353 as HiLink device

2017-02-03 Thread Karl Pettersson
I have a Huwaei E353 USB device, which I use to connect with the tre.se
Internet provider. This device initially attaches as a mass storage
device with product id 1f01. Under Linux, it is then switched to HiLink
Ethernet mode with the usb_modeswitch program. OpenBSD 6.0 instead makes the
device attach as a umsm modem device (after initially identifying it as
a UMASS5 storage device), and I have been unable to connect
using ppp in that mode. Maybe the device is not supposed to be used
that way: AT^SETPORT=? does not even list modem mode as
available.

I made the following changes to src/sys/dev/usb/umsm.c, after the
settings in the device_reference.txt for usb_modeswitch (l 2632):

*** 704,709 
--- 704,711 
cbw.bCBWFlags = CBWFLAGS_OUT;
cbw.CBWCDB[0] = 0x11;
cbw.CBWCDB[1] = 0x06;
+   cbw.CBWCDB[2] = 0x20;
+   cbw.CBWCDB[8] = 0x01;
break;
case DEV_UMASS6:/* ZTE */
USETDW(cbw.dCBWDataTransferLength, 0x20);

After I recompiled the kernel with these changes, the device correctly
attaches as a cdce Ethernet device, and after giving the following commands, I
can use my Internet connection normally:

# ifconfig cdce0 up
# dhclient cdce0

So, these changes should perhaps be merged with the default kernel?

Regards,
Karl Pettersson