summaryrefslogtreecommitdiff
path: root/gusb/gusb-device.c
Commit message (Collapse)AuthorAgeFilesLines
* trivial: Fix up a gtk-doc commentRichard Hughes2022-10-261-1/+1
|
* Export g_usb_device_has_tag()Richard Hughes2022-10-261-2/+13
|
* trivial: Fix up clang-format issueRichard Hughes2022-09-131-1/+1
|
* Allow adding tags to the JSON device eventRichard Hughes2022-09-131-0/+65
| | | | This allows us to see which phase of the emulation should be used.
* Include the created time in the JSON eventRichard Hughes2022-09-131-0/+10
|
* Allow emulating failed eventsRichard Hughes2022-09-121-0/+34
| | | | | This is required to emulate devices that just reset (without completing the current transfer) when asked to reset.
* Do not copy event data when not-requiredRichard Hughes2022-09-101-3/+48
| | | | | This will prevent crashes if the caller is casting from a const buffer to a mutable buffer.
* Save device events when requiredRichard Hughes2022-09-081-5/+407
| | | | | | This allows us to simulate an entire context of devices, simulating responses as if the hardware is connected. This allows building rich device-specific unit tests in programs like fwupd, without having to have the hardware attached.
* trivial: Ignore more requests when emulating a deviceRichard Hughes2022-09-061-0/+20
|
* trivial: Use a unique JSON key name for the IDRichard Hughes2022-09-061-4/+5
|
* trivial: Use a boolean flag for cache controlRichard Hughes2022-09-061-2/+10
| | | | There's no point keep asking the device for BOS descriptors when it has none.
* trivial: Check the handle before getting BOS descriptorsRichard Hughes2022-09-061-0/+4
|
* trivial: Fix up some docgen headersRichard Hughes2022-09-061-24/+0
|
* Skip some functionality when emulatingRichard Hughes2022-09-051-0/+12
|
* Include the platform ID in the JSON fileRichard Hughes2022-09-051-0/+10
|
* Serialize the GUsbDevice to and from JSON formatRichard Hughes2022-09-051-10/+236
| | | | This allows us to write tests that mock up entire devices.
* Cache the list of interfaces and descriptorsRichard Hughes2022-09-051-94/+101
| | | | | This can speed up device enumeration, and also allows us to emulate the interfaces or descriptors in the future.
* trivial: Use @self for instance dataRichard Hughes2022-09-051-247/+243
|
* Use G_DECLARE_DERIVABLE_TYPE to reduce boilerplateRichard Hughes2022-09-051-96/+125
|
* Reformat the code using clang-formatRichard Hughes2022-09-041-650/+624
| | | | | This frees up mental energy when reviewing patches and is something I should have done a long time ago.
* Add support for getting BOS descriptorsRichard Hughes2022-09-041-0/+103
|
* Use g_autoptr() in a lot more placesRichard Hughes2022-09-041-14/+7
| | | | We started using this several months ago and nobody even noticed.
* trivial: Remove some duplicate header includesRichard Hughes2022-06-161-2/+0
|
* Only include the start year in the copyright headerRichard Hughes2022-06-161-1/+1
| | | | | The end year is legally and functionally redundant, and more importantly causes cherry-pick conflicts when trying to maintain old branches.
* Add g_usb_device_get_string_descriptor_bytes_fullmasterRicardo Cañuelo2021-09-301-8/+39
| | | | | | | Some devices won't answer to a request with a 128-byte data buffer, this allows the user to specify the size of the request data buffer. g_usb_device_get_string_descriptor_bytes still uses the default buffer size (128 bytes).
* Do not depend on libusb_get_port_number() to fix DragonFlyBSD compileRichard Hughes2021-05-211-1/+10
|
* Do not depend on libusb_get_parent() to fix FreeBSD compileRichard Hughes2021-05-211-0/+9
|
* device: Reference the libusb device when setMarco Trevisan (Treviño)2021-04-131-3/+13
| | | | | | | | | We used to reference a device during the initable init vfunc, however it's better to do it when the device is actually set as an object property. In this way, the device is always unreffed when the object is disposed, without having to care about the ordering.
* device: Do not double-reference USB devicesMarco Trevisan (Treviño)2021-04-131-2/+0
| | | | | | | | | | | Currently gusb-device adds two references to an internal libusb device, causing a memory leak on destruction. In fact, we add a reference when the device is constructed and when the device is inited. To avoid this and ensure that libusb will cleanup all the devices on context destruction, only reference on device initialization.
* Add g_usb_device_get_string_descriptor_bytes()Richard Hughes2021-01-271-0/+41
| | | | This is requried for the GD32VF103 device.
* device: Fix cancellation if cancellable is already cancelledBenjamin Berg2020-10-011-27/+42
| | | | | | | | | | | libusb can only handle cancellation if the transfer is already in-flight. However, g_cancellable_connect will immediately call the callback and then libusb_cancel_transfer when the cancellable is already cancelled at the time the transfer is submitted. Move the cancellation registration to after transfer submission to avoid ordering issues. Also avoid even submitting the transfer if the cancellable is already cancelled to begin with.
* trivial: Fix up typos spotted by codespellRichard Hughes2020-09-241-6/+6
|
* Add a way to get iConfigurationBenson Leung2020-07-291-0/+30
| | | | | Adds a getter for a gusb_device to get the string index for the active configuration's description.
* trivial: Add some missing 'Since: ' valuesRichard Hughes2020-02-201-0/+4
|
* Include the USB bus in the generated platform_idRichard Hughes2020-02-141-11/+6
| | | | | | | | | | | The existing logic here was unsound; the recursion only checked the string for length 0 after it had gone up the tree to the parent, and so would never match. This meant if you had identical devices with the same port hierarchy on different USB busses they had the *same* physical ID. This really upsets projects like fwupd which use the physical ID to stay the same on device replug (which worked fine), but also dedupe devices with the same physical ID, which is what broke here.
* trivial: Use spaces and tabs consistentlyRichard Hughes2020-01-211-156/+156
|
* trivial: Use SPDX-License-Identifier tagsRichard Hughes2020-01-211-14/+1
|
* Add g_usb_device_get_spec()Richard Hughes2019-11-151-0/+19
| | | | Sometimes we do care about the USB version number of the device.
* trivial: Remove untrue statementRichard Hughes2019-11-151-1/+0
|
* gi: made actual_length introspection annotationsgrindhold2019-09-261-3/+3
| | | | | | the actual_length parameter of GUsbDevice's transfer-methods should be out parameters. otherwise the generated vala bindings will cause programs to segfault.
* trivial: Fix some typos spotted using codespellRichard Hughes2019-04-081-1/+1
|
* trivial: Fix two -Wswitch-default warningsRichard Hughes2017-12-191-0/+2
|
* Replace libusb-1.0/libusb.h with libusb.hTing-Wei Lan2017-12-191-1/+1
| | | | | | | FreeBSD doesn't have the libusb-1.0 directory, and required include arguments should be provided by pkg-config. Signed-off-by: Richard Hughes <richard@hughsie.com>
* trivial: Be less vocal when using G_USB_CONTEXT_FLAGS_AUTO_OPEN_DEVICESRichard Hughes2017-07-241-6/+2
|
* Add g_usb_context_set_flags()Richard Hughes2017-07-231-15/+33
| | | | This allows us to auto-open devices as they are hotplugged.
* Fix a memory leak when using g_usb_device_control_transfer_async()Richard Hughes2017-03-241-5/+6
|
* trivial: Fix compile warning with GCC6Richard Hughes2016-03-101-1/+1
|
* Revert "Allow getting the GUsbContext from the GUsbDevice"Richard Hughes2015-11-251-4/+1
| | | | | | This reverts commit 7561b53eed51776b393e0b5e270cb07d637835a9. It's a layering violation, and I've found a better way to do this now.
* Add a PERMISSION_DENIED error enumRichard Hughes2015-11-201-6/+13
| | | | Sometimes we want to handle this differently...
* trivial: Remove typo that meant we only returned one interfaceRichard Hughes2015-11-161-1/+0
|