Changeset 1dcc0b9 in mainline for uspace/lib/drv/generic/remote_ieee80211.c
- Timestamp:
- 2015-04-06T10:47:51Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d7dadcb4
- Parents:
- 59fa7ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_ieee80211.c
r59fa7ab r1dcc0b9 47 47 typedef enum { 48 48 IEEE80211_GET_SCAN_RESULTS, 49 IEEE80211_CONNECT 49 IEEE80211_CONNECT, 50 IEEE80211_DISCONNECT 50 51 } ieee80211_funcs_t; 51 52 … … 59 60 */ 60 61 int ieee80211_get_scan_results(async_sess_t *dev_sess, 61 ieee80211_scan_results_t *results )62 ieee80211_scan_results_t *results, bool now) 62 63 { 63 64 assert(results); … … 65 66 async_exch_t *exch = async_exchange_begin(dev_sess); 66 67 67 aid_t aid = async_send_ 1(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),68 IEEE80211_GET_SCAN_RESULTS, NULL);68 aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE), 69 IEEE80211_GET_SCAN_RESULTS, now, NULL); 69 70 int rc = async_data_read_start(exch, results, sizeof(ieee80211_scan_results_t)); 70 71 async_exchange_end(exch); … … 73 74 async_wait_for(aid, &res); 74 75 75 if (rc != EOK) 76 if(res != EOK) 77 return (int) res; 78 else 76 79 return rc; 77 78 return (int) res;79 80 } 80 81 … … 82 83 * 83 84 * @param[in] dev_sess Device session. 84 * @param[in] ssid Network SSID.85 * @param[in] ssid_start Network SSID prefix. 85 86 * @param[in] password Network password (pass empty string if not needed). 86 87 * … … 88 89 * negative error code otherwise. 89 90 */ 90 int ieee80211_connect(async_sess_t *dev_sess, char *ssid , char *password)91 { 92 assert(ssid );91 int ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password) 92 { 93 assert(ssid_start); 93 94 94 95 sysarg_t rc_orig; … … 99 100 IEEE80211_CONNECT, NULL); 100 101 101 sysarg_t rc = async_data_write_start(exch, ssid, str_size(ssid) + 1); 102 sysarg_t rc = async_data_write_start(exch, ssid_start, 103 str_size(ssid_start) + 1); 102 104 if (rc != EOK) { 103 105 async_exchange_end(exch); … … 132 134 } 133 135 136 /** Disconnect device from network. 137 * 138 * @param[in] dev_sess Device session. 139 * 140 * @return EOK If the operation was successfully completed, 141 * negative error code otherwise. 142 */ 143 int ieee80211_disconnect(async_sess_t *dev_sess) 144 { 145 async_exch_t *exch = async_exchange_begin(dev_sess); 146 int rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE), 147 IEEE80211_DISCONNECT); 148 async_exchange_end(exch); 149 150 return rc; 151 } 152 134 153 static void remote_ieee80211_get_scan_results(ddf_fun_t *fun, void *iface, 135 154 ipc_callid_t callid, ipc_call_t *call) … … 141 160 memset(&scan_results, 0, sizeof(ieee80211_scan_results_t)); 142 161 143 int rc = ieee80211_iface->get_scan_results(fun, &scan_results); 162 bool now = IPC_GET_ARG2(*call); 163 164 int rc = ieee80211_iface->get_scan_results(fun, &scan_results, now); 144 165 if (rc == EOK) { 145 166 ipc_callid_t data_callid; … … 170 191 assert(ieee80211_iface->connect); 171 192 172 char ssid [MAX_STRING_SIZE];193 char ssid_start[MAX_STRING_SIZE]; 173 194 char password[MAX_STRING_SIZE]; 174 195 … … 187 208 } 188 209 189 int rc = async_data_write_finalize(data_callid, ssid , len);210 int rc = async_data_write_finalize(data_callid, ssid_start, len); 190 211 if (rc != EOK) { 191 212 async_answer_0(data_callid, EINVAL); … … 213 234 } 214 235 215 rc = ieee80211_iface->connect(fun, ssid, password); 216 236 rc = ieee80211_iface->connect(fun, ssid_start, password); 237 238 async_answer_0(callid, rc); 239 } 240 241 static void remote_ieee80211_disconnect(ddf_fun_t *fun, void *iface, 242 ipc_callid_t callid, ipc_call_t *call) 243 { 244 ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface; 245 assert(ieee80211_iface->disconnect); 246 int rc = ieee80211_iface->disconnect(fun); 217 247 async_answer_0(callid, rc); 218 248 } … … 223 253 static const remote_iface_func_ptr_t remote_ieee80211_iface_ops[] = { 224 254 [IEEE80211_GET_SCAN_RESULTS] = remote_ieee80211_get_scan_results, 225 [IEEE80211_CONNECT] = remote_ieee80211_connect 255 [IEEE80211_CONNECT] = remote_ieee80211_connect, 256 [IEEE80211_DISCONNECT] = remote_ieee80211_disconnect 226 257 }; 227 258
Note:
See TracChangeset
for help on using the changeset viewer.