summaryrefslogtreecommitdiffstats
path: root/kiss
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2005-10-30 11:13:13 +0000
committerThomas Osterried <thomas@osterried.de>2005-10-30 11:13:13 +0000
commit62b46af4b89c0a1a34c7c8c5d986c1220a2646a2 (patch)
tree70b537d47ffd4ed1a9618d73c0108f540ce24a91 /kiss
parentaa4bb0d95fd8f0b16b6da1f4362b392fa114e8a1 (diff)
- kissparms: new option "-c" and "-X"
Diffstat (limited to 'kiss')
-rw-r--r--kiss/kissparms.88
-rw-r--r--kiss/kissparms.c37
2 files changed, 40 insertions, 5 deletions
diff --git a/kiss/kissparms.8 b/kiss/kissparms.8
index ee004de..99dfd64 100644
--- a/kiss/kissparms.8
+++ b/kiss/kissparms.8
@@ -2,7 +2,7 @@
.SH NAME
kissparms \- Configure KISS TNCs.
.SH SYNOPSIS
-.B kissparms -p <port> [-f y|n] [-h hw] [-l txtail] [-r pers] [-s slot] [-t txd] [-e feclevel] [-v] [-x]
+.B kissparms [-c crc-type] -p <port> [-f y|n] [-h hw] [-l txtail] [-r pers] [-s slot] [-t txd] [-e feclevel] [-v] [-x] [-X raw]
.SH DESCRIPTION
.LP
.B Kissparms
@@ -26,6 +26,9 @@ in exactly the same manner. Therefore
functionality extends to more than KISS TNCs.
.SH OPTIONS
.TP 12
+.BI "\-c crc-type"
+Sets the crc-type to use. For e.g. kernel mkiss: 0 = auto, 1 = none, 2 = flexnet, 3 = smack
+.TP 12
.BI "\-p port"
Sets the port that is being configured.
.TP 12
@@ -63,6 +66,9 @@ Display the version.
Takes the TNC out of KISS mode back into ``normal'' mode. This command is
manufacturer specific but works in many cases. This option overrides all
options except the port number.
+.TP 12
+.BI \-X raw
+Sends the specified raw value to the kiss driver.
.SH "SEE ALSO"
.BR axports (5),
.BR kissattach (8).
diff --git a/kiss/kissparms.c b/kiss/kissparms.c
index 84cd35d..9a059f4 100644
--- a/kiss/kissparms.c
+++ b/kiss/kissparms.c
@@ -37,12 +37,12 @@
#define PARAM_FECLEVEL 8
#define PARAM_RETURN 255
-#define USAGE "usage: kissparms -p <port> [-f y|n] [-h hw] [-l txtail] \
- [-r pers ] [-s slot] [-t txd] [-e feclevel] [-v] [-x]\n"
+#define USAGE "usage: kissparms [-c crc-type] -p <port> [-f y|n] [-h hw] [-l txtail]\n [-r pers ] [-s slot] [-t txd] [-e feclevel] [-v] [-x] [-X raw]\n"
int main(int argc, char *argv[])
{
- unsigned char buffer[2];
+ //unsigned char buffer[2];
+ unsigned char buffer[256];
struct sockaddr sa;
int proto = ETH_P_AX25;
int txdelay = -1;
@@ -52,8 +52,10 @@ int main(int argc, char *argv[])
int fulldup = -1;
int hardware = -1;
int feclevel = -1;
+ int crcmode = -1;
int kissoff = 0;
int buflen, s;
+ int X = 0;
char *port = NULL;
if (ax25_config_load_ports() == 0) {
@@ -61,8 +63,11 @@ int main(int argc, char *argv[])
return 1;
}
- while ((s = getopt(argc, argv, "e:f:h:l:p:r:s:t:vx")) != -1) {
+ while ((s = getopt(argc, argv, "c:e:f:h:l:p:r:s:t:X:vx")) != -1) {
switch (s) {
+ case 'c':
+ crcmode = atoi(optarg);
+ break;
case 'e':
feclevel = atoi(optarg);
if (feclevel < 0 || feclevel > 3) {
@@ -136,6 +141,17 @@ int main(int argc, char *argv[])
kissoff = 1;
break;
+ case 'X':
+ buflen = 0;
+ do {
+ buffer[buflen++] = atoi(optarg);
+ while (*optarg && isalnum(*optarg & 0xff))
+ optarg++;
+ while (*optarg && isspace(*optarg & 0xff))
+ optarg++;
+ } while (*optarg);
+ X = 1;
+ break;
case ':':
case '?':
fprintf(stderr, USAGE);
@@ -155,9 +171,12 @@ int main(int argc, char *argv[])
strcpy(sa.sa_data, ax25_config_get_dev(port));
+ if (X && buflen)
+ goto rawsend;
if (kissoff) {
buffer[0] = PARAM_RETURN;
buflen = 1;
+rawsend:
if (sendto(s, buffer, buflen, 0, &sa, sizeof(struct sockaddr)) == -1) {
perror("kissparms: sendto");
return 1;
@@ -228,6 +247,16 @@ int main(int argc, char *argv[])
return 1;
}
}
+
+ if (crcmode != -1) {
+ buffer[0] = 0x85;
+ buffer[1] = crcmode;
+ buflen = 2;
+ if (sendto(s, buffer, buflen, 0, &sa, sizeof(struct sockaddr)) == -1) {
+ perror("kissparms: sendto");
+ return 1;
+ }
+ }
}
close(s);