Skip to content
Snippets Groups Projects
Commit 27060527 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

The USR modem isn't so bad that it needs parity generated

We just need to strip the high bit on RX because the mode leaves
it on received bytes.
parent 20c4351a
No related branches found
No related tags found
No related merge requests found
Pipeline #7228 passed
......@@ -15,13 +15,7 @@
#include "uifcinit.h"
static COM_HANDLE com = COM_HANDLE_INVALID;
static pthread_once_t ptable_once = PTHREAD_ONCE_INIT;
static char ptable[128];
static int nbits[16] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
};
static bool seven_bits = false;
static int parity = SYNCTERM_PARITY_NONE;
void
modem_input_thread(void *args)
......@@ -89,16 +83,6 @@ modem_output_thread(void *args)
if (seven_bits) {
for (i = 0; i < wr; i++)
conn_api.wr_buf[i] &= 0x7f;
switch (parity) {
case SYNCTERM_PARITY_NONE:
break;
case SYNCTERM_PARITY_EVEN:
conn_api.wr_buf[i] = ptable[conn_api.wr_buf[i]];
break;
case SYNCTERM_PARITY_ODD:
conn_api.wr_buf[i] = ptable[conn_api.wr_buf[i]] ^ 0x80;
break;
}
}
sent = 0;
while (com != COM_HANDLE_INVALID && sent < wr) {
......@@ -164,26 +148,12 @@ modem_response(char *str, size_t maxlen, int timeout)
return 0;
}
void
init_ptable(void)
{
int i;
int nb;
for (i = 0; i < (sizeof(ptable) / sizeof(ptable[0])); i++) {
nb = nbits[i & 0x0f] | nbits[i >> 4];
ptable[i] = ((nb & 1) << 7) | i;
}
}
int
modem_connect(struct bbslist *bbs)
{
int ret;
char respbuf[1024];
pthread_once(&ptable_once, init_ptable);
parity = bbs->parity;
seven_bits = (bbs->data_bits == 7);
if (!bbs->hidepopups)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment