Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: onelife on October 19, 2021, 02:16:21 AM

Title: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 19, 2021, 02:16:21 AM
Hi there,

I'm trying to get a modem :

Code: [Select]
Bus 001 Device 007: ID 12d1:14fe Huawei Technologies Co., Ltd. Modem (Mass Storage Mode)
To connect in the easiest mode (Previously was cdc_ether / Hi Link mode on an older similar modem)

Now this modem is either not switching correctly as USB Modeswitch is OLD, OR I now need to use a wwan0 interface and get a connection that way as that seems to be the only mode it will switch to as :

Code: [Select]
Bus 001 Device 006: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
Any ideas where I start?

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 19, 2021, 05:03:15 AM
usb-modeswitch posted (not tested)
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 19, 2021, 06:25:05 AM
Thank you Juanito - Appreciated.

Saly this hasn't made any difference from what I can see - I still can't seem to get the modem into the "old cdc_ether" / Hilink mode.

It is still only switching to a wwan0 interface with no connection.

Have you ever worked with this setup before?

It's so weird, I had on Friday a connection in what I thought was hi link mode, but nothing I do now can replicate this - I've followed just about every google search option for how to connect this modem but no luck.

There is no ttyUSB interface created, and no eth1 interface either.

Any suggestions on how I get this connected?

Thanks again.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 19, 2021, 06:49:37 AM
I could be way off - BUT when I look at the switched modem in the mode that supposedly could work :

Code: [Select]
Bus 001 Device 012: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
I see this :

Code: [Select]
   Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol     22
      iInterface              0
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  06 24 1a 00 01 1f
      ** UNRECOGNIZED:  0d 24 0f 01 05 00 00 00 ea 05 03 00 01
      ** UNRECOGNIZED:  05 24 06 01 01

I don't know enough, but to me this looks like TC13 hasn't been able to bring the interface up and this is perhaps why I am not seeing anything even though the mode switch has actually happened? Perhaps?

Thanks
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 19, 2021, 07:55:27 AM
Do they have a windows driver/configuration tool?   Some devices can be programmed as to which mode they startup in.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 19, 2021, 09:25:10 AM
Sadly I can't find anything. I found a firmware tool and ran that just to see if made any difference but nothing changed. With new firmware still the same.

So what to try?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 19, 2021, 10:56:01 AM
Does dmesg show any usb/modem related error messages?

Are and drivers in net-usb-KERNEL required?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 19, 2021, 11:58:48 AM
My dmesg does show the wwan0 interface but no connection is started and according to forums I need to set AT command to start the connection on /dev/ttyUSB or /dev/cdc-wdm - BUT none of those interfaces come up :( My dmesg after switch looks like :

Code: [Select]
[   85.375925] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1506, bcdDevice= 1.02
[   85.375944] usb 1-1.2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[   85.375959] usb 1-1.2: Product: HUAWEI Mobile
[   85.375974] usb 1-1.2: Manufacturer: HUAWEI
[   85.379638] usb-storage 1-1.2:1.4: USB Mass Storage device detected
[   85.380440] scsi host0: usb-storage 1-1.2:1.4
[   85.381333] usb-storage 1-1.2:1.5: USB Mass Storage device detected
[   85.382117] scsi host1: usb-storage 1-1.2:1.5
[   85.411642] usbcore: registered new interface driver cdc_wdm
[   85.435373] cdc_ncm 1-1.2:1.1: MAC-Address: 58:2c:80:13:92:63
[   85.435387] cdc_ncm 1-1.2:1.1: setting rx_max = 16384
[   85.435613] cdc_ncm 1-1.2:1.1: setting tx_max = 16384
[   85.436173] cdc_ncm 1-1.2:1.1 wwan0: register 'cdc_ncm' at usb-3f980000.usb-1.2, Mobile Broadband Network Device, 58:2c:80:13:92:63
[   85.436337] usbcore: registered new interface driver cdc_ncm
[   85.438191] usbcore: registered new interface driver cdc_mbim
[   86.395541] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[   86.395996] scsi 1:0:0:0: Direct-Access     HUAWEI   SD Storage       2.31 PQ: 0 ANSI: 2
[   86.446276] sd 1:0:0:0: [sda] Attached SCSI removable disk

So scratching head ;) where to now?

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 19, 2021, 01:40:19 PM
I don't have a device like this, but from what I gather, USB modeswitch needs to switch the mode prior to the kernel loading the USB storage drivers.   Which means you have to do it with a udev rule.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 19, 2021, 09:37:49 PM
usb-modeswitch-data contains a database of usb ids and a udev rule - I see 12d1:1505 at /usr/local/share/usb_modeswitch, but not 12d1:1506, is it in /usr/local/share/usb_modeswitch/new.lst?

See also: https://www.draisberghof.de/usb_modeswitch/#usage
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 21, 2021, 10:07:52 AM
Hi guys,

2 more days at poking ta this and no luck :( - How do I add a udev rule? As now today maybe just maybe it is a udev issue as the system is switching the usb stick perhaps before my usb modeswitch command - Reason I say this is today I have used a different usb stick and according to lsusb, it's now the same - very odd???? It's as if the udev rule (if that's what they do) is setting the mode when I plug the stick in before I get to run the manual modeswitch.

So where to now? Perhaps Paul you're able to help? I can even open direct ssh access to this system if that will prove to be easier - I really just need to solve this :(

Hope we can soon - Regards.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 21, 2021, 10:41:54 AM
Aha, maaaybe a small step forward - I added tcz usb-serial and now I managed to get the mentioned /dev/ttyUSB paths show.

However, the next step of issuing a command on these /dev/ttyUSB interfaces to initiate an internet connection doesn't seem to work.

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 21, 2021, 12:19:21 PM
Seems like it would be much easier to get a different wifi stick that is directly supported under the RPI Linux kernel.

EdiMax EW-7811Un is a tried and true device.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 21, 2021, 12:26:10 PM
Thanks for that thought Paul - Although the USB stick is a GSM modem, not wifi. I also have 100+ devices I need to get live asap as part of a bigger network of a few thousand devices :( - This modem worked on TC8.1.5 so really think it should be possible on TC13.0.3?

As I've mentioned in a previous post - ANY urgent help will be appreciated so I can solve this :( - ANY takers to see where I'm going wrong?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 21, 2021, 12:37:40 PM
Oh, GSM modem.  That is a different beast.  I have no experience there.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 21, 2021, 12:39:29 PM
TC8->TC13 is a major change in kernels. 
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: patrikg on October 21, 2021, 01:08:30 PM
Have you tried to use some serial communication program like minicom screen.
To communicate to the /dev/ttyUSBX (X=the device nr) to send some AT Commands and maybe use the ppp communication protocol.

Like something like this.

https://wiki.archlinux.org/title/3G_and_GPRS_modems_with_pppd

And maybe you can hook the working usb modem to a windows computer and debug the serial communication to see what commands it sends from a working device driver.
Don't know if this is the correct program or this work with the current windows version.

https://docs.microsoft.com/sv-se/sysinternals/downloads/portmon

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 21, 2021, 01:57:32 PM
Hummmm, maybe I'm onto something here ... LOL - How can we update the usb_modeswitch tcz?  I see the version in the repo is very old :(

snb@snb:~$ usb_modeswitch -e

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.1.0 (C) Josua Dietze 2013
 * Based on libusb1/libusbx

It's possible I need 2.2.5 or upwards - Without compiling as such anyone able to help with a new usb_modeswitch build?

Thank you!
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: patrikg on October 21, 2021, 02:14:01 PM
Here some start links:

http://tinycorelinux.net/5.x/x86/tcz/src/usb-modeswitch/
http://tinycorelinux.net/5.x/x86/tcz/src/usb-modeswitch-data/
http://tinycorelinux.net/4.x/x86/tcz/src/usb-modeswitch/
http://tinycorelinux.net/4.x/x86/tcz/src/usb-modeswitch-data/
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 21, 2021, 10:25:28 PM
Unless something was missed, the extensions posted recently in the piCore repos are the latest versions:

http://www.tinycorelinux.net/13.x/armv6/tcz/usb-modeswitch.tcz.info
http://www.tinycorelinux.net/13.x/armv6/tcz/usb-modeswitch-data.tcz.info
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 03:09:43 AM
So seems modeswitch is correct so something else :(

I'm now wondering if modemmanager has all it's requirements as when I try use mmcli -L I get :

snb@snb:~$ mmcli -L
error: couldn't get bus: Could not connect: No such file or directory

Does that mean anything to anyone?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 04:53:02 AM
You need to start the dbus daemon
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 05:30:27 AM
do I need to do that as a boot command or? I just installed the dbus.tcz - perhaps that creates the /etc/init.d/ file to start?

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 05:34:24 AM
You need to start the daemon manually - see the info file
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 06:08:43 AM
Ah - the info file doesn’t say much - “sudo /usr/local/etc/init.d/dbus start”
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 06:22:04 AM
after doing that and then when I query "status" all I get is :

Code: [Select]
snb@snb:~$ sudo /usr/local/etc/init.d/dbus status

dbus is not running.

I'm literally begging ANYONE on this forum that wants some paid work to PLEASE help me! I'm stuck, I'm taking shots in the dark and not getting anywhere.

I believe these modems should work 100% - But can't get them right - Please there must be someone??
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 06:36:43 AM
How did you download dbus?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 06:40:45 AM
Normal tce-ab
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 06:53:57 AM
Are you missing a dep:
Code: [Select]
$ ldd `which dbus-daemon`
        linux-vdso.so.1 (0x7ef98000)
        libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x76f1e000)
        libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x76ef2000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x76ec8000)
        libc.so.6 => /lib/libc.so.6 (0x76d81000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x76d52000)
        /lib/ld-linux-armhf.so.3 (0x76f6d000)
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 07:37:48 AM
I think I have identical :

Code: [Select]
snb@snb:~$ ldd `which dbus-daemon`
linux-vdso.so.1 (0x7eff5000)
libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x76ecf000)
libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x76ea3000)
libpthread.so.0 => /lib/libpthread.so.0 (0x76e79000)
libc.so.6 => /lib/libc.so.6 (0x76d32000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x76d03000)
/lib/ld-linux-armhf.so.3 (0x76f1e000)
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 07:42:26 AM
When I start the dbus daemon the status reports that it has started..
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 08:34:14 AM
I also don't want to side track from the modem - but noticed this in dmesg - Doesn't look good - But maybe it's fine?

Code: [Select]
[   17.611855] cfg80211: Problem loading in-kernel X.509 certificate (-22)
[   17.612030] cfg80211: failed to load regulatory.db

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 22, 2021, 08:44:42 AM
That loads correctly for me, what exact version of piCore are you using on which RPi?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 22, 2021, 08:52:35 AM
Code: [Select]
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : BCM2835
Revision : a020d3
Serial : 0000000058da172e
Model : Raspberry Pi 3 Model B Plus Rev 1.3

snb@snb:~$ version
13.0.3

snb@snb:~$ uname -a
Linux snb 5.10.16-piCore-v7 #1 SMP Tue Feb 16 19:08:42 UTC 2021 armv7l GNU/Linux
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 23, 2021, 12:04:03 AM
After some more checking, modemmanager needed org.freedesktop.ModemManager1.conf and networkmanager to be running in oder to work - networkmanager was broken by an update to nettle, so nettle7 has been added to its dep file.

With the updated modemmanager and networkmanager:

without networkmanager running:
Code: [Select]
$ mmcli -L
error: couldn't find the ModemManager process in the bus

with networkmanager running:
Code: [Select]
$ mmcli -L
No modems were found
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 23, 2021, 12:48:23 AM
..which is to be expected without a modem to test (testing done with an RPi3 using piCore-13.0.3).

What is not clear is why you cannot start the dbus daemon and why you believe the usb-modeswitch extensions are not the most recent versions.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Rich on October 23, 2021, 05:54:27 AM
Hi Juanito
... why you believe the usb-modeswitch extensions are not the most recent versions.
In reply #17 he said he ran  "usb_modeswitch -e"  which reported  "Version 2.1.0 (C) Josua Dietze 2013".

Then in reply #20 he said:
So seems modeswitch is correct so something else :( ...
So maybe he then updated his extensions.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 23, 2021, 07:04:09 AM
That's what's confusing - usb-modeswitch wasn't in the repo before, and now:
Code: [Select]
$ usb_modeswitch -e

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.6.0 (C) Josua Dietze 2017
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Rich on October 23, 2021, 07:22:21 AM
Hi Juanito
Maybe he found it in one of the older repos?
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 23, 2021, 11:10:10 AM
seems the internal server error is stopping me from posting :(

trying an attachment instead.

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 23, 2021, 11:30:30 AM
I'm really just poking at what I have no idea of how it works - but in trying a manual start I get this :

Code: [Select]
snb@snb:~$ sudo dbus-daemon --system
Failed to start message bus: Could not get UID and GID for username "tc"

I deleted the tc user as no need so now somehow dbus only wants that user?

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: onelife on October 23, 2021, 12:04:38 PM
So I modified :

Code: [Select]
/usr/local/share/dbus-1/system.conf
And now a bit closer maybe as dbus says running :

Code: [Select]
snb@snb:~$ sudo /usr/local/etc/init.d/dbus status

dbus is running.

But I still get :

Code: [Select]
snb@snb:~$ mmcli -L
error: couldn't find the ModemManager process in the bus

Is not having the TC user now going to break this? :(

Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Paul_123 on October 23, 2021, 03:22:51 PM
Yes, the dbus configuration defaults to using the user tc, so if your system does not have tc, then you need to change any config that references user tc

You will need to make sure those configuration files are backed up, as the defaults will no longer work for you.


I would highly recommend you start over with a default image.   Leave the username as tc.  Don't change that until you understand how things work.
Title: Re: Updated USB Modeswitch OR WWAN0?
Post by: Juanito on October 24, 2021, 03:14:45 AM
Note also, that when testing, networkmanager needed to be running for modemmanager to work.

The above shouldn't be the case, but it's not obvious why...