Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Make qcom-msim plugin able to use other SIM slot than first SIM slot. #188
Conversation
alfonsosanchezbeato
reviewed
Jun 2, 2015
| @@ -19,6 +19,18 @@ | ||
| * | ||
| */ | ||
| +struct ril_data { | ||
| + struct _GRil *ril; |
alfonsosanchezbeato
reviewed
Jun 2, 2015
| + struct pending_pref_setting *pps; | ||
| +}; | ||
| + | ||
| +#define MULTISIM_RS_LAST 2 |
alfonsosanchezbeato
Jun 2, 2015
Contributor
This should be defined in a header specific to your driver, something like drivers/qcommsimmodem/qcomutil.h, so you can share with other atoms if/when needed.
alfonsosanchezbeato
reviewed
Jun 2, 2015
| @@ -136,6 +136,9 @@ void ofono_radio_settings_remove(struct ofono_radio_settings *rs); | ||
| void ofono_radio_settings_set_data(struct ofono_radio_settings *rs, void *data); | ||
| void *ofono_radio_settings_get_data(struct ofono_radio_settings *rs); | ||
| +void radio_set_rat_mode(struct ofono_radio_settings *rs, |
alfonsosanchezbeato
Jun 2, 2015
Contributor
If you need to export this, please change the name to ofono_radio_set_rat_mode()
|
The main issue I see is that the changes to plugins/qcom-msim.c and plugins/ril.* are not needed. I would rather change "create_gril" in ril.c to support multi-sim, which is simply a matter of retrieving the slot number and using it in a couple of places. Having one slot would still work. To create your specific radio-settings driver you can compare rd->vendor to OFONO_RIL_VENDOR_QCOM_MSIM and use RILMODEM or QCOMMSIMMODEM depending on that. Beside that, in general looks great to me. |
|
Ok, new commits pushed. |
alfonsosanchezbeato
reviewed
Jun 3, 2015
| + * | ||
| + */ | ||
| + | ||
| +#define MULTISIM_RS_LAST 2 |
alfonsosanchezbeato
Jun 3, 2015
Contributor
This should be renamed to something like QCOMMSIM_NUM_SLOTS
alfonsosanchezbeato
reviewed
Jun 3, 2015
| + | ||
| +#define MULTISIM_RS_LAST 2 | ||
| + | ||
| +struct qcom_msim_pending_pref_setting { |
alfonsosanchezbeato
Jun 3, 2015
Contributor
Defining the number of slots here makes sense, but I do not see the reason for defining in the header qcom_msim_pending_pref_setting and qcom_msim_set_2g_rat, which would be used only in the RS atom
peat-psuwit
Jun 3, 2015
Contributor
Then there would be only SIM slots amount defined in this file. Maybe I should move this constant to another file. qcom_msim_constants.h?
alfonsosanchezbeato
reviewed
Jun 3, 2015
| +#include "qcom_msim_modem.h" | ||
| +#include "qcom_msim_util.h" | ||
| + | ||
| +static struct ofono_radio_settings *multisim_rs[MULTISIM_RS_LAST] = {}; |
alfonsosanchezbeato
Jun 3, 2015
Contributor
Remove the initialization or use { NULL } instead (you need to set the default value for the first array element, letting empty braces do the same is a gcc extension iirc)
alfonsosanchezbeato
reviewed
Jun 3, 2015
| + return FALSE; | ||
| +} | ||
| + | ||
| +static void qcom_msim_query_modem_rats(struct ofono_radio_settings *rs, |
alfonsosanchezbeato
Jun 3, 2015
Contributor
This implementation is the same as the rilmodem one. Please declare ril_query_modem_rats in "drivers/rilmodem/radio-settings.h" and use it instead.
alfonsosanchezbeato
reviewed
Jun 3, 2015
| @@ -70,7 +71,8 @@ | ||
| #define RILD_MAX_CONNECT_RETRIES 5 | ||
| #define RILD_CONNECT_RETRY_TIME_S 5 | ||
| -#define RILD_CMD_SOCKET "/dev/socket/rild" | ||
| +char *RILD_CMD_SOCKET[2] = {"/dev/socket/rild", "/dev/socket/rild1"}; | ||
| +char *GRIL_HEX_PREFIX[2] = {"Device 0: ", "Device 1: "}; |
peat-psuwit
added some commits
Jun 2, 2015
|
This looks pretty good, however in addition to a couple of in-line comments, there are a few issues with the commits themselves. First, ofono uses the 50/72 rule for commit short/long descriptions. Please revise:
"rilmodem: export ril_query_modem_rats
Also, please split out the build change from the qcommsimmodem commit. It should be a subsequent commit which enables the new directory in the Makefile. Eg. build: enable qcommsimmodem radio-settings atom Finally, does your device support LTE, or is it a 3g only device? |
tonyespy
reviewed
Jun 5, 2015
| + } | ||
| + | ||
| + if (pref != PREF_NET_TYPE_GSM_ONLY && multisim_rs_amount > 1) { | ||
| + struct qcom_msim_pending_pref_setting *pps = g_try_new0( |
tonyespy
Jun 5, 2015
Contributor
I think I'd prefer to see this wrapped after the =, so it'd look like this:
struct qcom_msim_pending_pref_setting *pps =
g_try_new0(struct qcom_msim_pending_pref_setting, 1);
tonyespy
reviewed
Jun 5, 2015
| + pps->cbd = NULL; | ||
| + g_free(cbd); | ||
| + g_free(set_2g_rat_data); | ||
| + CALLBACK_WITH_FAILURE(cb, data); |
tonyespy
reviewed
Jun 5, 2015
| + if (multisim_rs[i] == rs) | ||
| + continue; | ||
| + | ||
| + current_rd = ofono_radio_settings_get_data( |
tonyespy
Jun 5, 2015
Contributor
You might want to change this to temp_rd, as it confused me because it's not really the current_rd ( ie. you return if multisim_rs[i] == rs ). Maybe temp_rd would be a better name?
tonyespy
reviewed
Jun 5, 2015
| +}; | ||
| + | ||
| +static struct ofono_radio_settings *multisim_rs[QCOMMSIM_NUM_SLOTS_MAX]; | ||
| +static int multisim_rs_amount; |
|
@tonyespy My device, LG L90 Dual, is 3G only device. But I think other dual SIM with LTE device from Qualcomm will benefit from this too. |
tonyespy
reviewed
Jun 10, 2015
| + continue; | ||
| + | ||
| + temp_rd = ofono_radio_settings_get_data( | ||
| + multisim_rs[i]); |
tonyespy
Jun 10, 2015
Contributor
The above line doesn't need to be wrapped; un-wrapped it's exactly 80 characters.
tonyespy
reviewed
Jun 10, 2015
| + temp_rd = ofono_radio_settings_get_data( | ||
| + multisim_rs[i]); | ||
| + set_2g_rat_data = g_try_new0( | ||
| + struct qcom_msim_set_2g_rat, 1); |
tonyespy
Jun 10, 2015
Contributor
Please wrap the above line after the "=". It's easier to read. You'll find plenty of wraps after "=", but zero function calls ( at least that I could find ) with the first parameter wrapped like this.
tonyespy
reviewed
Jun 10, 2015
| + set_2g_rat_data->rs = multisim_rs[i]; | ||
| + | ||
| + g_ril_request_set_preferred_network_type( | ||
| + temp_rd->ril, |
tonyespy
Jun 10, 2015
Contributor
Please put "temp_rd->ril," on the same line as the function name, as it fits within the 80 char limit and again prevents a line ending with "(".
tonyespy
reviewed
Jun 10, 2015
| +}; | ||
| + | ||
| +static struct ofono_radio_settings *multisim_rs[QCOMMSIM_NUM_SLOTS_MAX]; | ||
| +static int multisim_num_slot; |
tonyespy
Jun 10, 2015
Contributor
This really should be plural... multisim_num_slots, as that's what it is, the number of slots.
|
Thanks for re-working the commit messages and addressing my comments. I still have three more formatting issues ( see inline comments ) that need fixing, and then it'll be good to merge. |
|
Actually one other comment. I asked about whether or not your device supported LTE, as your code as written makes the same assumption about LTE as it does 3G with respect to slot capabilities. If the user sets the radio tech of one of the slots/modems to LTE, then the other slot is set first to 2G ( same as for 3G ), but it might be possible for one slot to do LTE and the other 3G. I guess we won't know till we see a QCom dual-SIM that supports LTE, so let's leave this as is. |
|
Please add a comment whenever you update, as it makes it a bit easier to notice. Thanks for the last round of changes... It's almost merge-able, however when you changed the multisim_num_slots variable, you only changed its declaration, not it's usage elsewhere in the file, so the code doesn't compile. |
peat-psuwit
added some commits
Jun 2, 2015
|
@tonyespy Ok, new version pushed. It was shameful to forget that. I'll keep that as a lesson. |
|
Approved. |
peat-psuwit commentedJun 1, 2015
This is improvement of qcom-msim plugin that allow you to use other SIM slot and be able to select which SIM will prefer 3G. This modem has limitation that only 1 SIM can prefer 3G at a time, so the new radio-settings driver will make sure that other SIMs prefer 2G before setting a SIM to prefer 3G. I code this to support more than 2 SIM slots, but there are some constants which assume that only 2 SIM slots are available. If, in the future, there are phones with more than 2 SIM slots, these constants can be edited to support them.