Commit 7e57f0493a661e57c5a2572a8818d35267482922
Committed by
Anthony Liguori
1 parent
0928a95f
usb-serial: implement break event.
Implement the serial break via usb serial. The second data byte in ftdi status packet contains the break status. The values were already defined in usb-serial.c so it was a matter of making use of the event_trigger to form a urb to send over to the host controller with the serial break status set. This was tested against a linux development image which enables sysrq via a serial break on the ftdi usb console. Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Showing
1 changed file
with
10 additions
and
2 deletions
hw/usb-serial.c
... | ... | @@ -445,7 +445,15 @@ static int usb_serial_handle_data(USBDevice *dev, USBPacket *p) |
445 | 445 | } |
446 | 446 | *data++ = usb_get_modem_lines(s) | 1; |
447 | 447 | /* We do not have the uart details */ |
448 | - *data++ = 0; | |
448 | + /* handle serial break */ | |
449 | + if (s->event_trigger && s->event_trigger & FTDI_BI) { | |
450 | + s->event_trigger &= ~FTDI_BI; | |
451 | + *data++ = FTDI_BI; | |
452 | + ret = 2; | |
453 | + break; | |
454 | + } else { | |
455 | + *data++ = 0; | |
456 | + } | |
449 | 457 | len -= 2; |
450 | 458 | if (len > s->recv_used) |
451 | 459 | len = s->recv_used; |
... | ... | @@ -505,7 +513,7 @@ static void usb_serial_event(void *opaque, int event) |
505 | 513 | |
506 | 514 | switch (event) { |
507 | 515 | case CHR_EVENT_BREAK: |
508 | - /* TODO: Send Break to USB */ | |
516 | + s->event_trigger |= FTDI_BI; | |
509 | 517 | break; |
510 | 518 | case CHR_EVENT_FOCUS: |
511 | 519 | break; | ... | ... |