nerves-networking / qmi Goto Github PK
View Code? Open in Web Editor NEWQualcomm MSM Interface in Elixir
License: Apache License 2.0
Qualcomm MSM Interface in Elixir
License: Apache License 2.0
The current driver code assumes that every data buffer read from the QMI driver can be completely decoded. Sentry crash reports picked up a serial number report being split across two reads, so this assumption is wrong. It looks like this has only happened a few times over a whole lot of devices. Everything recovers after parsing crashes and restart.
A fix to this will likely fix #100.
This gets recovered, but it seems strange that the responses got out of sync somehow. Posting here just in case it shows up again.
14:29:47.891 [error] GenServer :"Elixir.VintageNetQMI.QMI.wwan0.Driver" terminating
** (MatchError) no match of right hand side value: {nil, %{}}
(qmi 0.8.3) lib/qmi/driver.ex:196: QMI.Driver.fail_transaction_id/3 (qmi 0.8.3) lib/qmi/driver.ex:192: QMI.Driver.handle_report/2 (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4 (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6 (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message: {:dev_bridge, #Reference<0.1377127605.2118909953.231868>, :read, <<1, 38, 0, 128, 1, 4, 2, 10, 1, 32, 0, 26, 0, 2, 4, 0, 1, 0, 14, 0, 1, 4, 0, 0, 0, 0, 0, 16, 2, 0, 3, 0, 17, 4, 0, 2, 0, 218, 0>>}
State: %QMI.Driver.State{bridge: #PID<0.3286.0>, device_path: "/dev/cdc-wdm0", indication_callback: #Function<0.22973782/1 in VintageNetQMI.indication_callback/1>, last_ctl_transaction: 4, last_service_transaction: 273, ref: #Reference<0.1377127605.2118909953.231868>, transactions: %{}}
Message-id: 0x0021
The response will be a string with the manufacturer name
%{
message: <<58, 0, 25, 0, 20, 22, 0, 1, 0, 0, 0, 8, 0, 65, 0, 84, 0, 38, 0, 84, 8, 0, 65, 0, 84, 0, 38, 0, 84>>,
service_id: 3,
transaction_id: 2,
type: :indication
}
Best definition I've found is: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/master/data/qmi-service-nas.json#L1686-1700
Placeholder for adding support for this indication we're seeing pretty consistently, but has not really been needed.
%{
message: <<34, 0, 18, 0, 1, 2, 0, 2, 0, 18, 1, 0, 4, 19, 2, 0, 128, 136, 20, 1, 0, 5>>,
service_id: 1,
transaction_id: 1,
type: :indication
}
%{message: <<39, 0, 0, 0>>, service_id: 0, transaction_id: 0, type: :indication}
Best definition I've found is: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/master/data/qmi-service-ctl.json#L152-156
Seems like it is just stating the result of "syncing" (pass or fail)
Hi, I wrote an elixir wrapper around qmicli from libqmi. It works quite well (I will surely get around to opensourcing it real soon, especially if there were volunteers to help improve it?). However, I wanted something direct in elixir, especially as the protocol is quite straightforward
However, when I look at the code in nerves, I'm not sure that I understand what I'm seeing? There seems to be custom parsing functions for each QMI function we can call, despite that we can potentially automate much of that parsing (because the response and call are TLV params)? I wonder if you are aware of the JSON description files that are used to generate much of libqmi C code, here:
https://github.com/freedesktop/libqmi/tree/master/data
I concede that whilst I'm pretty sure we can do some magic with macros to take this json and use it to generate functions to call and parse the QMI functions/responses, I also concede it's above anything I've tried so far...
So Q. Is there any interest to create a low level "codec", which is autogenerated from libqmi definitions?
Note that I expect on top of that to need to add a higher level API which translates some of these values, ie as is qmicli to libqmi. Many of the low level responses benefit from scaling, translating, coalescing, etc
Any thoughts? Also, is there a mailing list that would be a more appropriate place to discuss this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.