pull/1102/head
Mike Black W9MDB 2022-07-31 07:10:15 -05:00
rodzic 57dcd19bb3
commit 81f8b03630
2 zmienionych plików z 260 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,166 @@
// can run this using rigctl/rigctld and socat pty devices
// gcc -o simft990 simft990.c
// emulates 1.2 ROM FT990 which can only read 1492 bytes
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include "../include/hamlib/rig.h"
#define BUFSIZE 256
float freqA = 14074000;
float freqB = 14074500;
char tx_vfo = '0';
char rx_vfo = '0';
char modeA = '1';
char modeB = '1';
int width_main = 500;
int width_sub = 700;
// ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e
{
NC_RIGID_NONE = 0,
NC_RIGID_FT450 = 241,
NC_RIGID_FT450D = 244,
NC_RIGID_FT950 = 310,
NC_RIGID_FT891 = 135,
NC_RIGID_FT991 = 135,
NC_RIGID_FT2000 = 251,
NC_RIGID_FT2000D = 252,
NC_RIGID_FTDX1200 = 583,
NC_RIGID_FTDX9000D = 101,
NC_RIGID_FTDX9000Contest = 102,
NC_RIGID_FTDX9000MP = 103,
NC_RIGID_FTDX5000 = 362,
NC_RIGID_FTDX3000 = 460,
NC_RIGID_FTDX101D = 681,
NC_RIGID_FTDX101MP = 682
} nc_rigid_t;
void load_dat(char *filename, unsigned char buf[1492])
{
FILE *fp = fopen(filename, "r");
char line[4096];
int n = 0;
while (fgets(line, sizeof(line), fp))
{
char *s = strdup(line);
unsigned int val;
char *p = strtok(line, " \r\n");
do
{
sscanf(p, "%x", &val);
buf[n++] = val;
}
while (p = strtok(NULL, " \r\n"));
strtok(s, "\r\n");
//printf("n=%d, %s\n",n,s);
free(s);
}
fclose(fp);
printf("%d bytes read\n", n);
}
static unsigned char alldata[1492];
int
getmyline(int fd, char *buf)
{
unsigned char c;
int i = 0;
int n = 0;
memset(buf, 0, BUFSIZE);
#if 1
while (read(fd, &c, 1) > 0 && i < 5)
{
buf[i++] = c;
n++;
}
#else
n = read(fd, buf, 5);
#endif
printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3],
buf[4]);
return n;
}
#if defined(WIN32) || defined(_WIN32)
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd;
fd = open(comport, O_RDWR);
if (fd < 0)
{
perror(comport);
}
return fd;
}
#else
int openPort(char *comport) // doesn't matter for using pts devices
{
int fd = posix_openpt(O_RDWR);
char *name = ptsname(fd);
if (name == NULL)
{
perror("pstname");
return -1;
}
printf("name=%s\n", name);
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
{
perror("posix_openpt");
return -1;
}
return fd;
}
#endif
int main(int argc, char *argv[])
{
char buf[256];
char *pbuf;
int n;
int fd = openPort(argv[1]);
load_dat("simft990.dat", alldata);
while (1)
{
int bytes = getmyline(fd, buf);
if (bytes == 0) { continue; }
if (bytes != 5)
{
printf("Not 5 bytes? bytes=%d\n", bytes);
}
if (buf[4] == 0x10)
{
write(fd, alldata, 1492);
}
}
return 0;
}

Wyświetl plik

@ -0,0 +1,94 @@
48 20 40 02 11 15 79 a8 00 00 00 01 00 00 01 80
00 00 00 ff 11 15 79 a8 00 00 00 01 00 00 01
00 00 00 03 10
80 00 00 00 ff 09 08 3e be 00 00 00 01 00 00 01
00 80 00 00 ff 02 00 e6 78 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 09 a0 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 4c 08 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 5f 90 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 7e d0 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 92 58 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 b1 98 00 00 00 03 00 00 00
80 00 00 00 ff 02 01 d4 c0 00 00 00 03 00 00 00
80 00 00 00 ff 02 02 22 e0 00 00 00 03 00 00 00
80 00 00 00 ff 03 02 4d d8 00 00 00 03 00 00 00
80 00 00 00 ff 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 19 26 0e 30 00 00 00 01 00 00 00
00 00 00 00 ff 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 16 20 6c c8 02 00 00 01 00 00 00
00 00 00 00 ff 04 03 07 00 00 00 00 00 00 00 00
00 00 00 00 ff 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 08 05 fc 08 00 00 00 00 00 00 00
80 00 00 00 ff 05 03 82 70 00 00 00 03 00 00 00
80 00 00 00 ff 07 04 e2 00 00 00 00 03 00 00 00
80 00 00 00 ff 08 05 f3 70 00 00 00 03 00 00 00
80 00 00 00 ff 09 07 3f 78 00 00 00 03 00 00 00
80 00 00 00 ff 09 09 00 b0 00 00 00 03 00 00 00
80 00 00 00 ff 0b 0a d5 70 00 00 00 03 00 00 00
80 00 00 00 ff 0d 0e 57 e0 00 00 00 03 00 00 00
80 00 00 00 ff 0f 11 b3 40 00 00 00 03 00 00 00
80 00 00 00 ff 10 14 b4 c8 00 00 00 03 00 00 00
80 00 00 00 ff 13 17 0a 70 00 00 00 03 00 00 00
80 00 00 00 ff 13 1a ac 20 00 00 00 03 00 00 00
80 00 00 00 ff 15 1c d6 d0 00 00 00 03 00 00 00
80 00 00 00 ff 16 20 ba e8 00 00 00 03 00 00 00
80 00 00 00 ff 1a 27 10 00 00 00 00 03 00 00 00
80 00 00 00 ff 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 04 02 c0 1a 00 00 00 02 01 00 00
80 00 00 00 ff 08 05 77 06 00 00 00 02 01 00 01
80 00 00 00 ff 0b 0a c0 ee 00 00 00 02 01 00 01
80 00 00 00 ff 11 15 6f 4e 00 00 00 02 01 00 01
80 00 00 00 ff 14 1b 9d 56 00 00 00 02 01 00 01
80 00 00 00 ff 16 20 25 7e 00 00 00 02 01 00 01
80 00 00 00 ff 1b 2a d3 de 00 00 00 02 01 00 01
80 00 00 00 ff 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 8b 0a ae 60 00 00 00 00 00 00 00
00 00 00 00 00 09 08 22 d0 00 00 00 02 01 00 01
80 00 00 00 ff 09 08 29 10 00 00 00 02 01 00 01
80 00 00 00 ff 09 08 2d 2a 00 00 00 02 01 00 01
80 00 00 00 ff 09 08 32 d4 00 00 00 02 01 00 01
80 00 00 00 ff 09 08 3f 54 00 00 00 02 01 00 01
80 00 00 00 ff 09 08 22 3a 00 00 00 01 00 00 01
80 00 00 00 ff 09 08 28 7a 00 00 00 01 00 00 01
80 00 00 00 ff 09 08 2c 94 00 00 00 01 00 00 01
80 00 00 00 ff 09 08 32 3e 00 00 00 01 00 00 01
80 00 00 00 ff 09 08 3e be 00 00 00 01 00 00 01