X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/3e5b474f9cd113def3be02af0cf6d5401a7427c9..659b098309c2bca57ac60a35a1b9900d6f28e74d:/lincan/src/write.c diff --git a/lincan/src/write.c b/lincan/src/write.c index 2874003..2f32b2e 100644 --- a/lincan/src/write.c +++ b/lincan/src/write.c @@ -61,6 +61,8 @@ ssize_t can_write(struct file *file, const char *buffer, size_t length, loff_t * /* Prepare first message */ copy_from_user(&msg_buff, buffer, sizeof(struct canmsg_t)); + /* Automatic selection of extended format if "extended" set and ID>2047 */ + if (extended) if (msg_buff.id & ~0x7ffl ) msg_buff.flags |= MSG_EXT; /* If the output buffer is full, return immediately in case O_NONBLOCK * has been specified or loop until space becomes available. @@ -93,6 +95,8 @@ ssize_t can_write(struct file *file, const char *buffer, size_t length, loff_t * while (bytes_to_copy > 0) { /* Prepare first message */ copy_from_user(&msg_buff, buffer, sizeof(struct canmsg_t)); + /* Automatic selection of extended format if "extended" set and ID>2047 */ + if (extended) if (msg_buff.id & ~0x7ffl ) msg_buff.flags |= MSG_EXT; /* Get slot */ if(canque_get_inslot4id(qends, &qedge, &slot, 0, msg_buff.id, 0) < 0) break;