-
Notifications
You must be signed in to change notification settings - Fork 321
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
Channel label support #1229
Channel label support #1229
Changes from all commits
443d8a8
978eb30
7a884a3
b7e2678
da5a2b1
d7bf42a
eb366f2
a236dc1
d27b264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -835,6 +835,22 @@ static int add_attr_to_channel(struct iio_channel *chn, | |
union iio_pointer p = { .chn = chn, }; | ||
struct iio_attr_list *attrs; | ||
int ret; | ||
size_t lbl_len = strlen("_label"); | ||
char label[512]; | ||
const char *dev_id; | ||
|
||
if (strlen(name) >= lbl_len && | ||
!strcmp(name + strlen(name) - lbl_len, "_label")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still not convinced the above is not just doing something There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to address your concern. With these changes:
I am getting the following: analog@analog:~/workspace-dan/libiio/build_v1 $ utils/iio_info Which seems that it strips away the input/output information and the channel id. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I was now just getting more familiar with libiio code for populating channels and attrs. Indeed for legacy devices which make use of extended_names (which are now exposed as labels) the short name function won't work. out_altvoltage1_TX1_I_F2_label - TX1_I_F2 is the extended name and will be seen as the channel name by libiio. This stuff seems to be addressed later on in |
||
dev_id = iio_device_get_id(iio_channel_get_device(chn)); | ||
ret = local_do_read_dev_attr(dev_id, 0, name, | ||
label, sizeof(label), IIO_ATTR_TYPE_CHANNEL); | ||
if (ret > 0) | ||
chn->label = iio_strdup(label); | ||
else | ||
chn_perror(chn, ret, "Unable to read channel label"); | ||
|
||
return 0; | ||
} | ||
dNechita marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
name = get_short_attr_name(chn, name); | ||
|
||
|
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.
nothing wrong with the patch but commit subject does not match the style :)
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.
do you mean that there is an extra tab on this line?
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.
no.. the commit title itself. nothing wrong with the code. It's a nitpick but consistency across git log is a good thing. Also good for grepping the history
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.
Oh, I got it now. I need to grab another coffee.