summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2008-09-21 23:15:57 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2008-09-21 23:15:57 +0000
commitae8ffb7f1ed2ab730d2b71d904e6b0d280738154 (patch)
tree495dc9811f377888c3648d336626e342dc3df309
parentf608a3a09fb8df955c8603cd341a2cc302edae78 (diff)
downloadcanutils-ae8ffb7f1ed2ab730d2b71d904e6b0d280738154.tar.gz
* cansend.c:
mask canid before sending git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-3.0-trunk@94 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c
-rw-r--r--src/cansend.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cansend.c b/src/cansend.c
index caec590..ffb888a 100644
--- a/src/cansend.c
+++ b/src/cansend.c
@@ -47,7 +47,9 @@ enum {
int main(int argc, char **argv)
{
- struct can_frame frame;
+ struct can_frame frame = {
+ .can_id = 1,
+ };
struct ifreq ifr;
struct sockaddr_can addr;
char *interface = "can0";
@@ -70,8 +72,6 @@ int main(int argc, char **argv)
{ 0, 0, 0, 0 },
};
- frame.can_id = 1;
-
while ((opt = getopt_long(argc, argv, "hf:t:p:vi:l::re", long_options, NULL)) != -1) {
switch (opt) {
case 'h':
@@ -155,11 +155,16 @@ int main(int argc, char **argv)
}
frame.can_dlc = dlc;
- if (rtr)
- frame.can_id |= CAN_RTR_FLAG;
- if (extended)
+ if (extended) {
+ frame.can_id &= CAN_EFF_MASK;
frame.can_id |= CAN_EFF_FLAG;
+ } else {
+ frame.can_id &= CAN_SFF_MASK;
+ }
+
+ if (rtr)
+ frame.can_id |= CAN_RTR_FLAG;
if (verbose) {
printf("id: %d ", frame.can_id);