Author Message

<  The PPP Widget Family for Android  ~  Resolve "no modem found" without replug

PostPosted: Sat Jan 28, 2017 5:32 pm Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
Hi,

Im am useing ppp widget 3 . After booting or resuming the tablet I get quite often no modem found. It can be resolved through unpluggin and replugging the modem. However this is not really comfortable. Any plans to integrate USB reset functionality to automate it? E.g. http://stackoverflow.com/questions/3870 ... oot-access

Thank you in advance!


Offline
PostPosted: Sat Jan 28, 2017 6:03 pm Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
Hmm, interesting idea about resetting devices by setting the configuration ...

However, did you try to start the active device search by touching the PPP Widget icon on the left side of the widget?
If that does not help, I'd like to see the USB log that is created during the device search.

I think you know how to enable PPP Widget's logging, right?


Offline
PostPosted: Sat Jan 28, 2017 8:19 pm Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
I was wrong on the error message. It actually says "No modem response". Anyway the solution is the same: unplug, replug helps.

Below the log.

Jan 28, 2017 7:06:04 PM

Device manufacturer string: softwinner
Start search for USB devices
visible on Android OS level ...
Check device 12d1:1001, interface 2, might be a modem
Found possible 3G USB device 12d1:1001
New device on /dev/bus/usb/001/004
Class of interface 0 is 0xFF
Looking at USB device 12d1:1001 with class 255
Device top dir: /sys/bus/usb/devices/1-1.1, active cfg: 1
Device layout (config 1) - cl:00 sc:00 pr:00
if:0 as:0 - cl:ff sc:ff pr:ff - ir:81 bi:82 bo:01
if:1 as:0 - cl:ff sc:ff pr:ff - bi:83 bo:02
if:2 as:0 - cl:ff sc:ff pr:ff - bi:84 bo:03

Found 3 serial ports
Opening port type SERIAL

Jan 28, 2017 7:06:04 PM

Starting modem command sequence ...
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
>
ATE0
No modem reply
====


Offline
PostPosted: Wed Feb 01, 2017 6:21 pm Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
I have done some further tests:
1. I get "No modem found" after resume -> this can be resolved with activating the modem search indeed
2. I get "No modem response" after reboot -> this can be resolved only with unplugging, replugging the modem

Regarding "No modem response" after reboot:
1. I assume it is caused because rild already brings the modem into a state where PPP widget is not able to initialize anymore:
a. would it be possible to bring the modem back to a state where PPP widget can continue the initialization sequence through some AT commands?
b. if not and the JNI based implementation is still part of PPP widget 3: would it be possible to reset USB through rc = ioctl(fd, USBDEVFS_RESET, 0); see http://askubuntu.com/questions/645/how- ... mmand-line

Thank you in advance!


Offline
PostPosted: Thu Feb 02, 2017 9:25 am Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
I'm not sure if a USB reset does more good or bad here. I'll try to add a CLEAR_HALT for the specific endpoints first. This is like a "mini reset" with potentially fewer side effects.

I don't think it's necessary to do this on the JNI level. I prefer to keep as much as possible on the Java level for transparency reasons, and you can issue random control transfers from there.
See UsbDeviceConnection.controlTransfer(...).

Whatever I do, I must think about all users and modems, and be careful about not to screw up one group by adding a fix for annother group ...

I will begin testing tonight, however it may prove difficult to provoke the kind of behaviour that you see with my device zoo in the first place.


Offline
PostPosted: Sat Feb 04, 2017 10:43 am Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
Endpoint-specifc "mini reset" sounds to be a more targeted solution indeed. I cannot wait to try it out.


Offline
PostPosted: Sat Feb 04, 2017 1:09 pm Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
I'm actually in the final test phase for the update.

What I have noticed in the process:

1. All my Android devices cut the USB host power during reboot. This results in a modem state that's as good as re-plugged.

2. When keeping the modem 'alive' by providing external power (hub) during reboot, the new version never had any problems picking up the modem communication after applying the CLEAR_HALT command.


Offline
PostPosted: Sun Feb 05, 2017 9:57 am Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
The update should be ready for download by now.

I would be interested what sort of Android device you are working with. Is it a car system, perhaps?


Offline
PostPosted: Sun Feb 05, 2017 5:05 pm Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
Thank you. I have downloaded and tested it.

My first impressions (not reproducable yet):
- reset (CLEAR_HALT) seems to be harder "reset" than re-plugging. After CLEAR_HALT, the modem needs ca. 60 sec to register on a network again. After replugging, it is less than 10 sec. Sorry for suggesting reset, this seems to be an overkill. You might have another idea how to "simulate" re-plugging programaticly.

Device: it is a cheap allwinner A33 tablet. It has a rild/pppd implementation but it is unreliable.
Now I wrote a litte app that executes "setprop ctl.stop ril-daemon" command during start up. It seems to be more effective than the modem reset (probably not a generic solution for tablets where rild is doing something good). Unfortunately it works only under certain circumstances which I was not able to reproduce yet. I assume the "setprop ctl.stop ril-damon" should be executed earlier than the ppp widget starts to search for the modem.

I will do some further testing.
How can I see in the log when the CLEAR_HALT is applied? I would need to know it in order that I can observe it better.


Offline
PostPosted: Sun Feb 05, 2017 6:33 pm Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
wannappp wrote:
After CLEAR_HALT, the modem needs ca. 60 sec to register on a network again. After replugging, it is less than 10 sec.

Somehow I don't think this is caused by the CLEAR_HALT command. This command is specified at the very base of USB. An endpoint can be in a "stalled" state caused by incomplete transfers or other glitches. This is a possible cause for failing communication to a device.
CLEAR_HALT just brings the endpoint back to normal.
wannappp wrote:
It has a rild/pppd implementation but it is unreliable.

I think this is the real cause for your problems ...

The system will always interfere with PPP Widget and 'fight' for access to the modem - especially at boot time when PPP Widget waits for the signal (BroadcastIntent) BOOT_COMPLETED.
wannappp wrote:
Now I wrote a litte app that executes "setprop ctl.stop ril-daemon" command during start up. It seems to be more effective than the modem reset (probably not a generic solution for tablets where rild is doing something good). Unfortunately it works only under certain circumstances which I was not able to reproduce yet.

Did you try to rename rild, pppd and any - likely present - mode-switch tools?

This is quite radical but easily reversable
wannappp wrote:
How can I see in the log when the CLEAR_HALT is applied? I would need to know it in order that I can observe it better.

Ah, yes, right now I'm logging it only if it fails.
It is applied every time a modem is 'discovered', by plugging it in or by calling the manual device search (icon touch). It happens immediately before sending the first setup commands to a modem (in your case "ATE0").

BTW, you can 'fake' the post-sleep state by killing the PPP Widget process explicitely. I do it with "Advanced Task Killer", set to 'low security' mode. Then a process named "de.draisberghof.pppwidget3" appears in the task list.


Offline
PostPosted: Mon Feb 06, 2017 12:14 am Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
I renamed /system/bin/rild and it solved the problem. Thank you!

There are still some post-sleep instability. My assumption that ppp widget is not able to connect when the tablet is waken before the modem goes to sleep.
Usually the modem goes to sleep 5 sec after the sleep button is pressed. Maybe ppp widget should control the sleep process in terms of disconnect and/or delay sleep until the modem disconnted.


Offline
PostPosted: Mon Feb 06, 2017 10:12 pm Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
Below what happens after wake up of the tablet. This can be resolved through tapping the ppp icon and triggering the modem search manually.
However it would be more confortable if the ppp widget could retry the modem search a few times automaticly if this happens.

2017.02.06. 19:55:17

Device manufacturer string: softwinner
New device on /dev/bus/usb/001/014
Class of interface 0 is 0xFF
Looking at USB device 12d1:1001 with class 255
Device top dir: /sys/bus/usb/devices/1-1.1, active cfg: 1
Device layout (config 1) - cl:00 sc:00 pr:00
if:0 as:0 - cl:ff sc:ff pr:ff - ir:81 bi:82 bo:01
if:1 as:0 - cl:ff sc:ff pr:ff - bi:83 bo:02
if:2 as:0 - cl:ff sc:ff pr:ff - bi:84 bo:03

Found 3 serial ports
Opening port type SERIAL

2017.02.06. 19:55:17

Starting modem command sequence ...
>
ATE0
usb
Transmission to modem failed, abort


Offline
PostPosted: Mon Feb 06, 2017 10:38 pm Reply with quote
Site Admin Posts: 6440 Joined: Sat Nov 03, 2007 12:30 am
Did you ever try to enable the configuration option "Disable USB device sleep"?

I'm not sure if there is a system-wide signal which can tell PPP Widget to check for the modem again. I'll have a look though.


Offline
PostPosted: Tue Feb 07, 2017 12:31 am Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
yes, I tried "Disable USB sleep". I could not see a difference. Modem turned off after sleep and I experienced the same log after the tablet woke up.


Offline
PostPosted: Tue Feb 07, 2017 11:16 am Reply with quote
Posts: 21 Joined: Tue Jan 10, 2017 1:23 am
what does this error message mean actually? What is the operation that the ppp widget tries to do?

Quote:
usb
Transmission to modem failed, abort


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 2
24 posts
Go to page 1 2 Next
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum