shortcmd checked
This commit is contained in:
@@ -35,37 +35,6 @@ uint16_t SScalcChecksum(uint8_t *buf, int len){
|
||||
return checksum;
|
||||
}
|
||||
|
||||
// send short/long binary command
|
||||
static int bincmd(uint8_t *cmd, int len){
|
||||
static data_t *dscmd = NULL, *dlcmd = NULL;
|
||||
if(!dscmd) dscmd = cmd2dat(CMD_SHORTCMD);
|
||||
if(!dlcmd) dlcmd = cmd2dat(CMD_LONGCMD);
|
||||
if(len == sizeof(SSscmd)){
|
||||
((SSscmd*)cmd)->checksum = SScalcChecksum(cmd, len-2);
|
||||
DBG("Short command");
|
||||
if(!MountWriteRead(dscmd, NULL)) return -1;
|
||||
}else if(len == sizeof(SSlcmd)){
|
||||
((SSlcmd*)cmd)->checksum = SScalcChecksum(cmd, len-2);
|
||||
DBG("Long command");
|
||||
if(!MountWriteRead(dlcmd, NULL)) return -1;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
DBG("Write %d bytes and wait for ans", len);
|
||||
data_t d;
|
||||
d.buf = cmd;
|
||||
d.len = d.maxlen = len;
|
||||
return MountWriteRead(&d, &d);
|
||||
}
|
||||
// return TRUE if OK
|
||||
int SScmdS(SSscmd *cmd){
|
||||
return bincmd((uint8_t *)cmd, sizeof(SSscmd));
|
||||
}
|
||||
int SScmdL(SSlcmd *cmd){
|
||||
return bincmd((uint8_t *)cmd, sizeof(SSlcmd));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief SSconvstat - convert stat from SSII format to human
|
||||
* @param status (i) - just read data
|
||||
|
||||
Reference in New Issue
Block a user