nerves-networking / vintage_net_mobile

Mobile networking for VintageNet
Apache License 2.0
27 stars 11 forks source link

add huawei E3372 modem #62

Closed Hanspagh closed 3 years ago

Hanspagh commented 4 years ago

My working setup for this modem.

For now, I don't know how to handle the USB mode switch, so I have only given an example of how I have done it so far. Let me know what you think.

For now, the signal, cell, and modem monitors also doesn't seem to work, I will look further into this when I have some time.

LostKobrakai commented 4 years ago

I don't completely understand the proper way that it's supposed to work. It seems like there should be some GenServer that watches for USB devices to be plugged into the system and when one is inserted with the right VID/PID, it should call usb_modeswitch? Even though it would be more desirable for that GenServer to react to insertion/removal events, I'd be happy if it polled just to get something started. If you have any knowledge to add here, I'd be interested.

https://gist.github.com/LostKobrakai/f59730107444991e06e1188a206b40a4 This is what I use. usb.ex is almost completly copied from Toolshed's lsusb. I'm using pubsub to tell another part of the application to run the modeswitch, but could be done inline / via a behaviour.

Hanspagh commented 4 years ago

This is what I get from CREG, btw it does not conform to the current spec {:ok, "+CREG: ", [2, 1, "5DF4", "0298630B"]}

fhunleth commented 4 years ago

It does seem like there are quite a few vendor differences on commands. I just looked +CREG up in TS 27.007 and what you're seeing is ok, so vintage_net_mobile should be updated to support it.

image

image

Hanspagh commented 4 years ago

I would like to continue on this, but still have a bit of a hard time to figure out where to do the follow

Currently, I have something that will start two usb "detectors". One that does a modem switch and one that does the actual connect. But I am not sure where and when I should supervisor these in the package?

fhunleth commented 4 years ago

@Hanspagh Sorry that I haven't had time to help out on this use case. My focus is on modems that don't force you to do the usb_modeswitch dance and ensuring that they're reliable. It seems like more modems, especially for IoT use cases, are providing more convenient interfaces these days.

I'm thinking that I should have recommended that you handle supervise the usb detectors outside of vintage_net_mobile for now.

jessiahr commented 4 years ago

I am working on using this modem for my project but I want to confirm that this is for the E3372s (stick) and not the E3372h (hilink) model? I believe I have the E3372h and haven't been able to get it to work via nerves but it works fine with raspbian.

Hanspagh commented 4 years ago

This is the stick 😊

On Sat, 23 May 2020, 03.05 Jessiah Ratliff, notifications@github.com wrote:

I am working on using this modem for my project but I want to confirm that this is for the E3372s (stick) and not the E3372h (hilink) model? I believe I have the E3372h and haven't been able to get it to work via nerves but it works fine with raspbian.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nerves-networking/vintage_net_mobile/pull/62#issuecomment-632959864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2DIHJNMHQYJZSHUJTF5DRS4OMDANCNFSM4MGBOQ7A .

fhunleth commented 4 years ago

FYI - the v0.8.0 release deleted quite a bit of code in this area and may have inadvertently made this modem harder to use. Instead of polling for modems to appear, vintage_net_mobile now waits for the wwan0 network interface to appear by default. Even though wwan0 isn't usable by itself, its existence is an indication that the ppp interface can be brought up.

This is all defaults so it can be changed, but the polling feature is gone now. This may be a reason not to upgrade to v0.8.0 if there are still questions about how to use usb_modeswitch to put the modem into usable state.

fhunleth commented 4 years ago

Update: v0.9.0 contains a power management feature. For the Quectel modems, we're using it to toggle the GPIOs to turn the modem on and to reset it if the modem stops responding. It's possible that the VintageNet.PowerManager feature might help support for this by adding a place to register a GenServer that gets notified whenever someone configures a E3372 modem. The modem need not be detected when that code is run so it could run usb_modeswitch or do whatever is needed to make wwan0 or ppp0 show up.

Hanspagh commented 4 years ago

Cool, I will have a look at this :D

Hanspagh commented 4 years ago

I have updated the pr, I will try these changes later today to make sure it is wokring and then we should be good to go :D

Hanspagh commented 3 years ago

Sorry for the delay on this. I have just updated with the changes suggest, but I was wondering how you wanted to configure the id?

Hanspagh commented 3 years ago

@LostKobrakai bump

Hanspagh commented 3 years ago

Hi. I have been using this in a prod setup for a while now, so I think it could be beneficial for other people to have this. What is needed for this to go into master?

fhunleth commented 3 years ago

@Hanspagh Thanks for pinging me. I'm so sorry for dropping this. I took a look at the code and it's simple and well documented. Thank you for getting this working and submitting the PR!

I manually merged it to main. GitHub isn't picking that up, but rest assured, it's there.

Barring surprises, I should be making a release shortly with this.