38
38
#include "py/mphal.h"
39
39
#endif
40
40
#include "extmod/modwebsocket.h"
41
+ #include "genhdr/mpversion.h"
41
42
42
43
#if MICROPY_PY_WEBREPL
43
44
@@ -57,7 +58,7 @@ struct webrepl_file {
57
58
char fname [64 ];
58
59
} __attribute__((packed ));
59
60
60
- enum { PUT_FILE = 1 , GET_FILE , LIST_DIR };
61
+ enum { PUT_FILE = 1 , GET_FILE , GET_VER };
61
62
enum { STATE_PASSWD , STATE_NORMAL };
62
63
63
64
typedef struct _mp_obj_webrepl_t {
@@ -128,6 +129,20 @@ STATIC int write_file_chunk(mp_obj_webrepl_t *self) {
128
129
}
129
130
130
131
STATIC void handle_op (mp_obj_webrepl_t * self ) {
132
+
133
+ // Handle operations not requiring opened file
134
+
135
+ switch (self -> hdr .type ) {
136
+ case GET_VER : {
137
+ static char ver [] = {MICROPY_VERSION_MAJOR , MICROPY_VERSION_MINOR , MICROPY_VERSION_MICRO };
138
+ write_webrepl (self -> sock , ver , sizeof (ver ));
139
+ self -> hdr_to_recv = sizeof (struct webrepl_file );
140
+ return ;
141
+ }
142
+ }
143
+
144
+ // Handle operations requiring opened file
145
+
131
146
mp_obj_t open_args [2 ] = {
132
147
mp_obj_new_str (self -> hdr .fname , strlen (self -> hdr .fname ), false),
133
148
MP_OBJ_NEW_QSTR (MP_QSTR_rb )
0 commit comments