FreeCalypso > hg > freecalypso-sw
comparison rvinterf/etmsync/rfcap.c @ 913:091ebd46a9cc
user-friendly set-rfcap implemented in fc-fsio
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 08 Sep 2015 08:55:21 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
912:f50c71442d50 | 913:091ebd46a9cc |
---|---|
1 /* | |
2 * Setting of /gsm/com/rfcap | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include "exitcodes.h" | |
11 | |
12 static struct band_table { | |
13 char *keyword; | |
14 u_char bytes[4]; | |
15 } band_table[] = { | |
16 {"dual-eu", {0x00, 0x0B, 0x41, 0x00}}, | |
17 {"dual-us", {0x00, 0x14, 0x00, 0x14}}, | |
18 {"tri900", {0x00, 0x0F, 0x41, 0x10}}, | |
19 {"tri850", {0x00, 0x16, 0x01, 0x14}}, | |
20 {"quad", {0x00, 0x1F, 0x41, 0x14}}, | |
21 {0, {0x00, 0x00, 0x00, 0x00}} | |
22 }; | |
23 | |
24 static u_char rfcap_tail[12] = {0x00, 0x00, 0x00, 0x00, | |
25 0x50, 0x00, 0x00, 0xA5, | |
26 0x05, 0x00, 0xC0, 0x00}; | |
27 | |
28 set_rfcap(band_config_kw) | |
29 char *band_config_kw; | |
30 { | |
31 static char filename[] = "/gsm/com/rfcap"; | |
32 u_char bytes[16]; | |
33 struct band_table *tp; | |
34 | |
35 for (tp = band_table; tp->keyword; tp++) | |
36 if (!strcmp(tp->keyword, band_config_kw)) | |
37 break; | |
38 if (!tp->keyword) { | |
39 printf("error: band configuration \"%s\" not known\n", | |
40 band_config_kw); | |
41 return(ERROR_USAGE); | |
42 } | |
43 bcopy(tp->bytes, bytes, 4); | |
44 bcopy(rfcap_tail, bytes + 4, 12); | |
45 | |
46 printf("Writing \"%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\" into %s\n", | |
47 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], | |
48 bytes[6], bytes[7], bytes[8], bytes[9], bytes[10], bytes[11], | |
49 bytes[12], bytes[13], bytes[14], bytes[15], filename); | |
50 return do_short_fwrite(filename, bytes, 16); | |
51 } |