Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wifi_supplicant/wifi_supplicant.c

    r1d6dd2a r38d150e  
    4141#include <stdio.h>
    4242#include <stdlib.h>
    43 #include <str.h>
    44 #include <str_error.h>
    4543#include <loc.h>
    4644
     
    8886}
    8987
    90 static errno_t get_wifi_list(service_id_t **wifis, size_t *count)
     88static int get_wifi_list(service_id_t **wifis, size_t *count)
    9189{
    9290        category_id_t wifi_cat;
    93         errno_t rc = loc_category_get_id("ieee80211", &wifi_cat, 0);
     91        int rc = loc_category_get_id("ieee80211", &wifi_cat, 0);
    9492        if (rc != EOK) {
    9593                printf("Error resolving category 'ieee80211'.\n");
     
    111109        size_t count;
    112110       
    113         errno_t rc = get_wifi_list(&wifis, &count);
     111        int rc = get_wifi_list(&wifis, &count);
    114112        if (rc != EOK) {
    115113                printf("Error fetching wifi list.\n");
     
    134132}
    135133
    136 static errno_t wifi_list(void)
     134static int wifi_list(void)
    137135{
    138136        service_id_t *wifis = NULL;
    139137        size_t count;
    140138       
    141         errno_t rc = get_wifi_list(&wifis, &count);
    142         if (rc != EOK) {
    143                 printf("Error fetching wifi list: %s\n", str_error(rc));
     139        int rc = get_wifi_list(&wifis, &count);
     140        if (rc != EOK) {
     141                printf("Error fetching wifi list.\n");
    144142                return EINVAL;
    145143        }
     
    150148                rc = loc_service_get_name(wifis[i], &svc_name);
    151149                if (rc != EOK) {
    152                         printf("Error getting service name: %s\n", str_error(rc));
     150                        printf("Error getting service name.\n");
    153151                        free(wifis);
    154152                        return rc;
     
    163161}
    164162
    165 static errno_t wifi_connect(uint32_t index, char *ssid_start, char *password)
     163static int wifi_connect(uint32_t index, char *ssid_start, char *password)
    166164{
    167165        assert(ssid_start);
     
    174172        }
    175173       
    176         errno_t rc = ieee80211_disconnect(sess);
     174        int rc = ieee80211_disconnect(sess);
    177175        if(rc != EOK) {
    178176                if (rc == EREFUSED)
    179177                        printf("Device is not ready yet.\n");
    180178                else
    181                         printf("Error when disconnecting device: %s\n",
    182                             str_error(rc));
     179                        printf("Error when disconnecting device. "
     180                            "Error: %d\n", rc);
    183181               
    184182                return rc;
     
    194192                        printf("Given SSID not in scan results.\n");
    195193                else
    196                         printf("Error when connecting to network: %s\n",
    197                             str_error(rc));
     194                        printf("Error when connecting to network. "
     195                            "Error: %d\n", rc);
    198196               
    199197                return rc;
     
    207205}
    208206
    209 static errno_t wifi_disconnect(uint32_t index)
     207static int wifi_disconnect(uint32_t index)
    210208{
    211209        async_sess_t *sess = get_wifi_by_index(index);
     
    216214        }
    217215       
    218         errno_t rc = ieee80211_disconnect(sess);
     216        int rc = ieee80211_disconnect(sess);
    219217        if (rc != EOK) {
    220218                if (rc == EREFUSED)
     
    223221                        printf("Not connected to any WiFi network.\n");
    224222                else
    225                         printf("Error when disconnecting from network: %s\n",
    226                             str_error(rc));
     223                        printf("Error when disconnecting from network. "
     224                            "Error: %d\n", rc);
    227225               
    228226                return rc;
     
    234232}
    235233
    236 static errno_t wifi_scan(uint32_t index, bool now)
     234static int wifi_scan(uint32_t index, bool now)
    237235{
    238236        async_sess_t *sess = get_wifi_by_index(index);
     
    244242       
    245243        ieee80211_scan_results_t scan_results;
    246         errno_t rc = ieee80211_get_scan_results(sess, &scan_results, now);
     244        int rc = ieee80211_get_scan_results(sess, &scan_results, now);
    247245        if (rc != EOK) {
    248246                if (rc == EREFUSED)
    249247                        printf("Device is not ready yet.\n");
    250248                else
    251                         printf("Failed to fetch scan results: %s\n",
    252                             str_error(rc));
     249                        printf("Failed to fetch scan results. Error: %d\n", rc);
    253250               
    254251                return rc;
     
    278275int main(int argc, char *argv[])
    279276{
    280         errno_t rc = inetcfg_init();
    281         if (rc != EOK) {
    282                 printf("%s: Failed connecting to inetcfg service: %s.\n",
    283                     NAME, str_error(rc));
     277        int rc = inetcfg_init();
     278        if (rc != EOK) {
     279                printf("%s: Failed connecting to inetcfg service (%d).\n",
     280                    NAME, rc);
    284281                return 1;
    285282        }
     
    287284        rc = dhcp_init();
    288285        if (rc != EOK) {
    289                 printf("%s: Failed connecting to dhcp service: %s.\n",
    290                     NAME, str_error(rc));
     286                printf("%s: Failed connecting to dhcp service (%d).\n",
     287                    NAME, rc);
    291288                return 1;
    292289        }
Note: See TracChangeset for help on using the changeset viewer.