static int do_cmd_reset(Camera *camera, GPContext *context) { int r; struct tf_packet reply; r = send_cmd_reset(camera,context); if(r < 0) return r; r = get_tf_packet(camera, &reply, context); if(r < 0) return r; switch (get_u32(&reply.cmd)) { case SUCCESS: gp_log (GP_LOG_DEBUG, "topfield", "TF5000PVRt should now reboot\n"); return GP_OK; break; case FAIL: gp_log (GP_LOG_ERROR, "topfield", "ERROR: Device reports %s\n", decode_error(&reply)); break; default: gp_log (GP_LOG_ERROR, "topfield", "ERROR: Unhandled packet\n"); break; } return GP_ERROR_IO; }
int do_cmd_reset(int fd) { int r; r = send_cmd_reset(fd); if(r < 0) { return -EPROTO; } r = get_tf_packet(fd, &reply); if(r < 0) { return -EPROTO; } switch (get_u32(&reply.cmd)) { case SUCCESS: printf("TF5000PVRt should now reboot\n"); return 0; break; case FAIL: fprintf(stderr, "ERROR: Device reports %s\n", decode_error(&reply)); break; default: fprintf(stderr, "ERROR: Unhandled packet\n"); } return -EPROTO; }