Weird Droid 4 modem protocol and a way to support it
Hi!
I'd really like to get support for Droid 4 modem... unfortunately it is quite special. Few words about Droid 4 modem protocol:
drivers/motorolamodem/README new file +40 -0
@@ -0,0 +1,40 @@ + +This is really "interesting". The protocol looks like AT commands on +the first look, and some commands are same (ATD does the call, ATA +answers it), but often they are subtly different (ATD takes ,0 +parameter to work with caller id), and overall protocol is very +different. + +1) protocol is packet-based, not character-based. + +Whole command needs to be sent as one packet, in one write() call to +the kernel. Replies came back in packets, too, you can get them with +single read() call. + +2) protocol semantics is really different. + +You don't have command, responses to the command, then response +terminator. You send one packet and get one packet with the reply. + +In AT you got: + +> AT+TELL_ME_SOMETHING +< IT_IS_42 +< OK + +While in motmdm it is: + +> U0005AT+TELL_ME +< U0005OK:IT_IS_42 + + +AFAICT lot of complexity in atchat is collecting the multiple lines, +including handling stuff like + +IT_IS="Arbitrary +text including +OK +here" +OK + +I don't believe we need that for d4.
I'm not sure what is the best way to support it. I was not able to get atchat.c to work with it (and I don't think it is quite suitable), so I ended up copying it and modifying it for Droid 4 protocol.
Is that acceptable? Can you see a better way?
I do have code for basic voicecall support, SMSes and some kind of netreg support. But it is quite simple, needs more cleanups, and this mail is already too long.
Best regards,
Pavel
gatchat/motchat.c new file +1220 -0
1,220 lines not on this page · raw message
gatchat/motchat.h new file +209 -0
209 lines not on this page · raw message
Hi Pavel,
Quoted 5 lines · Pavel Machek
Hi!
I'd really like to get support for Droid 4 modem... unfortunately it is quite special. Few words about Droid 4 modem protocol:
<snip>
Quoted 6 lines
I'm not sure what is the best way to support it. I was not able to get
atchat.cto work with it (and I don't think it is quite suitable), so I ended up copying it and modifying it for Droid 4 protocol.Is that acceptable? Can you see a better way?
I don't think there's really another way. So the approach of duplicating GAtChat and everything inside drivers/atmodem is likely the way to go.
But if you pursue this, we really should throw out as much of the legacy in gatchat as possible:
- g_at_chat_suspend / resume is likely not needed (you're probably not running PPP over these, right)?
- stuff like g_at_chat_set_wakeup is only relevant for some weird modems and probably isn't relevant here
- add_terminator / blacklist_terminator might not be needed
- Some other concepts might not be needed, like send_pdu_listing and send_and_expect_short_prompt. Those are really only for weird SMS commands.
- It might also be possible to greatly simplify the GAtParser concept.
- I'd also just put this all directly into drivers/motmodem/* instead of trying to extend gatchat library itself.
Most importantly though, we should stop using glib. oFono is (glacially slowly) being ported over to ell. So I don't really want to accept any new glib code.
Regards,
-Denis
Hi!
Quoted 7 lines
Quoted 3 lines
I'd really like to get support for Droid 4 modem... unfortunately it is quite special. Few words about Droid 4 modem protocol:
<snip>
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
I'm not sure what is the best way to support it. I was not able to get
atchat.cto work with it (and I don't think it is quite suitable), so I ended up copying it and modifying it for Droid 4 protocol.Is that acceptable? Can you see a better way?
I don't think there's really another way. So the approach of duplicating GAtChat and everything inside
drivers/atmodemis likely the way to go.
Ok, thanks for confirmation.
Quoted 12 lines
But if you pursue this, we really should throw out as much of the legacy in gatchat as possible:
-
g_at_chat_suspend/ resume is likely not needed (you're probably not running PPP over these, right)?
- stuff likeg_at_chat_set_wakeupis only relevant for some weird modems and probably isn't relevant here
-add_terminator/blacklist_terminatormight not be needed
- Some other concepts might not be needed, likesend_pdu_listingandsend_and_expect_short_prompt. Those are really only for weird SMS commands.
- It might also be possible to greatly simplify the GAtParser concept.
I believe I don't need GAtParser at all.
Quoted 2 lines
- I'd also just put this all directly into
drivers/motmodem/*instead of trying to extend gatchat library itself.
Yes.
Quoted 3 lines
Most importantly though, we should stop using glib. oFono is (glacially slowly) being ported over to ell. So I don't really want to accept any new glib code.
So... this code started as copy of gatchat, with me removing the obviously-unneeded stuff. I guess I can convert motchat easily when atchat is converted... but I'm not sure I understand the code well enough to do conversion on my own.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 16 lines
Quoted 9 lines
I'd really like to get support for Droid 4 modem... unfortunately it is quite special. Few words about Droid 4 modem protocol:
I'm not sure what is the best way to support it. I was not able to get
atchat.cto work with it (and I don't think it is quite suitable), so I ended up copying it and modifying it for Droid 4 protocol.Is that acceptable? Can you see a better way?
I don't think there's really another way. So the approach of duplicating GAtChat and everything inside
drivers/atmodemis likely the way to go.But if you pursue this, we really should throw out as much of the legacy in gatchat as possible:
Quoted 9 lines
-
g_at_chat_suspend/ resume is likely not needed (you're probably not running PPP over these, right)?
- stuff likeg_at_chat_set_wakeupis only relevant for some weird modems and probably isn't relevant here
-add_terminator/blacklist_terminatormight not be needed
- Some other concepts might not be needed, likesend_pdu_listingandsend_and_expect_short_prompt. Those are really only for weird SMS commands.
- It might also be possible to greatly simplify the GAtParser concept.
I had it removed from .c files, removed from .h now, too.
Quoted 2 lines
- I'd also just put this all directly into
drivers/motmodem/*instead of trying to extend gatchat library itself.
Already done.
Quoted 3 lines
Most importantly though, we should stop using glib. oFono is (glacially slowly) being ported over to ell. So I don't really want to accept any new glib code.
Heh. I guess I'll wait for atchat to be converted, first...
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html