Skip to content

cc110x: fix netdev get/set according to netopt_t doc#8026

Merged
kaspar030 merged 1 commit intoRIOT-OS:masterfrom
miri64:cc1100/fix/netopt-max-pkt-size-width
Apr 16, 2018
Merged

cc110x: fix netdev get/set according to netopt_t doc#8026
kaspar030 merged 1 commit intoRIOT-OS:masterfrom
miri64:cc1100/fix/netopt-max-pkt-size-width

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Nov 14, 2017

According to the doc of NETOPT_MAX_PACKET_SIZE the type should be uint16_t and thus gnrc_netif2 assumes that. The cc110x radio currently returns this option as a uint8_t which causes gnrc_netif2 to work with it error-prone. This PR fixes that.

Edit: as @cgundogan pointed out: other options were also wrong/defined by magic numbers, so I changed the topic of this PR to reflect the other changes.

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: drivers Area: Device drivers labels Nov 14, 2017
@miri64 miri64 requested a review from kaspar030 November 14, 2017 09:01
case NETOPT_ADDRESS:
assert(value_len > 0);
*((uint8_t *)value) = cc110x->radio_address;
return 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this line?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addresses for the cc11xx are 1 byte long, so I'm not sure I understand your unspecific question ;)

Copy link
Copy Markdown
Member

@cgundogan cgundogan Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, why not use sizeof(cc110x->radio_channel) here? Or sizeof(uint8_t)? At least this seemed to be your motiviation when I look at your change a few lines above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typical "while you're at it" comment, but fine... will fix.

@miri64 miri64 changed the title cc110x: fix NETOPT_MAX_PACKET_SIZE to type according to netopt_t doc cc110x: fix netdev get/set according to netopt_t doc Mar 20, 2018
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 20, 2018

Done (and changed the topic of this PR accordingly).

@miri64 miri64 force-pushed the cc1100/fix/netopt-max-pkt-size-width branch from 9ec1e1d to 230417d Compare April 11, 2018 10:48
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Apr 11, 2018

Rebased and squashed to current master.

@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 11, 2018
@miri64 miri64 added this to the Release 2018.04 milestone Apr 11, 2018
Copy link
Copy Markdown
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

@kaspar030
Copy link
Copy Markdown
Contributor

drivers/cc110x/cc110x-netdev.c:136: style (unreadVariable): Variable 'arg' is assigned a value that is never used.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Apr 12, 2018

Fixed and amended.

@miri64 miri64 force-pushed the cc1100/fix/netopt-max-pkt-size-width branch from 230417d to 247b1a0 Compare April 12, 2018 22:29
@kaspar030 kaspar030 merged commit fbea4f9 into RIOT-OS:master Apr 16, 2018
maxvankessel pushed a commit to maxvankessel/RIOT that referenced this pull request Apr 20, 2018
…-size-width

cc110x: fix netdev get/set according to `netopt_t` doc
@miri64 miri64 deleted the cc1100/fix/netopt-max-pkt-size-width branch August 12, 2018 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants