Commit Graph

56 Commits (master)

Author SHA1 Message Date
Eric Wild aaf58353af ccid emulation: set usb config 2022-02-25 15:46:20 +01:00
Eric Wild b0f1cb176c ccid emulation: check connection state to prevent errors due to delayed messages 2022-02-25 15:46:08 +01:00
Eric Wild 421311ef2a add functions for usb port reset & config setting 2022-02-25 15:45:17 +01:00
Harald Welte a9470fdc99 CCID_Emulation: Add a Slot_CT + related helper functions
there's no point in all testsuites re-implementing that again and again.
2021-06-03 22:43:56 +02:00
Harald Welte 5f00216c4a differentiate logging between DEBUG / PORTEVENT / WARNING / ERROR
let's make sure we don't spam the logs about each and every USB transfer
2021-06-03 19:58:21 +02:00
Harald Welte 4c742e931a Allow opening of USB device by physical bus path
In case there are multiple devices with identical VID/PID, the
existing open_vid_pid mechanism is insufficient.
2020-02-29 20:37:14 +01:00
Harald Welte 49858b1a66 USB_Component: Add global guard timer
We shouldn't wait indefinitely for responses from the USB TestPort.
2020-02-29 20:36:58 +01:00
Harald Welte d783cb52f5 fix tr_CCID_Parameters (missing field bProtocolNum) 2019-11-28 13:35:18 +01:00
Harald Welte c622b6409a CCID: Fix parsing of CCID_PC_to_RDR_SetParameters, CCID_RDR_to_PC_Parameters 2019-11-28 13:32:31 +01:00
Harald Welte 9d7534aaaf CCID_Emulation: Use USB_Device_Match and dynamically resolve EP addrs 2019-11-27 20:36:54 +01:00
Harald Welte 51681d18b7 add f_usb_get_desc_tree() to provide hierarchical tree of descriptors
parsing a hierarchical structure makes it easier for users to iterate
over configurations, interfaces in one config, endpoints within one
interface, etc.
2019-11-27 20:36:44 +01:00
Harald Welte e80a330430 Add 'USB_Device_Match' (currently only match on VID/PID supported)
the point would be to later extend this with matching by other means,
such as the physical device path, serial number or the like.
2019-11-27 20:36:40 +01:00
Harald Welte 0b46069f87 CCID: Some more CCID_SlotError codes 2019-11-26 20:25:08 +01:00
Harald Welte d4eca8ab61 CCID: Add (present) qualifier where applicable; include hdr_in in receive templates 2019-11-26 20:24:49 +01:00
Eric Wild 9a8b1a455d make setparameters work
Change-Id: Ide0d95eaaf70ee4deed8242377085d1192013333
2019-11-21 19:12:41 +01:00
Eric Wild cd8f989fee do not submit bulk transfers to the interrupt ep..
Change-Id: Ib5b0be2fda0b5336ca4c929a837ccc1e03567f7d
2019-11-21 19:12:23 +01:00
Eric Wild 7a4a3117d0 fix irq endpoint handling
the irq endpoint only offers data if card insertions/removals happen,
which is rarely the case, so read timeouts are fine.

Change-Id: Ide7ffe14c94f56d0ed6f27e30e039905be32ad09
2019-11-20 19:43:54 +01:00
Harald Welte af4236db1f Split USB_Component from USB_Emulation and add CCID_Emulation 2019-11-14 08:25:32 +01:00
Harald Welte 10ce350e47 ts_CCID_XfrBlock: Default values for bwi and level 2019-11-14 08:25:32 +01:00
Harald Welte fe76adab5f CCID_Templates: Add missing dependency on Osmocom_Types (u_int*_t) 2019-11-14 08:25:32 +01:00
Harald Welte 52ac2ccc0a CCID_Types: Fix byte order of CCID_Protocols 2019-11-14 08:25:32 +01:00
Harald Welte 27165205dc USB_Demo: Add f_usb_claim_interface() convenience function 2019-01-30 22:01:23 +01:00
Harald Welte 374ff37ba4 USB_Demo: Extend tr_UsbXfer_compl() beyond CONTROL transfers 2019-01-30 22:01:02 +01:00
Harald Welte f17bf44a4b CCID_Templates: Fix dwLength value in send templates
The length value describes the length *after* the header, so for
most short requests, it's zero.
2019-01-30 22:00:01 +01:00
Harald Welte dd9ab09c8b USB_Demo: Use ts_USB_claim_interface() rather than open-coding it 2019-01-30 21:58:58 +01:00
Harald Welte 03ce3a894b USB_Demo: Use g_dev_hdl and avoid hard-coded 42 2019-01-30 21:58:32 +01:00
Harald Welte 82a2797994 USB_Demo: Don't use hard-coded req_hdl but dynamically allocate it 2019-01-30 21:57:38 +01:00
Harald Welte f6559dbdb6 use local variables in outgoing_send() to avoid starnge printf values 2019-01-30 21:26:25 +01:00
Harald Welte 00d2616a2c declare {enc,dec}_CCID_ClassDescriptor
This allows test cases to decode the relevant descriptor
2019-01-28 17:08:16 +01:00
Harald Welte 1a706759c0 CCID_Types: avoid multi-byte bitfield records
For some reason I cannot get them correctly deoded ,see my post at
2019-01-28 17:07:20 +01:00
Harald Welte 4126bfb255 Extend 'USB_StandardDescriptor' with binary 'other'
This means that USB_StandardDescriptor can now als odecode descriptors
it doesn't know: It simply stores them as octetstring and continues
with the next descriptor.
2019-01-28 17:06:22 +01:00
Harald Welte e1331dd954 add 'usb' to function names; export some important functions 2019-01-28 17:05:48 +01:00
Harald Welte 353435925f fixup uint8_t mess 2019-01-25 22:46:42 +01:00
Harald Welte 1d76a5012a USB_Demo: major rewrite + test extension 2019-01-25 22:37:56 +01:00
Harald Welte 768b609c77 demo: Factor-out opening the USB device into f_init() 2019-01-25 19:39:51 +01:00
Harald Welte fbb5d48be5 demo: Turn vendor/product ID into modulepars 2019-01-25 19:29:53 +01:00
Harald Welte 9acc209aa1 remove dependency on Osmocom_Types.ttcn
... we were only using the uint8_t definition, so let's copy that
one to USB_Types.
2019-01-25 19:24:58 +01:00
Harald Welte 96501d0be6 Add new CCID_Templates module containing USB-CCID related templates 2019-01-14 22:46:34 +01:00
Harald Welte 0405802fc5 CCID_Types: Fix typo 2019-01-14 22:46:21 +01:00
Harald Welte 5a35beb80b CCID_TypeS: Use little-endian 16/32bit integer types 2019-01-14 22:46:01 +01:00
Harald Welte 296b3d3825 Add Eclipse Public License as license text for this project
As the USB port for Eclipse TITAN is likely something that might
eventually be interesting to the TITAN project for inclusion, I
thought it's a good idea to use the same license as upstream.

I'd of course prefer if there was a stronger copyleft license
used in this context, but well, it's not my project :/
2019-01-13 23:39:07 +01:00
Harald Welte b4d84ddc3f demo: WIP code for demonstrating/testing the USB TestPort 2019-01-13 23:30:45 +01:00
Harald Welte afed7910bf Add CCID_Types containing definitions relevant to USB CCID 2019-01-13 23:30:15 +01:00
Harald Welte 8bdc776047 fix typo in record member name (USB_EpAttribs.Usage_Tyype) 2019-01-13 23:29:12 +01:00
Harald Welte 0a5c701271 Fix USB Device Request Code name for '0' 2019-01-13 23:28:49 +01:00
Harald Welte 287d764a7a New USB_Templates.ttcn with templates for USB control requests 2019-01-13 23:28:26 +01:00
Harald Welte 8739776233 Define 'record of' USB_StandardDescriptor
This is quite handy for decoding e.g. a configuration descriptor, which
is typically concatenated with interface descriptors, endpoint
descriptors, etc.
2019-01-13 23:05:58 +01:00
Harald Welte 66858d15a7 Remove 'actual_length' parameter of USB_tranfer_compl
We can simply cut the returned data octet string to the actual length
instead.  In this case, we must also adjust for the control pipe header
in case of CONTROL IN transfers.
2019-01-13 23:04:48 +01:00
Harald Welte a362722b96 USB_Types: USB_Feature_Selector + USB_DeviceRequest definitions 2019-01-13 22:41:36 +01:00
Harald Welte 542f8cb128 USB_PT: Populate the USB_trasnfer_compl.transfer_hdl
... only this way the user can know which trasnfer has just completed.
2019-01-13 22:40:51 +01:00