Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not quit cmux mode, and there are ttys residue #4

Open
alex-founder opened this issue Jan 22, 2018 · 1 comment
Open

can not quit cmux mode, and there are ttys residue #4

alex-founder opened this issue Jan 22, 2018 · 1 comment

Comments

@alex-founder
Copy link

when module reset , the UART will not quit and the ttyGSM is residue , so can not rebuild the new ttyGSM.
please help me and tell me how to quit cmux, thank you

@eric-bentley
Copy link

I put cleanup code in the signal_handler to send the terminate packet. Works to put the serial port back to non-mux.

// terminate frame from section 6 of
// https://www.kernel.org/doc/Documentation/serial/n_gsm.txt
static const uint8_t gsm0710_terminate[] = {
0xf9, /* open flag /
0x03, /
channel 0 /
0xef, /
UIH frame /
0x05, /
2 data bytes /
0xc3, /
terminate 1 /
0x01, /
terminate 2 /
0xf2, /
crc /
0xf9, /
close flag */
};

int fd=0;

void signal_handler(int signum) {
int write_count;

/* terminate gsm 0710 multiplexing on the modem side */
write_count = write(fd, gsm0710_terminate, sizeof(gsm0710_terminate));
if (write_count != sizeof(gsm0710_terminate))
    fprintf(stderr, "Failed to terminate gsm multiplexing");

printf("cmux daemon exit!\n");
close(fd);
exit(0);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants