-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Flipper SubGHz v1 input format #192
base: master
Are you sure you want to change the base?
Conversation
friendly bump :) |
} | ||
|
||
sr_dbg("logical %d duration %ld", logic, num_samples); | ||
ret = feed_queue_logic_submit(inc->feed_logic, &logic, num_samples); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal API has changed this call to feed_queue_logic_submit_one() (same parameters), so this no longer works.
sr_dbg("Flipper SubGHz version 1 file format detected"); | ||
return TRUE; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three functions should just be reduced to an inline g_strstr_len() call.
num_values = g_strv_length(values); | ||
sr_dbg("Line contains %d raw values", num_values); | ||
for (int i = 0; i < num_values; i++) { | ||
signed long value = strtol(values[i], (char **)NULL, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check first two items at https://github.com/sigrokproject/libsigrok/blob/master/HACKING#L76
} | ||
ret = process_value(inc, value); | ||
if (ret != SR_OK) | ||
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot g_strfreev(values);
here
memset(occurrence, ' ', strlen(RAW_DATA_STR)); | ||
} | ||
int ret = parse_raw_values(inc, g_strstrip(lines[i])); | ||
if (ret != SR_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above wrt variable initialization/assignment.
SR_PRIV struct sr_input_module input_flipper_sub = { | ||
.id = "flipper", | ||
.name = "flipper", | ||
.desc = "Flipper Sub-GHz v1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flipper appears to have a bunch of file formats, and this only handles the sub-ghz v1 format. Perhaps this module should be called flipper-subghz
?
Please also rebase against current master. Lots of comments, but the code works! Any chance of getting some example thanks |
return TRUE; | ||
} | ||
|
||
static gboolean parse_header(GString *buf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need a return value at all ? looks like it only returns TRUE
This PR provides a new input module that adds support to read Flipper Zero generated raw .sub (SubGHz) signal files.
These files are saved by the Flipper Zero when using the Read RAW function.
These files follow a simple format. Any .sub file contains a single channel with the logical (de-modulated) signal. The raw data represents the duration (in micro seconds) for either logical high (duration as a positive integer) or logical low (duration as a negative integer).
Examples of these .sub files can be found all over the net, e.g. https://github.com/MuddledBox/FlipperZeroSub-GHz/blob/main/Vehicles/Tesla/Tesla_charge_door_AM270.sub