added FIELD.N to 'read' command for retrieving N'th FIELD, fixed getMasterNumber(), check maximum NN in message, use more constants, check all type conversions, added --nodevicecheck to ebusfeed help
This commit is contained in:
@@ -37,7 +37,7 @@ using namespace std;
|
||||
struct options
|
||||
{
|
||||
const char* device; //!< device to write to [/dev/ttyUSB60]
|
||||
int time; //!< delay between bytes in us [10000]
|
||||
unsigned int time; //!< delay between bytes in us [10000]
|
||||
|
||||
const char* dumpFile; //!< dump file to read
|
||||
};
|
||||
@@ -67,7 +67,7 @@ static const char argpdoc[] =
|
||||
" 2. create symbol links to appropriate devices, e.g.\n"
|
||||
" 'ln -s /dev/pts/2 /dev/ttyUSB60'\n"
|
||||
" 'ln -s /dev/pts/3 /dev/ttyUSB20'\n"
|
||||
" 3. start "PACKAGE": '"PACKAGE" -f -d /dev/ttyUSB20'\n"
|
||||
" 3. start "PACKAGE": '"PACKAGE" -f -d /dev/ttyUSB20 --nodevicecheck'\n"
|
||||
" 4. start ebusfeed: 'ebusfeed /path/to/ebus_dump.bin'\n";
|
||||
|
||||
/** the description of the accepted arguments. */
|
||||
@@ -101,7 +101,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state)
|
||||
opt->device = arg;
|
||||
break;
|
||||
case 't': // --time=10000
|
||||
opt->time = strtol(arg, &strEnd, 10);
|
||||
opt->time = (unsigned int)strtoul(arg, &strEnd, 10);
|
||||
if (strEnd == NULL || *strEnd != 0 || opt->time < 1000 || opt->time > 100000000) {
|
||||
argp_error(state, "invalid time");
|
||||
return EINVAL;
|
||||
@@ -131,7 +131,7 @@ int main(int argc, char* argv[])
|
||||
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, NULL, &opt) != 0)
|
||||
return EINVAL;
|
||||
|
||||
Device* device = Device::create(opt.device, true, NULL);
|
||||
Device* device = Device::create(opt.device, false, NULL);
|
||||
if (device == NULL) {
|
||||
cout << "unable to create device " << opt.device << endl;
|
||||
return EINVAL;
|
||||
@@ -150,7 +150,7 @@ int main(int argc, char* argv[])
|
||||
if (file.is_open()) {
|
||||
|
||||
while (true) {
|
||||
unsigned char byte = file.get();
|
||||
unsigned char byte = (unsigned char)file.get();
|
||||
if (file.eof())
|
||||
break;
|
||||
cout << hex << setw(2) << setfill('0')
|
||||
|
||||
Reference in New Issue
Block a user