資源簡介
socketcan提供的linux下的CAN網絡工具包
canutils-3.0.2.tar.bz2
代碼片段和文件信息
/*
?*?canutils/canconfig.c
?*
?*?Copyright?(C)?2005?2008?Marc?Kleine-Budde??Pengutronix
?*?Copyright?(C)?2007?Juergen?Beisert??Pengutronix
?*
?*?This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?version?2?of?the?GNU?General?Public?License
?*?as?published?by?the?Free?Software?Foundation
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.?See?the
?*?GNU?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*?along?with?this?program;?if?not?write?to?the?Free?Software
?*?Foundation?Inc.?59?Temple?Place?Suite?330?Boston?MA??02111-1307??USA
?*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#ifndef?MIN
#define?MIN(a?b)?((a)?(b)???(a)?:?(b))
#endif
#define?VALUE_MAX 256
#define?SYSFS_PATH_MAX 256
#define?SYSFS_MNT_PATH “/sys“
#define?SYSFS_PATH_ENV “SYSFS_PATH“
#define?CLASS_NET “/class/net/“
static?char?sysfs_path[SYSFS_PATH_MAX];
static?const?char?*dev;
static?int?version;
enum?can_sysfs_version?{
SV_0
SV_1
SV_MAX
};
enum?can_sysfs_entries?{
SE_BITRATE
SE_MAX
};
static?const?char?*can_sysfs[SV_MAX][SE_MAX]?=?{
[SV_0][SE_BITRATE]?=?“can_bitrate“
[SV_1][SE_BITRATE]?=?“can_bittiming/bitrate“
};
static?void?help(void)
{
fprintf(stderr?“usage:\n\t“
“canconfig??bitrate?{?BR?}\n\t\t“
“BR?:=?\n\t\t“
“canconfig??mode\n“
#if?0
“MODE\n\t\t“
“MODE?:=?{?start?}\n\t“
“canconfig??setentry?[?VALs?]\n\t\t“
“VALs?:=?\n\t\t“
“?bitrate?\n\t\t“
“?tq?
評論
共有 條評論