dxd - dynax driver framework 2.1.0d71
cross platform open source driver development framework
Loading...
Searching...
No Matches
dxd::usb_device Class Reference

#include <dxd_usb.h>

+ Inheritance diagram for dxd::usb_device:
+ Collaboration diagram for dxd::usb_device:

Classes

class  pipe
 IOKit: USB pipe class. More...
 

Public Types

enum  speed {
  low =::kUSBHostConnectionSpeedLow , full =::kUSBHostConnectionSpeedFull , high =::kUSBHostConnectionSpeedHigh , usb1 =full ,
  usb2 =high , low =::kUSBHostConnectionSpeedLow , full =::kUSBHostConnectionSpeedFull , high =::kUSBHostConnectionSpeedHigh ,
  usb1 =full , usb2 =high
}
 
enum  speed {
  low =::kUSBHostConnectionSpeedLow , full =::kUSBHostConnectionSpeedFull , high =::kUSBHostConnectionSpeedHigh , usb1 =full ,
  usb2 =high , low =::kUSBHostConnectionSpeedLow , full =::kUSBHostConnectionSpeedFull , high =::kUSBHostConnectionSpeedHigh ,
  usb1 =full , usb2 =high
}
 

Public Member Functions

os_result clear ()
 
unsigned char configuration () const
 
unsigned char configuration () const
 return available USB configurations
 
os_result configuration (unsigned char configuration)
 
os_result configuration (unsigned char configuration)
 choose USB configuration
 
unsigned char configurations () const
 
unsigned char configurations () const
 return current USB configuration
 
decltype(dx::usb::descriptor::device) descriptor () const
 IOKit: request the USB device descriptor.
 
template<class client_t = ::IOService, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t each_child (exec_arg_t exec_arg, exec_t exec)
 apply executor functor for each child
 
template<class client_t = ::IOUserClient, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t each_client (exec_arg_t exec_arg, exec_t exec)
 apply executor functor for each user client
 
uint64_t frame () const
 
uint64_t frame () const
 
::IOUSBHostInterface * interface (unsigned char index, unsigned char setting=0)
 IOKit: USB interface.
 
const ::USBD_INTERFACE_INFORMATION * interface (unsigned char index, unsigned char setting=0)
 
template<typename tx_t , typename rx_t >
os_result ioctl (unsigned int ioctl, const tx_t &tx, rx_t &rx)
 convenience ioctl accessor for direct inter-kext IOCTL
 
virtual os_result ioctl (unsigned int ioctl, const void *in, size_t size_in, void *out, size_t size_out, size_t &size)
 device IOCTL handler
 
os_result notify_clients ()
 
 operator::DEVICE_OBJECT * () const
 
 operator::IOUSBHostDevice * () const
 IOKit: IOUSBDevice* implicit cast.
 
template<typename type_t >
os_result property (const char *key, type_t &value) const
 provider property request
 
template<typename type_t >
os_result query (const char *key, type_t &value)
 device property request
 
template<>
os_result query (const char *key, unsigned int &value)
 (defined(doxygen)||defined(DXD_EXTERN))
 
template<typename data_t >
os_result request (const dx::usb::control &control, data_t &data)
 IOKit: synchronously sends an USB request.
 
template<typename data_t >
os_result request (const dx::usb::control &control, data_t &data)
 
os_result request (const dx::usb::control &control, void *data, size_t &size)
 
os_result request (const dx::usb::control &control, void *data, size_t &size)
 
os_result set (const char *key, unsigned int value)
 
speed speed () const
 
speed speed () const
 
os_result state () const
 
os_result string (unsigned char idx, char *string, unsigned char &chars)
 
os_result string (unsigned char idx, char *string, unsigned char &chars, dx::usb::language language=dx::usb::language::standard)
 IOKit: request the USB string descriptor for the index.
 
template<typename string_t >
os_result string (unsigned char idx, string_t &string)
 
template<typename string_t >
os_result string (unsigned char idx, string_t &string)
 
 usb_device (::WDFDEVICE_INIT *wdf_device_init, const ::GUID &guid)
 WDK: USB device constructor.
 
 ~usb_device ()
 

Protected Member Functions

void close_interfaces ()
 
void conclude () override
 IOKit: USB conclude.
 
void conclude () override
 WDK: USB device de-initialization callback.
 
os_result launch () override
 IOKit: USB launch.
 
os_result launch () override
 WDK: USB device initialization callback.
 
os_result open_interfaces ()
 
bool start (::IOService *provider) override
 IOKit: USB start.
 

Member Enumeration Documentation

◆ speed [1/2]

Todo
enum class
Enumerator
low 
full 
high 
usb1 
usb2 
low 
full 
high 
usb1 
usb2 

◆ speed [2/2]

Enumerator
low 
full 
high 
usb1 
usb2 
low 
full 
high 
usb1 
usb2 

Constructor & Destructor Documentation

◆ usb_device()

dxd::usb_device::usb_device ( ::WDFDEVICE_INIT * wdf_device_init,
const ::GUID & guid )
inline

WDK: USB device constructor.

Registers PNP capabilities

◆ ~usb_device()

dxd::usb_device::~usb_device ( )
inline

Member Function Documentation

◆ clear()

os_result dxd::usb_device::clear ( )
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ close_interfaces()

void dxd::usb_device::close_interfaces ( )
inlineprotected
+ Here is the caller graph for this function:

◆ conclude() [1/2]

void dxd::usb_device::conclude ( )
inlineoverrideprotectedvirtual

IOKit: USB conclude.

This method:

  • iterates over and closes all USB interfaces
  • deselects USB configuration
  • closes the USB device from exclusive access
  • De-selects previosly selected USB configuration,
Todo
investigate if reset() is still needed here
  • closes the USB device, so another driver has the chance to match against (important: this driver will not unload otherwise)

Reimplemented from dxd::device.

+ Here is the call graph for this function:

◆ conclude() [2/2]

void dxd::usb_device::conclude ( )
inlineoverrideprotectedvirtual

WDK: USB device de-initialization callback.

Reimplemented from dxd::device.

+ Here is the call graph for this function:

◆ configuration() [1/4]

unsigned char dxd::usb_device::configuration ( ) const
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ configuration() [2/4]

unsigned char dxd::usb_device::configuration ( ) const
inline

return available USB configurations

◆ configuration() [3/4]

os_result dxd::usb_device::configuration ( unsigned char configuration)
inline
+ Here is the call graph for this function:

◆ configuration() [4/4]

os_result dxd::usb_device::configuration ( unsigned char configuration)
inline

choose USB configuration

removes interface cache

deselects current configuration on request #0

obtains the configuration descriptor,

obtains all descriptors,

enumerates interfaces in the configuration,

allocates and builds an URB for the select-configuration request,

creates interface cache

enumerates the pipes in the interface information array, which is now filled with pipe information.

+ Here is the call graph for this function:

◆ configurations() [1/2]

unsigned char dxd::usb_device::configurations ( ) const
inline
+ Here is the call graph for this function:

◆ configurations() [2/2]

unsigned char dxd::usb_device::configurations ( ) const
inline

return current USB configuration

◆ descriptor()

decltype(dx::usb::descriptor::device) dxd::usb_device::descriptor ( ) const
inline

IOKit: request the USB device descriptor.

Deprecated
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ each_child()

template<class client_t = ::IOService, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t dxd::device::each_child ( exec_arg_t exec_arg,
exec_t exec )
inlineinherited

apply executor functor for each child

◆ each_client()

template<class client_t = ::IOUserClient, typename return_t = os_result, typename exec_arg_t , typename exec_t >
return_t dxd::device::each_client ( exec_arg_t exec_arg,
exec_t exec )
inlineinherited

apply executor functor for each user client

◆ frame() [1/2]

uint64_t dxd::usb_device::frame ( ) const
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ frame() [2/2]

uint64_t dxd::usb_device::frame ( ) const
inline
+ Here is the call graph for this function:

◆ interface() [1/2]

::IOUSBHostInterface * dxd::usb_device::interface ( unsigned char index,
unsigned char setting = 0 )
inline

IOKit: USB interface.

Selects the USB interface

checks interface, if it fails: was it configured?

and selects the (alternate) setting

Parameters
indexindex of the USB interface in the USB configuration
settingsetting # of the USB interface

◆ interface() [2/2]

const ::USBD_INTERFACE_INFORMATION * dxd::usb_device::interface ( unsigned char index,
unsigned char setting = 0 )
inline

requests settings change,

disposes and creates new interface cache on size change,

and fills interface cache,

◆ ioctl() [1/2]

template<typename tx_t , typename rx_t >
os_result dxd::device::ioctl ( unsigned int ioctl,
const tx_t & tx,
rx_t & rx )
inlineinherited

convenience ioctl accessor for direct inter-kext IOCTL

◆ ioctl() [2/2]

virtual os_result dxd::device::ioctl ( unsigned int ioctl,
const void * in,
size_t size_in,
void * out,
size_t size_out,
size_t & size )
inlinevirtualinherited

device IOCTL handler

virtual ioctl() gets called by the dynax driver framework for device IOCTL handling.

remark: this is rarely done. usually IOCTLs are handled in the user client derivate.

Parameters
ioctlIOCTL
inbuffer pointer containing data from user mode
size_insize of the buffer containing data from user mode
outbuffer pointer accepting data to be returned to user mode
size_outsize of the buffer accepting data to be returned to user mode
sizeactual size of data to be returned to user mode

Reimplemented in dxd::usb_stream_device.

+ Here is the caller graph for this function:

◆ launch() [1/2]

os_result dxd::usb_device::launch ( )
inlineoverrideprotectedvirtual

IOKit: USB launch.

This method:

  • opens the USB device for exclusive access,
  • selects default USB configuration
  • iterates over and opens all USB interfaces

Reimplemented from dxd::device.

+ Here is the call graph for this function:

◆ launch() [2/2]

os_result dxd::usb_device::launch ( )
inlineoverrideprotectedvirtual

WDK: USB device initialization callback.

obtain vage speed info

obtains the device descriptor,

and select USB configuration #1.

Reimplemented from dxd::device.

+ Here is the call graph for this function:

◆ notify_clients()

os_result dxd::device::notify_clients ( )
inlineinherited

◆ open_interfaces()

os_result dxd::usb_device::open_interfaces ( )
inlineprotected
+ Here is the caller graph for this function:

◆ operator::DEVICE_OBJECT *()

dxd::usb_device::operator::DEVICE_OBJECT * ( ) const
inline

◆ operator::IOUSBHostDevice *()

dxd::usb_device::operator::IOUSBHostDevice * ( ) const
inline

IOKit: IOUSBDevice* implicit cast.

◆ property()

template<typename type_t >
os_result dxd::device::property ( const char * key,
type_t & value ) const
inlineinherited

provider property request

try if property is an OSString

or, try to get it as OSData

+ Here is the caller graph for this function:

◆ query() [1/2]

template<typename type_t >
os_result dxd::device::query ( const char * key,
type_t & value )
inherited

device property request

device string property request

Todo
move into property class

try if property is an OSString

get it as OSData

◆ query() [2/2]

template<>
os_result dxd::device::query ( const char * key,
unsigned int & value )
inherited

(defined(doxygen)||defined(DXD_EXTERN))

device integer property request

◆ request() [1/4]

template<typename data_t >
os_result dxd::usb_device::request ( const dx::usb::control & control,
data_t & data )
inline

IOKit: synchronously sends an USB request.

Todo
USB device control request timeout
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request() [2/4]

template<typename data_t >
os_result dxd::usb_device::request ( const dx::usb::control & control,
data_t & data )
inline
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive
+ Here is the call graph for this function:

◆ request() [3/4]

os_result dxd::usb_device::request ( const dx::usb::control & control,
void * data,
size_t & size )
inline
Parameters
controlthe USB request control defining the request type
datadata to transmit or receive
sizesize of the actual transaction
+ Here is the call graph for this function:

◆ request() [4/4]

os_result dxd::usb_device::request ( const dx::usb::control & control,
void * data,
size_t & size )
inline

◆ set()

os_result dxd::device::set ( const char * key,
unsigned int value )
inlineinherited

◆ speed() [1/2]

speed dxd::usb_device::speed ( ) const
inline

◆ speed() [2/2]

speed dxd::usb_device::speed ( ) const
inline
Todo
implement WDK low/super speed check for dxd::usb_device.speed()

◆ start()

bool dxd::usb_device::start ( ::IOService * provider)
inlineoverrideprotected

IOKit: USB start.

+ Here is the caller graph for this function:

◆ state()

os_result dxd::usb_device::state ( ) const
inline
Todo
find out if isInactive() is equivalent to getState()
+ Here is the caller graph for this function:

◆ string() [1/4]

os_result dxd::usb_device::string ( unsigned char idx,
char * string,
unsigned char & chars )
inline

◆ string() [2/4]

os_result dxd::usb_device::string ( unsigned char idx,
char * string,
unsigned char & chars,
dx::usb::language language = dx::usb::language::standard )
inline

IOKit: request the USB string descriptor for the index.

Parameters
idxindex of the string to request
stringpreallocated string buffer
charsnumber of characters returned
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ string() [3/4]

template<typename string_t >
os_result dxd::usb_device::string ( unsigned char idx,
string_t & string )
inline
+ Here is the call graph for this function:

◆ string() [4/4]

template<typename string_t >
os_result dxd::usb_device::string ( unsigned char idx,
string_t & string )
inline
+ Here is the call graph for this function:

The documentation for this class was generated from the following files:

(c) copyright 2009 dynamic acoustics e.U. generated on Wed Oct 2 2024

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.