Skip to content
Snippets Groups Projects
Commit 49fd261e authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

add support for reseting the usb bus

parent b56c003f
Branches
No related tags found
No related merge requests found
...@@ -317,6 +317,11 @@ int coincellhell_set_periodic_recal(struct coincellhell* hell, bool recal) ...@@ -317,6 +317,11 @@ int coincellhell_set_periodic_recal(struct coincellhell* hell, bool recal)
return ret; return ret;
} }
void coincellhell_reset_bus(struct coincellhell* hell)
{
usbshm_reset(hell->priv);
}
void coincellhell_disconnect(struct coincellhell* hell) void coincellhell_disconnect(struct coincellhell* hell)
{ {
if(!hell || !hell->priv) if(!hell || !hell->priv)
......
...@@ -178,6 +178,7 @@ uint32_t coincellhell_get_seconds(struct coincellhell* hell); ...@@ -178,6 +178,7 @@ uint32_t coincellhell_get_seconds(struct coincellhell* hell);
const uint8_t* coincellhell_get_fw_git_revision(struct coincellhell* hell); const uint8_t* coincellhell_get_fw_git_revision(struct coincellhell* hell);
int coincellhell_enable_watchdog(struct coincellhell* hell); int coincellhell_enable_watchdog(struct coincellhell* hell);
int coincellhell_set_periodic_recal(struct coincellhell* hell, bool recal); int coincellhell_set_periodic_recal(struct coincellhell* hell, bool recal);
void coincellhell_reset_bus(struct coincellhell* hell);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -52,6 +52,7 @@ static void print_commands(void) ...@@ -52,6 +52,7 @@ static void print_commands(void)
puts("git\t\t\t | get the git revision of the firmware on the device"); puts("git\t\t\t | get the git revision of the firmware on the device");
puts("watchdog\t\t\t | enables the on device command watchdog"); puts("watchdog\t\t\t | enables the on device command watchdog");
puts("recal [BOOLEAN]\t\t | enables or disables periodic recal"); puts("recal [BOOLEAN]\t\t | enables or disables periodic recal");
puts("reset\t\t\t | reset the usb bus of this device");
} }
static int convert_string_to_heater_id(const char* str) static int convert_string_to_heater_id(const char* str)
...@@ -367,6 +368,11 @@ static int process_commands(char** commands, size_t command_count, struct coince ...@@ -367,6 +368,11 @@ static int process_commands(char** commands, size_t command_count, struct coince
if(ret < 0) if(ret < 0)
puts("could not enable watchdog"); puts("could not enable watchdog");
} }
else if(strcmp(commands[0], "reset") == 0)
{
coincellhell_reset_bus(hell);
ret = 0;
}
else else
{ {
printf("%s is not a valid command!", commands[0]); printf("%s is not a valid command!", commands[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment