8000 webrepl.html: Add function to query uPy version via GET_VER. · micropython/webrepl@1ad1c29 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ad1c29

Browse files
dpgeorgePaul Sokolovsky
authored and
Paul Sokolovsky
committed
webrepl.html: Add function to query uPy version via GET_VER.
Currently this function is not used but it can be tested by running get_ver() at the JS console in the browser.
1 parent b48cd19 commit 1ad1c29

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

webrepl.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@
221221
}
222222
binary_state = 0;
223223
break;
224+
case 31:
225+
// first (and last) response for GET_VER
226+
console.log('GET_VER', data);
227+
binary_state = 0;
228+
break;
224229
}
225230
}
226231
term.write(event.data);
@@ -300,6 +305,19 @@
300305
ws.send(rec);
301306
}
302307

308+
function get_ver() {
309+
// WEBREPL_REQ_S = "<2sBBQLH64s"
310+
var rec = new Uint8Array(2 + 1 + 1 + 8 + 4 + 2 + 64);
311+
rec[0] = 'W'.charCodeAt(0);
312+
rec[1] = 'A'.charCodeAt(0);
313+
rec[2] = 3; // GET_VER
314+
// rest of "rec" is zero
315+
316+
// initiate GET_VER
317+
binary_state = 31;
318+
ws.send(rec);
319+
}
320+
303321
function handle_put_file_select(evt) {
304322
// The event holds a FileList object which is a list of File objects,
305323
// but we only support single file selection at the moment.

0 commit comments

Comments
 (0)
0