+static char packet[4096] = {0};
+
+typedef struct packet_t {
+ char from[6];
+ char to[6];
+ unsigned short ethertype;
+ unsigned short datalen;
+ unsigned char command;
+ char data[];
+} packet_t;
+
+static unsigned char vga_read(unsigned char idx)
+{
+ outb(CRTC_IDX_REG, idx);
+ return inb(CRTC_DATA_REG);
+}
+
+static unsigned int vga_base()
+{
+ return (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
+ + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1);
+}
+
+void handle_command(packet_t * p)
+{
+ uint16_t dl = htons(p->datalen);
+ int i;
+
+ outputf("NIC: Command: 0x%x, %d bytes", p->command, dl);
+
+ if (p->command == 0x42)
+ {
+ for (i = 0; i < dl; i++)
+ kbd_inject_key(p->data[i]);
+ }
+}
+