mirror of
https://gitlab.com/bztsrc/posix-uefi.git
synced 2025-01-01 03:25:52 +01:00
24 lines
613 B
C
24 lines
613 B
C
#include <uefi.h>
|
|
|
|
/**
|
|
* Use serial port
|
|
*/
|
|
int main(int argc, char **argv)
|
|
{
|
|
(void)argc;
|
|
(void)argv;
|
|
FILE *f;
|
|
char buff[2];
|
|
|
|
if((f = fopen("/dev/serial", "r"))) {
|
|
fwrite("sending bytes as-is with fwrite\r\n", 33, 1, f);
|
|
fprintf(f, "sending characters automatically wchar_t/char converted with fprintf\n");
|
|
printf("Press a key on the other side\n");
|
|
while(!fread(buff, 1, 1, f));
|
|
buff[1] = 0;
|
|
printf("Got key: %02x '%s'\n", buff[0], buff);
|
|
fclose(f);
|
|
} else
|
|
fprintf(stderr, "Unable to open serial port\n");
|
|
return 0;
|
|
}
|