mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-23 01:29:34 +00:00
Manage stopbits for serial, put parameters on a line alone, not inside kernel property
This commit is contained in:
parent
2fa2fff513
commit
c0a9e8b158
@ -43,7 +43,7 @@ static char *read_word(char *line, char **next)
|
||||
return word;
|
||||
}
|
||||
|
||||
static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize)
|
||||
static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize, int *stopbits)
|
||||
{
|
||||
*baudrate = strtol(s, &s, 0);
|
||||
switch(*s)
|
||||
@ -66,11 +66,38 @@ static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize)
|
||||
}
|
||||
s++;
|
||||
*datasize = strtol(s, &s, 0);
|
||||
if (*s != '+')
|
||||
return s;
|
||||
s++;
|
||||
*stopbits = strtol(s, &s, 0);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize)
|
||||
int read_config_vga(char *conf)
|
||||
{
|
||||
char *next_word, *next_line, *name, *property;
|
||||
int name_len;
|
||||
|
||||
next_line = conf;
|
||||
|
||||
while (*next_line)
|
||||
{
|
||||
next_word = next_line;
|
||||
next_line = read_line(next_line);
|
||||
name = read_word(next_word, &next_word);
|
||||
name_len = next_word - name;
|
||||
property = read_word(next_word, &next_word);
|
||||
|
||||
if (strncmp(name, "vga", name_len) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
|
||||
{
|
||||
char *next_word, *next_line, *name, *property;
|
||||
int name_len;
|
||||
@ -87,14 +114,14 @@ int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize)
|
||||
|
||||
if (strncmp(name, "modem", name_len) == 0)
|
||||
{
|
||||
decode_serial(property, bitrate, parity, datasize);
|
||||
decode_serial(property, bitrate, parity, datasize, stopbits);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize)
|
||||
int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
|
||||
{
|
||||
char *next_word, *next_line, *name, *property;
|
||||
int name_len;
|
||||
@ -110,7 +137,7 @@ int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize)
|
||||
|
||||
if (strncmp(name, "printer", name_len) == 0)
|
||||
{
|
||||
decode_serial(property, bitrate, parity, datasize);
|
||||
decode_serial(property, bitrate, parity, datasize, stopbits);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -143,20 +170,17 @@ int read_config(emile_l2_header_t* info,
|
||||
*next_word++ = 0;
|
||||
|
||||
property = read_word(next_word, &next_word);
|
||||
*next_word++ = 0;
|
||||
|
||||
if (strcmp(name, "kernel") == 0)
|
||||
{
|
||||
*kernel_path = property;
|
||||
} else if (strcmp(name, "parameters") == 0) {
|
||||
#if defined(USE_CLI) && defined(__LINUX__)
|
||||
*command_line = parameters;
|
||||
if (next_word != next_line)
|
||||
strncpy(parameters, next_word, COMMAND_LINE_LENGTH);
|
||||
else
|
||||
parameters[0] = 0;
|
||||
strncpy(parameters, property, COMMAND_LINE_LENGTH);
|
||||
#else
|
||||
if (next_word != next_line)
|
||||
*command_line = next_word;
|
||||
*command_line = property;
|
||||
#endif
|
||||
}
|
||||
else if (strcmp(name, "initrd") == 0)
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "head.h"
|
||||
|
||||
extern int read_config(emile_l2_header_t* info, char **kernel_path, char **command_line, char **ramdisk_path);
|
||||
extern int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize);
|
||||
extern int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize);
|
||||
extern int read_config_vga(char *conf);
|
||||
extern int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);
|
||||
extern int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);
|
||||
|
@ -36,10 +36,12 @@ struct emile_l2_header {
|
||||
* gestaltID <digit>
|
||||
* modem <bitrate><parity><bits> parity is n/o/e
|
||||
* printer <bitrate><parity><bits>
|
||||
* kernel <protocol>:<unit>/<path> <parameters>
|
||||
* kernel <protocol>:<unit>/<path>
|
||||
* <protocol> is "iso9660", "container", "block" ...
|
||||
* <unit> is "(fd0)", "(sd3)", "(sd0,4)",...
|
||||
* <path> is "boot/vmlinuz-2.2.25", "install/mac/vmlinuz-2.2.25", "59904", "673280,654848",...
|
||||
* <path> is "boot/vmlinuz-2.2.25", "/install/mac/vmlinuz-2.2.25",
|
||||
* "59904", "673280,654848",...
|
||||
* parameters <kernel parameters>
|
||||
* initrd <protocol>:<unit>/<path>
|
||||
* configuration <protocol>:<unit>/<path>
|
||||
*/
|
||||
|
@ -237,10 +237,8 @@ void serial_init(emile_l2_header_t* info)
|
||||
int res;
|
||||
int bitrate, parity, datasize, stopbits;
|
||||
|
||||
stopbits = 1;
|
||||
|
||||
res = read_config_modem(info->configuration,
|
||||
&bitrate, &parity, &datasize);
|
||||
&bitrate, &parity, &datasize, &stopbits);
|
||||
if (res != -1)
|
||||
{
|
||||
res = OpenDriver(c2pstring(".AOut"), &out_refnum0);
|
||||
@ -278,7 +276,7 @@ void serial_init(emile_l2_header_t* info)
|
||||
}
|
||||
|
||||
res = read_config_printer(info->configuration,
|
||||
&bitrate, &parity, &datasize);
|
||||
&bitrate, &parity, &datasize, &stopbits);
|
||||
if (res != -1) {
|
||||
res = OpenDriver(c2pstring(".BOut"), &out_refnum1);
|
||||
if (res != noErr) {
|
||||
|
Loading…
Reference in New Issue
Block a user