/* HM-sniffer for HM-CFG-USB
*
- * Copyright (c) 2013-15 Michael Gernoth <michael@gernoth.net>
+ * Copyright (c) 2013-16 Michael Gernoth <michael@gernoth.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
case 0x70:
return "Weather event";
break;
+ case 0xca:
+ return "Firmware";
+ break;
+ case 0xcb:
+ return "Rf configuration";
+ break;
default:
return "?";
break;
break;
case 'R':
case 'I':
+ case 'G':
break;
default:
hexdump(buf, buf_len, "Unknown> ");
{
fprintf(stderr, "Syntax: %s options\n\n", prog);
fprintf(stderr, "Possible options:\n");
+ fprintf(stderr, "\t-f\t\tfast (100k/firmware update) mode\n");
+ fprintf(stderr, "\t-S serial\tuse HM-CFG-USB with given serial\n");
fprintf(stderr, "\t-v\t\tverbose mode\n");
fprintf(stderr, "\t-V\t\tshow version (" VERSION ")\n");
{
struct hmcfgusb_dev *dev;
struct recv_data rdata;
+ char *serial = NULL;
int quit = 0;
+ int speed = 10;
+ uint8_t speed_buf[2];
int opt;
- while((opt = getopt(argc, argv, "vV")) != -1) {
+ while((opt = getopt(argc, argv, "fS:vV")) != -1) {
switch (opt) {
+ case 'f':
+ speed = 100;
+ break;
+ case 'S':
+ serial = optarg;
+ break;
case 'v':
verbose = 1;
break;
case 'V':
printf("hmsniff " VERSION "\n");
- printf("Copyright (c) 2013-15 Michael Gernoth\n\n");
+ printf("Copyright (c) 2013-16 Michael Gernoth\n\n");
exit(EXIT_SUCCESS);
case 'h':
case ':':
memset(&rdata, 0, sizeof(rdata));
rdata.wrong_hmid = 0;
- dev = hmcfgusb_init(parse_hmcfgusb, &rdata);
+ dev = hmcfgusb_init(parse_hmcfgusb, &rdata, serial);
if (!dev) {
fprintf(stderr, "Can't initialize HM-CFG-USB, retrying in 1s...\n");
sleep(1);
hmcfgusb_send_null_frame(dev, 1);
hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
+ hmcfgusb_send_null_frame(dev, 1);
+ speed_buf[0] = 'G';
+ speed_buf[1] = speed;
+ hmcfgusb_send(dev, speed_buf, 2, 1);
+
while(!quit) {
int fd;