Changes in uspace/app/wifi_supplicant/wifi_supplicant.c [1d6dd2a:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/wifi_supplicant/wifi_supplicant.c
r1d6dd2a r38d150e 41 41 #include <stdio.h> 42 42 #include <stdlib.h> 43 #include <str.h>44 #include <str_error.h>45 43 #include <loc.h> 46 44 … … 88 86 } 89 87 90 static errno_t get_wifi_list(service_id_t **wifis, size_t *count)88 static int get_wifi_list(service_id_t **wifis, size_t *count) 91 89 { 92 90 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); 94 92 if (rc != EOK) { 95 93 printf("Error resolving category 'ieee80211'.\n"); … … 111 109 size_t count; 112 110 113 errno_t rc = get_wifi_list(&wifis, &count);111 int rc = get_wifi_list(&wifis, &count); 114 112 if (rc != EOK) { 115 113 printf("Error fetching wifi list.\n"); … … 134 132 } 135 133 136 static errno_t wifi_list(void)134 static int wifi_list(void) 137 135 { 138 136 service_id_t *wifis = NULL; 139 137 size_t count; 140 138 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"); 144 142 return EINVAL; 145 143 } … … 150 148 rc = loc_service_get_name(wifis[i], &svc_name); 151 149 if (rc != EOK) { 152 printf("Error getting service name : %s\n", str_error(rc));150 printf("Error getting service name.\n"); 153 151 free(wifis); 154 152 return rc; … … 163 161 } 164 162 165 static errno_t wifi_connect(uint32_t index, char *ssid_start, char *password)163 static int wifi_connect(uint32_t index, char *ssid_start, char *password) 166 164 { 167 165 assert(ssid_start); … … 174 172 } 175 173 176 errno_t rc = ieee80211_disconnect(sess);174 int rc = ieee80211_disconnect(sess); 177 175 if(rc != EOK) { 178 176 if (rc == EREFUSED) 179 177 printf("Device is not ready yet.\n"); 180 178 else 181 printf("Error when disconnecting device : %s\n",182 str_error(rc));179 printf("Error when disconnecting device. " 180 "Error: %d\n", rc); 183 181 184 182 return rc; … … 194 192 printf("Given SSID not in scan results.\n"); 195 193 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); 198 196 199 197 return rc; … … 207 205 } 208 206 209 static errno_t wifi_disconnect(uint32_t index)207 static int wifi_disconnect(uint32_t index) 210 208 { 211 209 async_sess_t *sess = get_wifi_by_index(index); … … 216 214 } 217 215 218 errno_t rc = ieee80211_disconnect(sess);216 int rc = ieee80211_disconnect(sess); 219 217 if (rc != EOK) { 220 218 if (rc == EREFUSED) … … 223 221 printf("Not connected to any WiFi network.\n"); 224 222 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); 227 225 228 226 return rc; … … 234 232 } 235 233 236 static errno_t wifi_scan(uint32_t index, bool now)234 static int wifi_scan(uint32_t index, bool now) 237 235 { 238 236 async_sess_t *sess = get_wifi_by_index(index); … … 244 242 245 243 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); 247 245 if (rc != EOK) { 248 246 if (rc == EREFUSED) 249 247 printf("Device is not ready yet.\n"); 250 248 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); 253 250 254 251 return rc; … … 278 275 int main(int argc, char *argv[]) 279 276 { 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); 284 281 return 1; 285 282 } … … 287 284 rc = dhcp_init(); 288 285 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); 291 288 return 1; 292 289 }
Note:
See TracChangeset
for help on using the changeset viewer.