Re: [PATCH 1/1, v2] usb-use-kfifo-to-buffer-usb-generic-serial-writes.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > You may be writing a command. If you clip out a sequence in the middle you
> > might be sending an altered command without telling user space.

Serial has no framing so you can't assume alignments

> Serial output does not provide a reliable delivery mechanism. If you flip a bit
> in the sending UART, you may also send an altered command without telling user
> space. Still, having had some time to think about it, I think discarding the
> rest of the data is at least as reasonable as anything else.

Agreed

> It seems propagating errors back to user space appears somewhat problematic,
> but this is true independent of whether a FIFO is used.

The best I can think of would be to implement socket like behaviour from
networking. That is

- at the start of a write check for an asynchronous error event
- if there is one, clear the event and report it
- if not do the normal write

and keep a single 's**t happened' variable to record such matters.

> > How can this duplicate data? If you know that you need to call
> > usb_serial_generic_write_start, you also know that no further
> > transfer will occur. If you don't test and restart on resume, you
> > get this scenario:
> > 
> > user space writes to device
> > user space waits for answer
> > 
> > kernel transfers 1. buffer
> > system suspension - 2. buffer cannot be transfered,
> > 	as usb_serial_generic_write_start gets -EPERM
> > system resumption - 2. buffer is never transmitted,
> > 	user space times out and reports an error

You would need to handle this in the shutdown - and beyond that you need
to wait for any FIFO in the device before you power it down.

Its not really fixable as it isn't transactional and you have no idea if
the state of the other device also changed. Consider 

ATD foo
oops flight time
suspend

Arrive in Australia
resume
ATD foo

Ouch that was an expensive data call...

So I am not sure that trying to be clever here is actually productive.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux