All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: Re: [PATCH v2 4/5] client: implement "ap <wlan> show"
Date: Thu, 21 Jan 2021 12:16:00 -0800	[thread overview]
Message-ID: <ba55a589ca6c9d574e73b532531c1b38e0d42f60.camel@gmail.com> (raw)
In-Reply-To: <1d05591b-10f8-e76c-b7f0-926c31739373@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]

On Thu, 2021-01-21 at 14:12 -0600, Denis Kenzior wrote:
> Hi James,
> 
> On 1/21/21 2:05 PM, James Prestwood wrote:
> > Hi,
> > 
> > > > +static void display_bitrate_100kbps(struct l_dbus_message_iter
> > > > *variant,
> > > > +				const char *key, const char
> > > > *margin,
> > > > +				int name_column_width, int
> > > > value_column_width)
> > > > +{
> > > > +	uint32_t rate;
> > > > +
> > > > +	l_dbus_message_iter_get_variant(variant, "u", &rate);
> > > > +
> > > > +	display("%s%-*s%-*u Kbit/s\n", margin,
> > > > name_column_width, key,
> > > > +			value_column_width, rate * 100);
> > > > +}
> > > 
> > > You don't want this in display.[ch] somewhere?
> > 
> > I could do that. Its the same for station/ap. The reason I put it
> > here
> > is because its not really a generalized display API since its so
> > unique
> > to this specific value. But I'm fine either way, I'll put it in
> > display.c/h so we don't have it duplicated.
> 
> Could also put this into diagnostic.[ch] or something as well.  In
> theory even 
> the dict_mapping parts can be shared since they're mostly the same,
> and 
> Address/CurrentBss won't occur in the same message.

Yeah true, Address and CurrentBss could both be in the same mapping
without any problems. I guess if we enforce the AP and station
dictionaries to never have duplicate names which have different
meanings they could all be defined in a single mapping.

> 
> > > > +
> > > > +static const struct display_dict_mapping diagnostic_mapping[]
> > > > = {
> > > > +	{ "Address", 's', NULL },
> > > > +	{ "RxMode", 's', NULL },
> > > > +	{ "TxMode", 's', NULL },
> > > > +	{ "RxBitrate", 0, display_bitrate_100kbps },
> > > > +	{ "TxBitrate", 0, display_bitrate_100kbps },
> > > > +	{ "ExpectedThroughput", 'u', "Kbit/s" },
> > > > +	{ "RSSI", 'n', "dBm" },
> > > > +	{ "RxMCS", 'y', NULL },
> > > > +	{ "TxMCS", 'y', NULL},
> > > > +	{ NULL }
> > > > +};
> > > > +
> > > > +static void ap_get_diagnostics_callback(struct l_dbus_message
> > > > *message,
> > > > +					void *user_data)
> > > > +{
> > > > +	struct l_dbus_message_iter array;
> > > > +	struct l_dbus_message_iter iter;
> > > > +	uint16_t idx = 0;
> > > > +	char client_num[15];
> > > > +
> > > > +	if (dbus_message_has_error(message))
> > > > +		return;
> > > 
> > > Does this need to print something as well?
> > 
> > That function does more than just check (though you wouldn't guess
> > it
> > from the name). It ends up converting the error into a string and
> > printing it.
> 
> Ok, cool.
> 
> Regards,
> -Denis

  reply	other threads:[~2021-01-21 20:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 18:11 [PATCH v2 1/5] station: commonize the building of diagnostic dict James Prestwood
2021-01-21 18:11 ` [PATCH v2 2/5] ap: add AP diagnostic interface James Prestwood
2021-01-21 18:11 ` [PATCH v2 3/5] client: implement display_dictionary James Prestwood
2021-01-21 19:55   ` Denis Kenzior
2021-01-21 19:58     ` James Prestwood
2021-01-21 18:11 ` [PATCH v2 4/5] client: implement "ap <wlan> show" James Prestwood
2021-01-21 19:59   ` Denis Kenzior
2021-01-21 20:05     ` James Prestwood
2021-01-21 20:12       ` Denis Kenzior
2021-01-21 20:16         ` James Prestwood [this message]
2021-01-21 18:11 ` [PATCH v2 5/5] client: update station to use display_dictionary James Prestwood
2021-01-21 20:08 ` [PATCH v2 1/5] station: commonize the building of diagnostic dict Denis Kenzior
2021-01-21 20:10   ` James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba55a589ca6c9d574e73b532531c1b38e0d42f60.camel@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.