Bug #1324

[PATCH] ugensa.c: better handling of Huawei Modems

Added by bmk over 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:alexh% Done:

0%

Category:-
Target version:-

Description

Device code for E169 was there (as Huawei Mobile Connect), but it was
showing up as a single mass storage device, so I added it to the E220
re-attach code.

My Patch has no effect. Can anyone tell my why?

Patch follows:
--- ugensa.c.orig 2009-03-28 10:12:26.000000000 +1100
+++ ugensa.c 2009-03-28 10:24:34.000000000 +1100
@@ -131,7 +131,7 @@
{ USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881E */
{ USB_DEVICE(0x1199, 0x6855) }, /* Sierra Wireless AirCard 880U */
{ USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881U */
- { USB_DEVICE(0x12d1, 0x1001) }, /* Huawei Mobile Connect */
+ { USB_DEVICE(0x12d1, 0x1001) }, /* Huawei Mobile Connect/E169 */
{ USB_DEVICE(0x12d1, 0x1003) }, /* Huawei Mobile E220 */
{ USB_DEVICE(0x12d1, 0x1004) }, /* Huawei Mobile E220 */
{ USB_DEVICE(0x1410, 0x1100) }, /* Novatel Wireless Merlin
XS620/S640 */
@@ -186,7 +186,8 @@
*/
id = usbd_get_interface_descriptor(uaa->iface);
if (id == NULL || id->bInterfaceClass == UICLASS_MASS) {
- if ((uaa->vendor == 0x12d1 && uaa->product == 0x1003) ||
+ if ((uaa->vendor == 0x12d1 && uaa->product == 0x1001) ||
+ (uaa->vendor == 0x12d1 && uaa->product == 0x1003) ||
(uaa->vendor == 0x12d1 && uaa->product == 0x1004)) {
if (uaa->nifaces == 1)
return UMATCH_VENDOR_IFACESUBCLASS;
@@ -219,7 +220,8 @@

id = usbd_get_interface_descriptor(ucom->sc_iface);
if (id == NULL || id->bInterfaceClass == UICLASS_MASS) {
- if ((uaa->vendor == 0x12d1 && uaa->product == 0x1003) ||
+ if ((uaa->vendor == 0x12d1 && uaa->product == 0x1001) ||
+ (uaa->vendor == 0x12d1 && uaa->product == 0x1003) ||
(uaa->vendor == 0x12d1 && uaa->product == 0x1004)) {
ugensa_e220_changemode(uaa->device);
}

huawei.patch Magnifier (2.84 KB) alexh, 05/06/2009 07:06 AM

History

#1 Updated by swildner over 5 years ago

Does anything show in dmesg when running with your patch?

#2 Updated by bmk about 5 years ago

dmesg shows these extra lines when device plugged in:

umass0:
<\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?\M^?
HUAWEI Mobile, class 0/0, rev 1.10/0.00, addr 2> on uhub1
cd1 at umass-sim0 bus 0 target 0 lun 0
cd1: <HUAWEI Mass Storage 2.31> Removable CD-ROM SCSI-2 device
cd1: 1.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present

NOTE_1: dmesg is the same with or without my patch.
NOTE_2: I think the "Medium not present" is the empty MicroSD slot

#3 Updated by bmk about 5 years ago

Also, if anyone wants SSH root access to my box with E169 attached,
please let me know on this bug thread.

#4 Updated by alexh about 5 years ago

I've been looking a bit into the issue and made a few changes; the diff is
attached. Can you try and see if it helps?

PS: There might be a typo somewhere that doesn't allow to compile; haven't tried
it myself, but if so it should be trivial to fix.

#5 Updated by bmk about 5 years ago

Thanks Alex!!! Your patch works perfectly.

I am now surfing the net with E169 using pppd via /dev/ucom0.

Please submit/commit this.

#6 Updated by alexh about 5 years ago

Thanks for testing it.

I will clean it up a bit and then post it in my git repo. Don't commit it just
yet.

#7 Updated by alexh about 5 years ago

Ok, I've rewritten my fix to be a bit cleaner.
Here it is:
http://gitweb.dragonflybsd.org/~alexh/dragonfly.git/commit/e39cf0de1bdc15127d00a
87fc6daa6b7dd8d3725

bmk, if you can give it a try, I'd be thankful; although it pretty much is the
same, just done differently.

#8 Updated by bmk about 5 years ago

Hi Alex, version 2 of you patch is not building:

===> dev/usbmisc/ugensa
cc -O -pipe -D_KERNEL -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual -Werror-implicit-function-declaration -std=c99
-DKLD_MODULE -nostdinc -I. -I@ -I/usr/src/sys/compile/GENERIC_p2
-I/usr/src/sys/compile/GENERIC_p2/include -I/usr/include -include
/usr/src/sys/compile/GENERIC_p2/opt_global.h -g -finline-limit=8000
--param inline-unit-growth=100 --param large-function-growth=1000
-fno-common -ffreestanding -mpreferred-stack-boundary=2
-fno-stack-protector -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
-Werror-implicit-function-declaration -std=c99 -c
/usr/src/sys/dev/usbmisc/ugensa/ugensa.c
/usr/src/sys/dev/usbmisc/ugensa/ugensa.c: In function 'ugensa_match':
/usr/src/sys/dev/usbmisc/ugensa/ugensa.c:186: error: expected ')' before
'{' token
/usr/src/sys/dev/usbmisc/ugensa/ugensa.c:202: error: expected expression
before '}' token
/usr/src/sys/dev/usbmisc/ugensa/ugensa.c:172: warning: unused variable 'id'
*** Error code 1

Stop in /usr/src/sys/dev/usbmisc/ugensa.
*** Error code 1

Stop in /usr/src/sys/dev/usbmisc.
*** Error code 1

Stop in /usr/src/sys/dev.
*** Error code 1

Stop in /usr/src/sys.
*** Error code 1

Stop in /usr/src/sys/compile/GENERIC_p2.
#

#9 Updated by alexh about 5 years ago

ah, I see, small typo. Can you please try compiling with the following change
while I update my git repo?
change: if ((uaa->vendor == 0x12d1) {
to: if (uaa->vendor == 0x12d1) {

Thank you very much for testing it!

#10 Updated by bmk about 5 years ago

Woops, not sure why but I lost the subject on my bug thread. Just
putting the subject back...

#11 Updated by bmk about 5 years ago

Hi Alex,

I fixed the typo & it builds & works fine now.

Thanks...

#12 Updated by alexh about 5 years ago

Thanks for testing, I'll be fixing the typo in my repository in a while so it can
get commited.

#13 Updated by alexh about 5 years ago

Ok, I've fixed the typo in the repository, it can be found here:
http://gitweb.dragonflybsd.org/~alexh/dragonfly.git/commit/a1dd727dadf2e15512ff1
2f0b4ad23d1b365d37c

As Brendan has already tested this successfully, I think it is ready.

#14 Updated by swildner about 5 years ago

Committed -> 7ffe1f6754372419182d1b1ab761af18a6d28090

Also available in: Atom PDF