SIM power patch

Aleksander Morgado aleksander at aleksander.es
Thu Dec 8 14:49:55 UTC 2016


On Thu, Dec 8, 2016 at 9:29 AM, Kasper Holtze <kasper at holtze.dk> wrote:
>> +static QmiMessageUimPowerOnSimInput *
>> +power_on_sim_input_create (guint slot)
>> "guint8 slot" directly?
>
> Yes - I need to create a helper function to parse the input as guint8, but I
> can do that?

No need for that, just use the standard helper returning a guint, and
then if (value > G_MAXUINT8), return an error saying "invalid slot
number" for example.

>>>
>>> +
>>> +        if (g_str_equal (power, "ON")) {
>>
>> Instead of g_str_equal() use !g_ascii_strcasecmp() and then you'll
>> allow both ON and on.
>>
>> Declare "on" input here, and don't use camelCasedNames:
>> QmiMessageUimPowerOnSimInput *input;
>> Instead of g_str_equal() use !g_ascii_strcasecmp() and then you'll
>> allow both OFF and off.
>
> The reason I used upper case ON/OFF, was to follow the convention in the PIN
> functions (--dms-uim-verify-pin=PIN,0000 for instance), but I can make it
> lower case and accept both.

Oh, well, PIN is an acronym. But I think we should really just avoid
capital letters on every user input, just allow both.

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list