/* Accepts multiple requests - one per line in hex format  */
void hex(ModbusSlave *s)
/* Accepts multiple requests - one per line in hex format  */
void hex(ModbusSlave *s)
{
	char *line = NULL;
	size_t linesize = 0;
	while (getline(&line, &linesize, stdin) > 0)
	{
		uint8_t data[1024];
		int offset = 0;
		unsigned int len = 1;
		while (len < sizeof(data) - 2)
		{
			int c = 0, n = 0;
			if (sscanf(&line[offset], "%02x%n", &c, &n) != 1)
				break;
			offset += n;
			data[len++] = c;
		}
		data[0] = 1;
		modbusWLE(&data[len], modbusCRC(data, len));
		len += 2;
		parse(s, data, len);
	}
	free(line);
}