+2012-06-08 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/term/ieee1275/serial.c (do_real_config): Set handle to
+ invalid on error.
+ (serial_hw_fetch): Don't read invalid handle.
+ (serial_hw_put): Don't write into invalid handle.
+
2012-06-08 Vladimir Serbinenko <phcoder@gmail.com>
Add a 1.5 stop bits value.
#include <grub/time.h>
#include <grub/i18n.h>
+#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0)
+
struct ofserial_hash_ent
{
char *devpath;
if (port->configured)
return;
- grub_ieee1275_open (port->elem->devpath, &port->handle);
+ if (grub_ieee1275_open (port->elem->devpath, &port->handle)
+ || port->handle == (grub_ieee1275_cell_t) -1)
+ port->handle = IEEE1275_IHANDLE_INVALID;
port->configured = 1;
}
do_real_config (port);
+ if (port->handle == IEEE1275_IHANDLE_INVALID)
+ return -1;
grub_ieee1275_read (port->handle, &c, 1, &actual);
if (actual <= 0)
do_real_config (port);
+ if (port->handle == IEEE1275_IHANDLE_INVALID)
+ return;
+
grub_ieee1275_write (port->handle, &c0, 1, &actual);
}