diff options
Diffstat (limited to 'mycan.c')
-rw-r--r-- | mycan.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -13,6 +13,8 @@ sudo ip link set dev vcan0 type vcan sudo ip link set dev vcan0 up cansend vcan0 630#02.00.02.00.02.00.02.00 cansend vcan0 680#02.00.02.00.02.00.02.00 +# if cell temperature is signed (can be negative), 00.FF sends -256 +cansend vcan0 680#00.FF.02.00.02.00.02.00 */ #include <stdio.h> @@ -35,7 +37,7 @@ static uint64_t u64_from_can_msg(const uint8_t m[8]) { | ((uint64_t)m[3] << 24) | ((uint64_t)m[2] << 16) | ((uint64_t)m[1] << 8) | ((uint64_t)m[0] << 0); } -int main(void) +int main(int argc, char **argv) { int ret; int s, nbytes; @@ -63,8 +65,10 @@ int main(void) } //2.Specify can0 device - strcpy(ifr.ifr_name, "can0"); - //strcpy(ifr.ifr_name, "vcan0"); + if(argc>1) + strcpy(ifr.ifr_name, argv[1]); + else + strcpy(ifr.ifr_name, "can0"); ret = ioctl(s, SIOCGIFINDEX, &ifr); if (ret < 0) { perror("ioctl failed"); |