This commit is contained in:
2018-04-06 23:06:14 +02:00
parent d3f8544318
commit 75c50b63c1
3 changed files with 55 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
./prog [<mode> <IFNAME>]
./prog [<mode> <options>]
mode:
0 is default
@@ -9,7 +9,4 @@ mode:
3: blue
4: off
5: white
IFNAME:
Interface name like "eth0" or "enp5s0"
enp5s0 is default
6: whole string with <options> color

View File

@@ -34,17 +34,14 @@ int main(int argc, char *argv[])
int tx_len = 0;
int mode;
int i;
unsigned char r,g,b;
char sendbuf[BUF_SIZ];
struct ether_header *eh = (struct ether_header *) sendbuf;
struct iphdr *iph = (struct iphdr *) (sendbuf + sizeof(struct ether_header));
struct sockaddr_ll socket_address;
char ifName[IFNAMSIZ];
/* Get interface name */
if (argc > 2)
strcpy(ifName, argv[2]);
else
strcpy(ifName, DEFAULT_IF);
strcpy(ifName, DEFAULT_IF);
if (argc > 1)
mode = atoi(argv[1]);
@@ -349,6 +346,18 @@ sendbuf[tx_len++] = 0x00;
for (i = 0; i< 3*60; i++) {
sendbuf[tx_len++] = 0xff;
}
} else if (mode == 6) {
if (argc < 5) return 0;
r = (unsigned char) atoi(argv[2]);
g = (unsigned char) atoi(argv[3]);
b = (unsigned char) atoi(argv[4]);
for (i = 0; i< 60; i++) {
sendbuf[tx_len++] = r;
sendbuf[tx_len++] = g;
sendbuf[tx_len++] = b;
}
}