@@ -213,14 +213,28 @@ static int cmd_fill(const struct shell *shell, size_t argc, char **argv)
213
213
return 0 ;
214
214
}
215
215
216
+ /* Device name autocompletion support */
217
+ static void device_name_get (size_t idx , struct shell_static_entry * entry )
218
+ {
219
+ const struct device * dev = shell_device_lookup (idx , NULL );
220
+
221
+ entry -> syntax = (dev != NULL ) ? dev -> name : NULL ;
222
+ entry -> handler = NULL ;
223
+ entry -> help = NULL ;
224
+ entry -> subcmd = NULL ;
225
+ }
226
+
227
+ SHELL_DYNAMIC_CMD_CREATE (dsub_device_name , device_name_get );
228
+
216
229
SHELL_STATIC_SUBCMD_SET_CREATE (eeprom_cmds ,
217
- SHELL_CMD_ARG (read , NULL , "<device> <offset> <length>" , cmd_read , 4 , 0 ),
218
- SHELL_CMD_ARG (write , NULL ,
230
+ SHELL_CMD_ARG (read , & dsub_device_name ,
231
+ "<device> <offset> <length>" , cmd_read , 4 , 0 ),
232
+ SHELL_CMD_ARG (write , & dsub_device_name ,
219
233
"<device> <offset> [byte0] <byte1> .. <byteN>" , cmd_write ,
220
234
4 , CONFIG_EEPROM_SHELL_BUFFER_SIZE - 1 ),
221
- SHELL_CMD_ARG (size , NULL , "<device>" , cmd_size , 2 , 0 ),
222
- SHELL_CMD_ARG (fill , NULL , "<device> <offset> <length> <pattern>" ,
223
- cmd_fill , 5 , 0 ),
235
+ SHELL_CMD_ARG (size , & dsub_device_name , "<device>" , cmd_size , 2 , 0 ),
236
+ SHELL_CMD_ARG (fill , & dsub_device_name ,
237
+ "<device> <offset> <length> <pattern>" , cmd_fill , 5 , 0 ),
224
238
SHELL_SUBCMD_SET_END
225
239
);
226
240
0 commit comments