Message ID | 1481121260-29192-1-git-send-email-avichal.a@samsung.com |
---|---|
State | Changes Requested |
Headers | show |
On Wed, Dec 07, 2016 at 08:04:20PM +0530, Avichal Agarwal wrote: > -static int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, > +int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, This function returns a more or less human readable text string with channels on each mode.. > -static int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s, > +int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s, > char *buf, size_t buflen) Same here.. > diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c > @@ -2642,6 +2642,27 @@ dbus_bool_t wpas_dbus_getter_capabilities( > + if (res >= 0) { > + char buf[4096]; > + int len=4096; > + if( ctrl_iface_get_capability_freq(wpa_s, buf, len)) > + { > + if(!wpa_dbus_dict_append_string(&iter_dict, "Frequency", buf)) This would expose that exact text string through the D-Bus interface. That does not sound very convenient and consistent with D-Bus expectations. Shouldn't this build a D-Bus array of integer values instead? Or whatever more native D-Bus data structure that would fit in here for the use case. > + if (res >= 0) { > + char buf[4096]; > + int len=4096; > + if(ctrl_iface_get_capability_channels(wpa_s, buf, len)) > + { > + if(!wpa_dbus_dict_append_string(&iter_dict, "Channels", buf)) And same here.
Hi, > > diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c > > b/wpa_supplicant/dbus/dbus_new_handlers.c > > @@ -2642,6 +2642,27 @@ dbus_bool_t wpas_dbus_getter_capabilities( > > +if (res >= 0) { > > +char buf[4096]; > > +int len=4096; > > +if( ctrl_iface_get_capability_freq(wpa_s, buf, len)) > > +{ > > +if(!wpa_dbus_dict_append_string(&iter_dict, > "Frequency", buf)) > > This would expose that exact text string through the D-Bus interface. > That does not sound very convenient and consistent with D-Bus > expectations. Shouldn't this build a D-Bus array of integer values instead? Or > whatever more native D-Bus data structure that would fit in here for the use > case. We would be also very interested in the idea of this patch. However, I absolutely agree with Jouni about the structure of the D-Bus message. I think they could be two entries in the Capabilities array and looks like this: dbus-send --system --print-reply --dest=fi.w1.wpa_supplicant1 /fi/w1/wpa_supplicant1/Interfaces/1 org.freedesktop.DBus.Properties.GetAll string:"fi.w1.wpa_supplicant1.Interface" dict entry( string "Capabilities" variant array [ ... dict entry( string "Frequency" variant array [ dict entry( string "A" variant array [ uint32 5180 ... ] ) dict entry( string "G" variant array [ uint32 2412 ... ] ) ... dict entry( string "N" variant array [ uint32 2412 ... uint32 5180 ... ] ) dict entry( string "AC" variant array [ uint32 5180 ... ] ) ] ) ... Same for channels. What do you think? Regards, Jose Blanquicet VISITA IL NOSTRO SITO WEB! - VISIT OUR WEB SITE! www.magnetimarelli.com Confidential Notice: This message - including its attachments - may contain proprietary, confidential and/or legally protected information and is intended solely for the use of the designated addressee(s) above. If you are not the intended recipient be aware that any downloading, copying, disclosure, distribution or use of the contents of the above information is strictly prohibited. If you have received this communication by mistake, please forward the message back to the sender at the email address above, delete the message from all mailboxes and any other electronic storage medium and destroy all copies. Disclaimer Notice: Internet communications cannot be guaranteed to be safe or error-free. Therefore we do not assure that this message is complete or accurate and we do not accept liability for any errors or omissions in the contents of this message.
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index a754943..5aa51fe 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3846,7 +3846,7 @@ static int ctrl_iface_get_capability_modes(int res, char *strict, } -static int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, +int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, char *buf, size_t buflen) { struct hostapd_channel_data *chnl; @@ -3896,7 +3896,7 @@ static int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, } -static int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s, +int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s, char *buf, size_t buflen) { struct hostapd_channel_data *chnl; diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index e11dd36..58d4e92 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -2642,6 +2642,27 @@ dbus_bool_t wpas_dbus_getter_capabilities( goto nomem; } + if (res >= 0) { + char buf[4096]; + int len=4096; + if( ctrl_iface_get_capability_freq(wpa_s, buf, len)) + { + if(!wpa_dbus_dict_append_string(&iter_dict, "Frequency", buf)) + goto nomem; + } + } + + if (res >= 0) { + char buf[4096]; + int len=4096; + if(ctrl_iface_get_capability_channels(wpa_s, buf, len)) + { + if(!wpa_dbus_dict_append_string(&iter_dict, "Channels", buf)) + goto nomem; + } + + } + if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict) || !dbus_message_iter_close_container(iter, &variant_iter)) goto nomem; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index ec6917a..4f337db 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1077,7 +1077,11 @@ struct wpa_supplicant { struct os_reltime lci_time; }; +int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s, + char *buf, size_t buflen); +int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, + char *buf, size_t buflen); /* wpa_supplicant.c */ void wpa_supplicant_apply_ht_overrides( struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,