19 Jan, 2021

1 commit

  • This patch allows the administrator to configure the interface
    name of a function using u_ether (e.g., eem, ncm, rndis).

    Currently, all such interfaces, regardless of function type, are
    always called usb0, usb1, etc. This makes it very cumbersome to
    use more than one such type at a time, because userspace cannnot
    easily tell the interfaces apart and apply the right
    configuration to each one. Interface renaming in userspace based
    on driver doesn't help, because the interfaces all have the same
    driver. Without this patch, doing this require hacks/workarounds
    such as setting fixed MAC addresses on the functions, and then
    renaming by MAC address, or scraping configfs after each
    interface is created to find out what it is.

    Setting the interface name is done by writing to the same
    "ifname" configfs attribute that reports the interface name after
    the function is bound. The write must contain an interface
    pattern such as "usb%d" (which will cause the net core to pick
    the next available interface name starting with "usb").
    This patch does not allow writing an exact interface name (as
    opposed to a pattern) because if the interface already exists at
    bind time, the bind will fail and the whole gadget will fail to
    activate. This could be allowed in a future patch.

    For compatibility with current userspace, when reading an ifname
    that has not currently been set, the result is still "(unnamed
    net_device)". Once a write to ifname happens, then reading ifname
    will return whatever was last written.

    Tested by configuring an rndis function and an ncm function on
    the same gadget, and writing "rndis%d" to ifname on the rndis
    function and "ncm%d" to ifname on the ncm function. When the
    gadget was bound, the rndis interface was rndis0 and the ncm
    interface was ncm0.

    Signed-off-by: Lorenzo Colitti
    (cherry picked from commit 63d152149b2d0860ccf8c4e6596b6175b2b7ace6
    https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
    Link: https://lore.kernel.org/r/20210113234222.3272933-1-lorenzo@google.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Lorenzo Colitti
    Change-Id: I04deb6cc1d8a5b8ee82404940de2a79c06fbafe7
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Colitti
     

21 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Link: https://lore.kernel.org/r/20200719160910.60018-1-grandmaster@al2klimov.de
    Signed-off-by: Greg Kroah-Hartman

    Alexander A. Klimov
     

02 Jun, 2020

1 commit

  • Pull documentation updates from Jonathan Corbet:
    "A fair amount of stuff this time around, dominated by yet another
    massive set from Mauro toward the completion of the RST conversion. I
    *really* hope we are getting close to the end of this. Meanwhile,
    those patches reach pretty far afield to update document references
    around the tree; there should be no actual code changes there. There
    will be, alas, more of the usual trivial merge conflicts.

    Beyond that we have more translations, improvements to the sphinx
    scripting, a number of additions to the sysctl documentation, and lots
    of fixes"

    * tag 'docs-5.8' of git://git.lwn.net/linux: (130 commits)
    Documentation: fixes to the maintainer-entry-profile template
    zswap: docs/vm: Fix typo accept_threshold_percent in zswap.rst
    tracing: Fix events.rst section numbering
    docs: acpi: fix old http link and improve document format
    docs: filesystems: add info about efivars content
    Documentation: LSM: Correct the basic LSM description
    mailmap: change email for Ricardo Ribalda
    docs: sysctl/kernel: document unaligned controls
    Documentation: admin-guide: update bug-hunting.rst
    docs: sysctl/kernel: document ngroups_max
    nvdimm: fixes to maintainter-entry-profile
    Documentation/features: Correct RISC-V kprobes support entry
    Documentation/features: Refresh the arch support status files
    Revert "docs: sysctl/kernel: document ngroups_max"
    docs: move locking-specific documents to locking/
    docs: move digsig docs to the security book
    docs: move the kref doc into the core-api book
    docs: add IRQ documentation at the core-api book
    docs: debugging-via-ohci1394.txt: add it to the core-api book
    docs: fix references for ipmi.rst file
    ...

    Linus Torvalds
     

14 May, 2020

3 commits

  • Mention the issue with fixed UDC addresses.

    Links external examples and test suite.

    Add more implmenetation details and potential improvements.

    Signed-off-by: Andrey Konovalov
    Signed-off-by: Felipe Balbi

    Andrey Konovalov
     
  • Raw Gadget is currently unable to stall/halt/wedge gadget endpoints,
    which is required for proper emulation of certain USB classes.

    This patch adds a few more ioctls:

    - USB_RAW_IOCTL_EP0_STALL allows to stall control endpoint #0 when
    there's a pending setup request for it.
    - USB_RAW_IOCTL_SET/CLEAR_HALT/WEDGE allow to set/clear halt/wedge status
    on non-control non-isochronous endpoints.

    Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface")
    Signed-off-by: Andrey Konovalov
    Signed-off-by: Felipe Balbi

    Andrey Konovalov
     
  • Currently automatic gadget endpoint selection based on required features
    doesn't work. Raw Gadget tries iterating over the list of available
    endpoints and finding one that has the right direction and transfer type.
    Unfortunately selecting arbitrary gadget endpoints (even if they satisfy
    feature requirements) doesn't work, as (depending on the UDC driver) they
    might have fixed addresses, and one also needs to provide matching
    endpoint addresses in the descriptors sent to the host.

    The composite framework deals with this by assigning endpoint addresses
    in usb_ep_autoconfig() before enumeration starts. This approach won't work
    with Raw Gadget as the endpoints are supposed to be enabled after a
    set_configuration/set_interface request from the host, so it's too late to
    patch the endpoint descriptors that had already been sent to the host.

    For Raw Gadget we take another approach. Similarly to GadgetFS, we allow
    the user to make the decision as to which gadget endpoints to use.

    This patch adds another Raw Gadget ioctl USB_RAW_IOCTL_EPS_INFO that
    exposes information about all non-control endpoints that a currently
    connected UDC has. This information includes endpoints addresses, as well
    as their capabilities and limits to allow the user to choose the most
    fitting gadget endpoint.

    The USB_RAW_IOCTL_EP_ENABLE ioctl is updated to use the proper endpoint
    validation routine usb_gadget_ep_match_desc().

    These changes affect the portability of the gadgets that use Raw Gadget
    when running on different UDCs. Nevertheless, as long as the user relies
    on the information provided by USB_RAW_IOCTL_EPS_INFO to dynamically
    choose endpoint addresses, UDC-agnostic gadgets can still be written with
    Raw Gadget.

    Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface")
    Signed-off-by: Andrey Konovalov
    Signed-off-by: Felipe Balbi

    Andrey Konovalov
     

05 May, 2020

1 commit

  • - Add a SPDX header;
    - Adjust document and section titles;
    - Use copyright symbol;
    - Some whitespace fixes and new line breaks;
    - Mark literal blocks as such;
    - Add it to filesystems/index.rst.

    Also, as this file is alone on its own dir, and it doesn't
    seem too likely that other documents will follow it, let's
    move it to the filesystems/ root documentation dir.

    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/c2424ec2ad4d735751434ff7f52144c44aa02d5a.1588021877.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

15 Mar, 2020

1 commit

  • USB Raw Gadget is a kernel module that provides a userspace interface for
    the USB Gadget subsystem. Essentially it allows to emulate USB devices
    from userspace. Enabled with CONFIG_USB_RAW_GADGET. Raw Gadget is
    currently a strictly debugging feature and shouldn't be used in
    production.

    Raw Gadget is similar to GadgetFS, but provides a more low-level and
    direct access to the USB Gadget layer for the userspace. The key
    differences are:

    1. Every USB request is passed to the userspace to get a response, while
    GadgetFS responds to some USB requests internally based on the provided
    descriptors. However note, that the UDC driver might respond to some
    requests on its own and never forward them to the Gadget layer.

    2. GadgetFS performs some sanity checks on the provided USB descriptors,
    while Raw Gadget allows you to provide arbitrary data as responses to
    USB requests.

    3. Raw Gadget provides a way to select a UDC device/driver to bind to,
    while GadgetFS currently binds to the first available UDC.

    4. Raw Gadget uses predictable endpoint names (handles) across different
    UDCs (as long as UDCs have enough endpoints of each required transfer
    type).

    5. Raw Gadget has ioctl-based interface instead of a filesystem-based one.

    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Andrey Konovalov
    Signed-off-by: Felipe Balbi

    Andrey Konovalov
     

29 Jan, 2020

1 commit


04 Oct, 2019

1 commit

  • The Rio500 kernel driver has not been used by Rio500 owners since 2001
    not long after the rio500 project added support for a user-space USB stack
    through the very first versions of usbdevfs and then libusb.

    Support for the kernel driver was removed from the upstream utilities
    in 2008:
    https://gitlab.freedesktop.org/hadess/rio500/commit/943f624ab721eb8281c287650fcc9e2026f6f5db

    Cc: Cesar Miquel
    Signed-off-by: Bastien Nocera
    Cc: stable
    Link: https://lore.kernel.org/r/6251c17584d220472ce882a3d9c199c401a51a71.camel@hadess.net
    Signed-off-by: Greg Kroah-Hartman

    Bastien Nocera
     

08 Aug, 2019

1 commit


20 Jun, 2019

1 commit

  • While there are a mix of things here, most of the stuff
    were written from Kernel developer's PoV. So, add them to
    the driver-api book.

    A follow up for this patch would be to move documents from
    there that are specific to sysadmins, adding them to the
    admin-guide.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Johan Hovold
    Acked-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Mauro Carvalho Chehab
     

21 May, 2019

1 commit


16 Apr, 2019

1 commit


22 Feb, 2019

1 commit

  • On Chrome OS we want to use USBguard to potentially limit access to USB
    devices based on policy. We however to do not want to wait for userspace to
    come up before initializing fixed USB devices to not regress our boot
    times.

    This patch adds option to instruct the kernel to only authorize devices
    connected to the internal ports. Previously we could either authorize
    all or none (or, by default, we'd only authorize wired devices).

    The behavior is controlled via usbcore.authorized_default command line
    option.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     

26 Nov, 2018

1 commit


21 Jul, 2018

1 commit

  • …it/johan/usb-serial into usb-next

    Johan writes:

    USB-serial updates for v4.19-rc1

    Here are the USB-serial updates for 4.19-rc1, including:

    - gpio support for CP2102N devices
    - improved line-speed handling for cp210x
    - conversion to spin_lock_irqsave() in completion handlers
    - dropped kl5kusb105 support from the kl5kusb105 driver (sic!)

    Included are also various lower-priority fixes and clean ups.

    All but the final commit have been in linux-next, and with no reported
    issues.

    Signed-off-by: Johan Hovold <johan@kernel.org>

    Greg Kroah-Hartman
     

11 Jul, 2018

1 commit


18 Jun, 2018

1 commit


15 Jan, 2018

1 commit


12 Jan, 2018

1 commit


12 Dec, 2017

1 commit

  • The URB_NO_FSBR flag has never really been used. It was introduced as
    a potential way for UHCI to minimize PCI bus usage (by not attempting
    full-speed bulk and control transfers more than once per frame), but
    the flag was not set by any drivers.

    There's no point in keeping it around. This patch simplifies the API
    by removing it. Unfortunately, it does have to be kept as part of the
    usbfs ABI, but at least we can document in
    include/uapi/linux/usbdevice_fs.h that it doesn't do anything.

    Signed-off-by: Alan Stern
    Acked-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

09 Dec, 2017

1 commit


13 Oct, 2017

1 commit


19 Jun, 2017

2 commits

  • This patch adds a new function 'f_uac1'
    (f_uac1 with virtual "ALSA card") that
    uses recently created u_audio API. Comparing
    to legacy f_uac1 function implementation it
    doesn't require any real Audio codec to be
    present on the device. In f_uac1 audio
    streams are simply sinked to and sourced
    from a virtual ALSA sound card created
    using u_audio API.

    Legacy f_uac1 approach is to write audio
    samples directly to existing ALSA sound
    card

    f_uac1 approach is more generic/flexible
    one - create an ALSA sound card that
    represents USB Audio function and allows to
    be used by userspace application that
    may choose to do whatever it wants with the
    data received from the USB Host and choose
    to provide whatever it wants as audio data
    to the USB Host.

    f_uac1 also has capture support (gadget->host)
    thanks to easy implementation via u_audio.
    By default, capture interface has 48000kHz/2ch
    configuration, same as playback channel has.

    f_uac1 descriptors naming convention
    uses f_uac2 driver naming convention that
    makes it more common and meaningful.

    Comparing to f_uac1_legacy, the f_uac1 doesn't
    have volume/mute functionality. This is because
    the f_uac1 volume/mute feature unit was dummy
    implementation since that driver creation (2009)
    and never had any real volume control or mute
    functionality, so there is no any difference
    here.

    Since f_uac1 functionality, exposed
    interface to userspace (virtual ALSA card),
    input parameters are so different comparing
    to f_uac1_legacy, that there is no any
    reason to keep them in the same file/module,
    and separate function was created.

    g_audio can be built using one of existing
    UAC functions (f_uac1, f_uac1_legacy or f_uac2)

    Signed-off-by: Ruslan Bilovol
    Signed-off-by: Felipe Balbi

    Ruslan Bilovol
     
  • Before introducing new f_uac1 function (with virtual
    ALSA card) make current implementation legacy.

    This includes renaming of existing files, some
    variables, config options and documentation

    Signed-off-by: Ruslan Bilovol
    Signed-off-by: Felipe Balbi

    Ruslan Bilovol
     

02 Jun, 2017

1 commit


05 May, 2017

1 commit

  • Pull USB updates from Greg KH:
    "Here is the big USB patchset for 4.12-rc1.

    Lots of good stuff here, after many many many attempts, the kernel
    finally has a working typeC interface, many thanks to Heikki and
    Guenter and others who have taken the time to get this merged. It
    wasn't an easy path for them at all.

    There's also a staging driver that uses this new api, which is why
    it's coming in through this tree.

    Along with that, there's the usual huge number of changes for gadget
    drivers, xhci, and other stuff. Johan also finally refactored pretty
    much every driver that was looking at USB endpoints to do it in a
    common way, which will help prevent any "badly-formed" devices from
    causing problems in drivers. That too wasn't a simple task.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'usb-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (263 commits)
    staging: typec: Fairchild FUSB302 Type-c chip driver
    staging: typec: Type-C Port Controller Interface driver (tcpci)
    staging: typec: USB Type-C Port Manager (tcpm)
    usb: host: xhci: remove #ifdef around PM functions
    usb: musb: don't mark of_dev_auxdata as initdata
    usb: misc: legousbtower: Fix buffers on stack
    USB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"
    usb: Make sure usb/phy/of gets built-in
    USB: storage: e-mail update in drivers/usb/storage/unusual_devs.h
    usb: host: xhci: print correct command ring address
    usb: host: xhci: delete sp_dma_buffers for scratchpad
    usb: host: xhci: using correct specification chapter reference for DCBAAP
    xhci: switch to pci_alloc_irq_vectors
    usb: host: xhci-plat: set resume_quirk() for R-Car controllers
    usb: host: xhci-plat: add resume_quirk()
    usb: host: xhci-plat: enable clk in resume timing
    usb: host: plat: Enable xHCI plat runtime PM
    USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
    USB: serial: constify static arrays
    usb: fix some references for /proc/bus/usb
    ...

    Linus Torvalds
     

03 May, 2017

1 commit

  • Pull documentation update from Jonathan Corbet:
    "A reasonably busy cycle for documentation this time around. There is a
    new guide for user-space API documents, rather sparsely populated at
    the moment, but it's a start. Markus improved the infrastructure for
    converting diagrams. Mauro has converted much of the USB documentation
    over to RST. Plus the usual set of fixes, improvements, and tweaks.

    There's a bit more than the usual amount of reaching out of
    Documentation/ to fix comments elsewhere in the tree; I have acks for
    those where I could get them"

    * tag 'docs-4.12' of git://git.lwn.net/linux: (74 commits)
    docs: Fix a couple typos
    docs: Fix a spelling error in vfio-mediated-device.txt
    docs: Fix a spelling error in ioctl-number.txt
    MAINTAINERS: update file entry for HSI subsystem
    Documentation: allow installing man pages to a user defined directory
    Doc/PM: Sync with intel_powerclamp code behavior
    zr364xx.rst: usb/devices is now at /sys/kernel/debug/
    usb.rst: move documentation from proc_usb_info.txt to USB ReST book
    convert philips.txt to ReST and add to media docs
    docs-rst: usb: update old usbfs-related documentation
    arm: Documentation: update a path name
    docs: process/4.Coding.rst: Fix a couple of document refs
    docs-rst: fix usb cross-references
    usb: gadget.h: be consistent at kernel doc macros
    usb: composite.h: fix two warnings when building docs
    usb: get rid of some ReST doc build errors
    usb.rst: get rid of some Sphinx errors
    usb/URB.txt: convert to ReST and update it
    usb/persist.txt: convert to ReST and add to driver-api book
    usb/hotplug.txt: convert to ReST and add to driver-api book
    ...

    Linus Torvalds
     

21 Apr, 2017

2 commits


12 Apr, 2017

9 commits