aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/class
AgeCommit message (Collapse)AuthorFilesLines
2014-05-27USB: cdc-acm: do not update PM busy on read errorsJohan Hovold1-1/+3
There's no need to update the runtime PM last_busy field on read urb errors (e.g. when the urb is being killed on shutdown). Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: minimise no-suspend window during shutdownJohan Hovold1-6/+11
Now that acm_set_control() handles runtime PM properly, the only remaining reason for the PM operations in shutdown is to clear the needs_remote_wakeup flag before the final put. Note that this also means that we now need to grab the write_lock to prevent racing with resume. Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: remove redundant disconnected test from shutdownJohan Hovold1-22/+19
Remove redundant disconnect test from shutdown(), which is never called post disconnect() where we do synchronous hangup. Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: simplify runtime PM lockingJohan Hovold1-11/+6
We can simply the runtime PM locking as there's no need to check the susp_count in the read path (at least not since killing the rx tasklet). Specifically, the read urbs will never be resubmitted by the completion handler when killed during suspend. Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix runtime PM imbalance at shutdownJohan Hovold1-2/+4
Make sure only to decrement the PM counters if they were actually incremented. Note that the USB PM counter, but not necessarily the driver core PM counter, is reset when the interface is unbound. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix I/O after failed openJohan Hovold1-0/+3
Make sure to kill any already submitted read urbs on read-urb submission failures in open in order to prevent doing I/O for a closed port. Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix failed open not being detectedJohan Hovold1-6/+8
Fix errors during open not being returned to userspace. Specifically, failed control-line manipulations or control or read urb submissions would not be detected. Fixes: 7fb57a019f94 ("USB: cdc-acm: Fix potential deadlock (lockdep warning)") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix open and suspend raceJohan Hovold1-4/+3
We must not do the usb_autopm_put_interface() before submitting the read urbs or we might end up doing I/O to a suspended device. Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix potential urb leak and PM imbalance in writeJohan Hovold1-1/+7
Make sure to check return value of autopm get in write() in order to avoid urb leak and PM counter imbalance on errors. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix shutdown and suspend raceJohan Hovold1-2/+1
We should stop I/O unconditionally at suspend rather than rely on the tty-port initialised flag (which is set prior to stopping I/O during shutdown) in order to prevent suspend returning with URBs still active. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix runtime PM for control messagesJohan Hovold1-1/+11
Fix runtime PM handling of control messages by adding the required PM counter operations. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix broken runtime suspendJohan Hovold2-11/+23
The current ACM runtime-suspend implementation is broken in several ways: Firstly, it buffers only the first write request being made while suspended -- any further writes are silently dropped. Secondly, writes being dropped also leak write urbs, which are never reclaimed (until the device is unbound). Thirdly, even the single buffered write is not cleared at shutdown (which may happen before the device is resumed), something which can lead to another urb leak as well as a PM usage-counter leak. Fix this by implementing a delayed-write queue using urb anchors and making sure to discard the queue properly at shutdown. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Reported-by: Xiao Jin <[email protected]> Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix write and resume raceJohan Hovold1-14/+9
Fix race between write() and resume() due to improper locking that could lead to writes being reordered. Resume must be done atomically and susp_count be protected by the write_lock in order to prevent racing with write(). This could otherwise lead to writes being reordered if write() grabs the write_lock after susp_count is decremented, but before the delayed urb is submitted. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27USB: cdc-acm: fix write and suspend raceJohan Hovold1-9/+6
Fix race between write() and suspend() which could lead to writes being dropped (or I/O while suspended) if the device is runtime suspended while a write request is being processed. Specifically, suspend() releases the write_lock after determining the device is idle but before incrementing the susp_count, thus leaving a window where a concurrent write() can submit an urb. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: <[email protected]> # v2.6.27 Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-16USB: cdc-acm: Remove Motorola/Telit H24 serial interfaces from ACM driverMichael Ulbricht1-7/+21
By specifying NO_UNION_NORMAL the ACM driver does only use the first two USB interfaces (modem data & control). The AT Port, Diagnostic and NMEA interfaces are left to the USB serial driver. Signed-off-by: Michael Ulbricht <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Oliver Neukum <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-16USB: cdc-acm: fix double usb_autopm_put_interface() in acm_port_activate()Alexey Khoroshilov1-2/+4
If acm_submit_read_urbs() fails in acm_port_activate(), error handling code calls usb_autopm_put_interface() while it is already called before acm_submit_read_urbs(). The patch reorganizes error handling code to avoid double decrement of USB interface's PM-usage counter. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <[email protected]> Acked-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-12usb: cdc-wdm: resp_count can be 0 even if WDM_READ is setBjørn Mork1-1/+1
Do not decrement resp_count if it's already 0. We set resp_count to 0 when the device is closed. The next open and read will try to clear the WDM_READ flag if there was leftover data in the read buffer. This fix is necessary to prevent resubmitting the read URB in a tight loop because resp_count becomes negative. The bug can easily be triggered from userspace by not reading all data in the read buffer, and then closing and reopening the chardev. Fixes: 8dd5cd5395b9 ("usb: cdc-wdm: avoid hanging on zero length reads") Cc: <[email protected]> # 3.13 Signed-off-by: Bjørn Mork <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-08usb: delete non-required instances of include <linux/init.h>Paul Gortmaker2-2/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-24Merge 3.13-rc5 into usb-nextGreg Kroah-Hartman1-5/+3
This resolves the merge issue with drivers/usb/host/ohci-at91.c Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-20usb: cdc-wdm: avoid hanging on zero length readsBjørn Mork1-32/+38
commit 73e06865ead1 ("USB: cdc-wdm: support back-to-back USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications") implemented queued response handling. This added a new requirement: The read urb must be resubmitted every time we clear the WDM_READ flag if the response counter indicates that the device is waiting for a read. Fix by factoring out the code handling the WMD_READ clearing and possible urb submission, calling it everywhere we clear the flag. Without this fix, the driver ends up in a state where the read urb is inactive, but the response counter is positive after a zero length read. This prevents the read urb from ever being submitted again and the driver appears to be hanging. Fixes: 73e06865ead1 ("USB: cdc-wdm: support back-to-back USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications") Cc: Greg Suarez <[email protected]> Signed-off-by: Bjørn Mork <[email protected]> Cc: stable <[email protected]> # 3.13 Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-16Merge branch 3.13-rc4 into usb-nextGreg Kroah-Hartman2-12/+107
2013-12-09usb: cdc-wdm: manage_power should always set needs_remote_wakeupBjørn Mork1-5/+3
Cc: stable <[email protected]> Reported-by: Oliver Neukum <[email protected]> Signed-off-by: Bjørn Mork <[email protected]> Acked-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-04USB: cdc-acm: Added support for the Lenovo RD02-D400 USB ModemDavid Cluytens1-0/+2
Signed-off-by: David Cluytens <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-03cdc-acm: fix power management in ioctlOliver Neukum1-0/+6
An ioctl that does depends on communication with a device should prevent suspension of teh device. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-03cdc-acm: add TIOCGICOUNTOliver Neukum1-0/+24
Simple straightforward implementation. Just returning the statistics gathered for TIOCMIWAIT Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-03cdc-acm: add TIOCMIWAITOliver Neukum2-12/+77
This implements TIOCMIWAIT for TIOCM_DSR, TIOCM_RI and TIOCM_CD Disconnect is handled as TIOCM_CD or an error. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-10-29usb: cdc-wdm: ignore speed change notificationsBjørn Mork1-0/+4
The only notification supported by the Device Management class is Response Available. But this driver is also used as a subdriver of other CDC classes, allowing notifications like Speed Change and Network Connection. This results in log messages which are only confusing to an end user: [66255.801874] cdc_mbim 1-3:1.5: unknown notification 42 received: index 5 len 8 These drivers use cdc-wdm as a subdriver to allow access to an embedded management protocol, and all management is expected to use this protocol. There is therefore no need to handle any of these optional CDC notifications. Instead we can let the cdc-wdm driver recognize them and log a debug level message instead of an error. Reported-by: Rob Gardner <[email protected]> Signed-off-by: Bjørn Mork <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-10-29USB: cdc-wdm: support back-to-back USB_CDC_NOTIFY_RESPONSE_AVAILABLE ↵Greg Suarez1-4/+34
notifications Some MBIM devices send back-to-back USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications when sending a message over multiple fragments or when there are unsolicited messages available. Count up the number of USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications received and decrement the count and submit the urb for the next response each time userspace completes a read the response. Signed-off-by: Greg Suarez <[email protected]> Acked-by: Bjørn Mork <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-25USB: usbtmc: fix up attribute permissionsGreg Kroah-Hartman1-8/+8
In auditing the usbtmc sysfs files, a bunch of them were being created as "read only", yet they have logic to handle writing to. So fix them up by setting the permissions properly. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-18Merge 3.11-rc6 into usb-nextGreg Kroah-Hartman1-4/+4
We want these USB fixes in this branch as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-12USB: cdc-wdm: fix race between interrupt handler and taskletOliver Neukum1-4/+9
Both could want to submit the same URB. Some checks of the flag intended to prevent that were missing. Signed-off-by: Oliver Neukum <[email protected]> CC: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-12USB: usbtmc: fix big-endian probe of Rigol devicesJohan Hovold1-4/+4
Fix probe of Rigol devices on big-endian machines. A quirk for these devices was introduced by commit c2e314835 ("USB: usbtmc: Set rigol_quirk if device is listed") but was only enabled on little-endian machines. Cc: [email protected] Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-25usbtmc: convert to devm_kzallocAndy Shevchenko1-2/+1
kfree(data) will be called implicitly. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-25usbtmc: remove redundant bracesAndy Shevchenko1-14/+14
There is a few cases where braces are not needed. This patch removes unnecessary '& 255' pieces as well when lvalue type is u8. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-25usbtmc: call pr_err instead of plain printkAndy Shevchenko1-5/+4
Additionally remove useless label. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-25usbtmc: remove trailing spacesAndy Shevchenko1-3/+3
Recent patch series introduces few trailing spaces. This patch removes them. No functional change. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-25usb: class: cdc-acm: be careful with bIntervalFelipe Balbi1-1/+1
bInterval must be on the range 1 - 16, if we want to pass the maximum allowed, we should be passing 16 Signed-off-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-06-17USB: cdc-acm: remove unneeded spin_lock_irqsave/restore on write pathGreg Kroah-Hartman1-33/+19
When writing data we were: lock do some work unlock call function lock do some work unlock return return It turns out, that "function" was only ever called in the one place, so instead of locking/unlocking for no good reason, just inline the function and only grab the lock once. This has sped up the pathological case of sending 1 byte packets to a loop-back cdc-acm device from 49600 bytes per second to 50100 bytes a second on my workstation. A tiny increase yes, but noticable, and now the spinlock isn't the hottest thing on the perf graph anymore. Yes, we are still waiting for the hardware for the most part, but getting rid of a spinlock_irq_save() call for every packet is still a good thing. And we end up deleting lines of code, always a win overall. This was found by using a Teensy 3.0 device and the test program and firmware located at: http://www.pjrc.com/teensy/benchmark_usb_serial_receive.html Reported-by: Paul Stoffregen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-16USB: usbtmc: Change magic number to constantAlexandre Peixoto Ferreira1-5/+5
These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment. Cosmetic change to show that 12 is the USBTMC header size. Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-16USB: usbtmc: usbtmc_read sends multiple TMC header based on rigol_quirkAlexandre Peixoto Ferreira1-38/+114
These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment. The usbtmc_read function is modified so if the quirk is active, the TMC header is sent with the size of the data as the whole size of the request. If the quirk is inactive, the TMC request is sent once per bulk transfer and with size limited to the bulk transfer size. In the case of the quirk, only the first response contains the TMC header and the others are just data. Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-16USB: usbtmc: Set rigol_quirk if device is listedAlexandre Peixoto Ferreira1-0/+14
These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment. It an idVendor and idProduct is found on the usbtmc_id_quirk array, the rigol_quirk is set for this device. Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-16USB: usbtmc: TMC request code segregated from usbtmc_readAlexandre Peixoto Ferreira1-31/+54
These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment. The TMC request portion of the code in function usbtmc_read is segregated to a function send_request_dev_dep_msg_in as implemented by tommie in https://github.com/tommie/linux/blob/usbtmc-rigol/drivers/usb/class/usbtmc.c allowing the reuse later. Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-16USB: usbtmc: Add flag rigol_quirk to usbtmc_device_dataAlexandre Peixoto Ferreira1-0/+14
These patches implement a modification of the USBTMC protocol to allow operation with Rigol equipment. Rigol requires that a single TMC request to receive any buffer size and bulk requests to get the data. The original algorithm sends a TMC request for each subset of the data (a single USB transaction). The modification is only active for Rigol equipment, vendor and product set is contained in the array usbtmc_id_quirk. This patch creates the rigol_quirk variable and the arrays for the idvendor and idproduct. Signed-off-by: Alexandre Peixoto Ferreira <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-01Merge branch 'for-linus' of ↵Linus Torvalds2-0/+14
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input Pull input updates from Dmitry Torokhov: "Assorted fixes and cleanups to the existing drivers plus a new driver for IMS Passenger Control Unit device they use for ther in-flight entertainment system." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (44 commits) Input: trackpoint - Optimize trackpoint init to use power-on reset Input: apbps2 - convert to devm_ioremap_resource() Input: ALPS - use %ph to print buffers ARM - shmobile: Armadillo800EVA: Move st1232 reset pin handling Input: st1232 - add reset pin handling Input: st1232 - convert to devm_* infrastructure Input: MT - handle semi-mt devices in core Input: adxl34x - use spi_get_drvdata() Input: ad7877 - use spi_get_drvdata() and spi_set_drvdata() Input: ads7846 - use spi_get_drvdata() and spi_set_drvdata() Input: ims-pcu - fix a memory leak on error Input: sysrq - supplement reset sequence with timeout functionality Input: tegra-kbc - support for defining row/columns based on SoC Input: imx_keypad - switch to using managed resources Input: arc_ps2 - add support for device tree Input: mma8450 - fix signed 12bits to 32bits conversion Input: eeti_ts - remove redundant null check Input: edt-ft5x06 - remove redundant null check before kfree Input: ad714x - add CONFIG_PM_SLEEP to suspend/resume functions Input: adxl34x - add CONFIG_PM_SLEEP to suspend/resume functions ...
2013-04-29Merge tag 'usb-3.10-rc1' of ↵Linus Torvalds4-35/+24
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB patches from Greg Kroah-Hartman: "Here's the big USB pull request for 3.10-rc1. Lots of USB patches here, the majority being USB gadget changes and USB-serial driver cleanups, the rest being ARM build fixes / cleanups, and individual driver updates. We also finally got some chipidea fixes, which have been delayed for a number of kernel releases, as the maintainer has now reappeared. All of these have been in linux-next for a while" * tag 'usb-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (568 commits) USB: ehci-msm: USB_MSM_OTG needs USB_PHY USB: OHCI: avoid conflicting platform drivers USB: OMAP: ISP1301 needs USB_PHY USB: lpc32xx: ISP1301 needs USB_PHY USB: ftdi_sio: enable two UART ports on ST Microconnect Lite usb: phy: tegra: don't call into tegra-ehci directly usb: phy: phy core cannot yet be a module USB: Fix initconst in ehci driver usb-storage: CY7C68300A chips do not support Cypress ATACB USB: serial: option: Added support Olivetti Olicard 145 USB: ftdi_sio: correct ST Micro Connect Lite PIDs ARM: mxs_defconfig: add CONFIG_USB_PHY ARM: imx_v6_v7_defconfig: add CONFIG_USB_PHY usb: phy: remove exported function from __init section usb: gadget: zero: put function instances on unbind usb: gadget: f_sourcesink.c: correct a copy-paste misnomer usb: gadget: cdc2: fix error return code in cdc_do_config() usb: gadget: multi: fix error return code in rndis_do_config() usb: gadget: f_obex: fix error return code in obex_bind() USB: storage: convert to use module_usb_driver() ...
2013-04-19USB: usbtmc: remove unnecessary memory allocationMing Lei1-22/+4
Inside usbtmc_ioctl_clear_out_halt()/usbtmc_ioctl_clear_in_halt(), usb_clear_halt() needn't any buffer to pass in, so remove the unnecessary memory allocation. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-04-09USB: regroup all depends on USB within an if USB blockFlorian Fainelli1-5/+1
This patch removes the depends on USB from all config symbols in drivers/usb/host/Kconfig and replace that with an if USB / endif block as suggested by Alan Stern. Some source ... Kconfig lines have been shuffled around to permit a better regroupment of the Kconfig files depending on "config USB" item. No functionnal change is introduced. Acked-by: Alan Stern <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-04-01Merge 3.9-rc5 into tty-nextGreg Kroah-Hartman1-3/+19
We need the fixes here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-03-25USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMANDBjørn Mork1-0/+19
Userspace applications need to know the maximum supported message size. The cdc-wdm driver translates between a character device stream and a message based protocol. Each message is transported as a usb control message with no further encapsulation or syncronization. Each read or write on the character device should translate to exactly one usb control message to ensure that message boundaries are kept intact. That means that the userspace application must know the maximum message size supported by the device and driver, making this size a vital part of the cdc-wdm character device API. CDC WDM and CDC MBIM functions export the maximum supported message size through CDC functional descriptors. The cdc-wdm and cdc_mbim drivers will parse these descriptors and use the value chosen by the device. The only current way for a userspace application to retrive the value is by duplicating the descriptor parsing. This is an unnecessary complex task, and application writers are likely to postpone it, using a fixed value and adding a "todo" item. QMI functions have no way to tell the host what message size they support. The qmi_wwan driver use a fixed value based on protocol recommendations and observed device behaviour. Userspace applications must know and hard code the same value. This scheme will break if we ever encounter a QMI device needing a device specific message size quirk. We are currently unable to support such a device because using a non default size would break the implicit userspace API. The message size is currently a hidden attribute of the cdc-wdm userspace API. Retrieving it is unnecessarily complex, increasing the possibility of drivers and applications using different limits. The resulting errors are hard to debug, and can only be replicated on identical hardware. Exporting the maximum message size from the driver simplifies the task for the userspace application, and creates a unified information source independent of device and function class. It also serves to document that the message size is part of the cdc-wdm userspace API. This proposed API extension has been presented for the authors of userspace applications and libraries using the current API: libmbim, libqmi, uqmi, oFono and ModemManager. The replies were: Aleksander Morgado: "We do really need max message size for MBIM; and as you say, it may be good to have the max message size info also for QMI, so the new ioctl seems a good addition. So +1 from my side, for what it's worth." Dan Williams: "Yeah, +1 here. I'd prefer the sysfs file, but the fact that that doesn't work for fd passing pretty much kills it." No negative replies are so far received. Cc: Aleksander Morgado <[email protected]> Cc: Dan Williams <[email protected]> Signed-off-by: Bjørn Mork <[email protected]> Acked-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-03-25Merge 3.9-rc4 into usb-nextGreg Kroah-Hartman1-3/+19
This picks up the fixes we had for USB in 3.9-rc4 Signed-off-by: Greg Kroah-Hartman <[email protected]>