History log of /haiku/src/add-ons/kernel/drivers/ports/usb_serial/ACM.cpp
Revision Date Author Comments
# 243ac0b9 03-Jul-2023 Stian Skjelstad <stian.skjelstad@gmail.com>

USB ACM serial driver did not take maxPacketSize provided by the device into account

Change-Id: Ic93d420012d757088b20936e6c8d942ccbc0e5bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6668
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 8d1a3621 28-Aug-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

usb_serial: fix possible NULL pointer dereference

There can apparently be interfaces without descriptors.

Should fix #17892

Change-Id: Ibcbab0f60ecbd2005640c647bf7540d17d0f5375
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5598
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# df2961ae 25-Apr-2017 Augustin Cavalier <waddlesplash@gmail.com>

usb_serial: Fix typo Alex made.


# 61c3b8c1 24-Apr-2017 Alexander von Gluck IV <kallisti5@unixzen.com>

usb_serial: Fix quirky usb unions on ACM generic


# eb5f3639 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Fixes some occurrences of 'variable set but not used', disables Werror for problematic items.


# 36986acb 10-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

* Finish the port to the new tty module. Back when I left off last time it was
only halfway finished. The way it is supposed to work is that there are two
tty cookies, representing the system and the device side. Reads and writes
coming from the system and going to the device are using the system cookie
while reads and writes coming from the device use the device cookie.
* Move writing to the device into an output thread, similar to how reading from
the device works. This isn't necessarily a good idea and might be moved back
into the write hook again to ensure that writes can be made blocking. Right
now if you just write and then close, the writes will most likely be canceled
before every going out to the device.
* Removed the read and write lock mutex. They aren't necessary as the tty layer
will serialize the reads and writes anyway.
* Made simply copying the data to the write buffer the default implementation of
the OnWrite callback and removed the OnWrite in ACMDevice. The ProlificDevice
didn't provide an OnWrite hook before, so it would've never written anything.
* Break out the baud index to speed mapping into an inline function. Since the
defines might change in termios.h just adding an array is a bit fragile (it
already missed one entry and would've been broken for certain speeds).

This should make usb_serial usable for some (most?) cases. I've tested this with
an Arduino board that uses an FTDI interface. As mentioned above, since writes
currently just write into the tty layer and don't wait for the data to be
flushed, and since close doesn't wait for the output buffers to be drained
either, a simple write and close (as in "echo a > /dev/ports/usb0") will in most
cases cancel the output before it is written to the device. I'm looking into
a few ways to fix that next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5f2df28 03-Jan-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Switched to use USB_cdc.h definitions.
Expanded search in every configuration, not only first. ELSA USB modem for instance
publish two configurations, the first one being a vendor-specific one for
Windows NT.
ACMDevice now don't assume anymore union functional descriptor is always there.
The data interface index can be found also in Call Management (CM) functional
descriptor.

(Style cleanup pending...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40092 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12f32926 12-Jun-2008 François Revol <revol@free.fr>

- change KLSI init the way it's done by the linux driver
- do not count usb headers as part of count returned by write(), else we might end up writing more than the passed amount :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aa661d4 19-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Rework of the usb_serial driver:
* Refactored everything to C++ with the different devices as subclasses
* Added proper ACM detection with parsing of the ACM descriptors
* Added device transfer error handling and fixed some concurency issues
* Big cleanup to conform to our style guide

This should make at least ACM stable to use. Commiting this over my K850i with
ACM compliant USB modem and UMTS data connection. Note that support for all
other device classes (Prolific, FTDI and KLSI) is untested but should work the
same as before. Note also that since we currently lack a TTY module this will
only build/work for R5 or Dano with the proper TTY headers.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23634 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb5f36397841abfc740031fde56ca5e4dee9fdd3 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Fixes some occurrences of 'variable set but not used', disables Werror for problematic items.


# 36986acbbd67c4866976aeb4a6a3e98d953b69c3 10-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

* Finish the port to the new tty module. Back when I left off last time it was
only halfway finished. The way it is supposed to work is that there are two
tty cookies, representing the system and the device side. Reads and writes
coming from the system and going to the device are using the system cookie
while reads and writes coming from the device use the device cookie.
* Move writing to the device into an output thread, similar to how reading from
the device works. This isn't necessarily a good idea and might be moved back
into the write hook again to ensure that writes can be made blocking. Right
now if you just write and then close, the writes will most likely be canceled
before every going out to the device.
* Removed the read and write lock mutex. They aren't necessary as the tty layer
will serialize the reads and writes anyway.
* Made simply copying the data to the write buffer the default implementation of
the OnWrite callback and removed the OnWrite in ACMDevice. The ProlificDevice
didn't provide an OnWrite hook before, so it would've never written anything.
* Break out the baud index to speed mapping into an inline function. Since the
defines might change in termios.h just adding an array is a bit fragile (it
already missed one entry and would've been broken for certain speeds).

This should make usb_serial usable for some (most?) cases. I've tested this with
an Arduino board that uses an FTDI interface. As mentioned above, since writes
currently just write into the tty layer and don't wait for the data to be
flushed, and since close doesn't wait for the output buffers to be drained
either, a simple write and close (as in "echo a > /dev/ports/usb0") will in most
cases cancel the output before it is written to the device. I'm looking into
a few ways to fix that next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5f2df286e21f263432f1deb39b6ccf6a6ff32c0 03-Jan-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Switched to use USB_cdc.h definitions.
Expanded search in every configuration, not only first. ELSA USB modem for instance
publish two configurations, the first one being a vendor-specific one for
Windows NT.
ACMDevice now don't assume anymore union functional descriptor is always there.
The data interface index can be found also in Call Management (CM) functional
descriptor.

(Style cleanup pending...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40092 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12f329261557cff6c769a4cb0c23fe8a55bb2622 12-Jun-2008 François Revol <revol@free.fr>

- change KLSI init the way it's done by the linux driver
- do not count usb headers as part of count returned by write(), else we might end up writing more than the passed amount :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aa661d403eac10eab21bcd0facf01c2bcc03c24 19-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Rework of the usb_serial driver:
* Refactored everything to C++ with the different devices as subclasses
* Added proper ACM detection with parsing of the ACM descriptors
* Added device transfer error handling and fixed some concurency issues
* Big cleanup to conform to our style guide

This should make at least ACM stable to use. Commiting this over my K850i with
ACM compliant USB modem and UMTS data connection. Note that support for all
other device classes (Prolific, FTDI and KLSI) is untested but should work the
same as before. Note also that since we currently lack a TTY module this will
only build/work for R5 or Dano with the proper TTY headers.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23634 a95241bf-73f2-0310-859d-f6bbb57e9c96