channels: cmake cleanup, USB redirection refactoring
This commit is contained in:
parent
5e77cefb08
commit
ecddb58ba2
@ -22,14 +22,35 @@ include(CMakeDependentOption)
|
||||
|
||||
macro(define_channel_options)
|
||||
set(PREFIX "CHANNEL")
|
||||
|
||||
|
||||
cmake_parse_arguments(${PREFIX}
|
||||
""
|
||||
"NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT"
|
||||
""
|
||||
${ARGN})
|
||||
|
||||
|
||||
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION)
|
||||
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION)
|
||||
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION)
|
||||
|
||||
if(${${CHANNEL_CLIENT_OPTION}})
|
||||
set(OPTION_CLIENT_DEFAULT ${${CHANNEL_CLIENT_OPTION}})
|
||||
endif()
|
||||
|
||||
if(${${CHANNEL_SERVER_OPTION}})
|
||||
set(OPTION_SERVER_DEFAULT ${${CHANNEL_SERVER_OPTION}})
|
||||
endif()
|
||||
|
||||
if(${${CHANNEL_OPTION}})
|
||||
set(OPTION_DEFAULT ${${CHANNEL_OPTION}})
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT "ON")
|
||||
endif()
|
||||
|
||||
set(CHANNEL_DEFAULT ${OPTION_DEFAULT})
|
||||
|
||||
set(CHANNEL_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel")
|
||||
option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT})
|
||||
|
||||
|
@ -8,10 +8,6 @@ if(ANDROID)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "audin" TYPE "dynamic"
|
||||
DESCRIPTION "Audio Input Redirection Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEAI]"
|
||||
@ -19,3 +15,4 @@ define_channel_options(NAME "audin" TYPE "dynamic"
|
||||
|
||||
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
|
||||
define_channel_server_options(${OPTION_SERVER_DEFAULT})
|
||||
|
||||
|
@ -3,10 +3,6 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "cliprdr" TYPE "static"
|
||||
DESCRIPTION "Clipboard Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPECLIP]"
|
||||
|
@ -3,10 +3,6 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "drdynvc" TYPE "static"
|
||||
DESCRIPTION "Dynamic Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEDYC]"
|
||||
|
@ -8,10 +8,6 @@ if(ANDROID)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "drive" TYPE "device"
|
||||
DESCRIPTION "Drive Redirection Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEFS]"
|
||||
|
@ -13,10 +13,6 @@ if(ANDROID)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "parallel" TYPE "device"
|
||||
DESCRIPTION "Parallel Port Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPESP]"
|
||||
|
@ -14,10 +14,6 @@ else()
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "printer" TYPE "device"
|
||||
DESCRIPTION "Print Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEPC]"
|
||||
|
@ -3,10 +3,6 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "rail" TYPE "static"
|
||||
DESCRIPTION "Remote Programs Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPERP]"
|
||||
|
@ -3,10 +3,6 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "rdpdr" TYPE "static"
|
||||
DESCRIPTION "Device Redirection Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]"
|
||||
|
@ -3,10 +3,6 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT ON)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "rdpsnd" TYPE "static"
|
||||
DESCRIPTION "Audio Output Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEA]"
|
||||
|
@ -8,10 +8,6 @@ if(WITH_SAMPLE)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "sample" TYPE "static"
|
||||
DESCRIPTION "Sample Virtual Channel Extension"
|
||||
SPECIFICATIONS ""
|
||||
|
@ -13,10 +13,6 @@ if(ANDROID)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "serial" TYPE "device"
|
||||
DESCRIPTION "Serial Port Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPESP]"
|
||||
|
@ -8,10 +8,6 @@ if(WITH_PCSC)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "smartcard" TYPE "device"
|
||||
DESCRIPTION "Smart Card Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPESC]"
|
||||
|
@ -13,10 +13,6 @@ if(ANDROID)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "tsmf" TYPE "dynamic"
|
||||
DESCRIPTION "Video Redirection Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEV]"
|
||||
|
@ -3,15 +3,10 @@ set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT OFF)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT})
|
||||
set(OPTION_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "urbdrc" TYPE "dynamic"
|
||||
DESCRIPTION "USB Devices Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPEUSB]"
|
||||
DEFAULT ${OPTION_DEFAULT})
|
||||
|
||||
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
|
||||
#define_channel_server_options(${OPTION_SERVER_DEFAULT})
|
||||
|
||||
define_channel_server_options(${OPTION_SERVER_DEFAULT})
|
||||
|
@ -42,10 +42,15 @@ set(${MODULE_PREFIX}_LIBS
|
||||
udev
|
||||
uuid)
|
||||
|
||||
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||
MODULE winpr
|
||||
MODULES winpr-utils)
|
||||
|
||||
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||
MODULE freerdp
|
||||
MODULES freerdp-utils)
|
||||
MODULES freerdp-common freerdp-utils)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
||||
|
@ -798,8 +798,7 @@ static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, BYT
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
static int urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
IUDEVMAN * udevman,
|
||||
@ -963,8 +962,7 @@ urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK* callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -973,17 +971,19 @@ urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
BYTE func_recipient,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, InterfaceId, RequestId, OutputBufferSize, usbd_status;
|
||||
BYTE bmRequestType, desc_index, desc_type;
|
||||
UINT16 langId;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int ret, offset;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, InterfaceId, RequestId, OutputBufferSize, usbd_status;
|
||||
BYTE bmRequestType, desc_index, desc_type;
|
||||
UINT16 langId;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int ret, offset;
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev));
|
||||
data_read_UINT32(data + 0, RequestId);
|
||||
data_read_BYTE(data + 4, desc_index);
|
||||
@ -1055,11 +1055,7 @@ urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
static int urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
IUDEVMAN * udevman,
|
||||
@ -1067,13 +1063,13 @@ urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
BYTE func_recipient,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 Index;
|
||||
BYTE bmRequestType;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int offset, ret;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 Index;
|
||||
BYTE bmRequestType;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int offset, ret;
|
||||
|
||||
if (transferDir == 0){
|
||||
LLOGLN(urbdrc_debug, ("urb_control_get_status_request: not support transfer out\n"));
|
||||
@ -1150,8 +1146,7 @@ urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -1161,14 +1156,14 @@ urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
BYTE func_recipient,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, TransferFlags, usbd_status;
|
||||
UINT32 OutputBufferSize;
|
||||
BYTE ReqTypeReservedBits, Request, bmRequestType;
|
||||
UINT16 Value, Index, Padding;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int offset, ret;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, TransferFlags, usbd_status;
|
||||
UINT32 OutputBufferSize;
|
||||
BYTE ReqTypeReservedBits, Request, bmRequestType;
|
||||
UINT16 Value, Index, Padding;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int offset, ret;
|
||||
/** control by vendor command */
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
@ -1260,8 +1255,7 @@ urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
|
||||
|
||||
|
||||
static int
|
||||
urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -1269,17 +1263,19 @@ urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
UINT32 UsbDevice,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
BYTE Recipient, InterfaceNumber, Ms_PageIndex;
|
||||
UINT16 Ms_featureDescIndex;
|
||||
BYTE * out_data;
|
||||
BYTE * buffer;
|
||||
int offset, ret;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
BYTE Recipient, InterfaceNumber, Ms_PageIndex;
|
||||
UINT16 Ms_featureDescIndex;
|
||||
BYTE* out_data;
|
||||
BYTE* buffer;
|
||||
int offset, ret;
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev));
|
||||
|
||||
data_read_UINT32(data + 0, RequestId);
|
||||
@ -1351,14 +1347,11 @@ urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
callback->channel->Write(callback->channel, out_size, out_data, NULL);
|
||||
|
||||
zfree(out_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
static int urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
IUDEVMAN * udevman,
|
||||
@ -1366,11 +1359,11 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
int transferDir,
|
||||
int action)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, PipeHandle, EndpointAddress;
|
||||
UINT32 OutputBufferSize, usbd_status = 0;
|
||||
BYTE * out_data;
|
||||
int out_offset, ret;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, PipeHandle, EndpointAddress;
|
||||
UINT32 OutputBufferSize, usbd_status = 0;
|
||||
BYTE* out_data;
|
||||
int out_offset, ret;
|
||||
|
||||
if (transferDir == 0){
|
||||
LLOGLN(urbdrc_debug, ("urb_pipe_request: not support transfer out\n"));
|
||||
@ -1378,8 +1371,10 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
}
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev));
|
||||
|
||||
data_read_UINT32(data + 0, RequestId);
|
||||
@ -1445,14 +1440,11 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
if (!pdev->isSigToEnd(pdev))
|
||||
callback->channel->Write(callback->channel, out_size, out_data, NULL);
|
||||
zfree(out_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK* callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -1460,10 +1452,10 @@ urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
UINT32 UsbDevice,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize;
|
||||
UINT32 dummy_frames;
|
||||
BYTE * out_data;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize;
|
||||
UINT32 dummy_frames;
|
||||
BYTE* out_data;
|
||||
|
||||
if (transferDir == 0){
|
||||
LLOGLN(urbdrc_debug, ("urb_get_current_frame_number: not support transfer out\n"));
|
||||
@ -1510,8 +1502,7 @@ urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
|
||||
|
||||
/* Unused function for current server */
|
||||
static int
|
||||
urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK* callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -1519,21 +1510,24 @@ urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
UINT32 UsbDevice,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int ret, offset;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int ret, offset;
|
||||
|
||||
if (transferDir == 0){
|
||||
if (transferDir == 0)
|
||||
{
|
||||
LLOGLN(urbdrc_debug, ("urb_control_get_configuration_request:"
|
||||
" not support transfer out\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev));
|
||||
|
||||
data_read_UINT32(data + 0, RequestId);
|
||||
@ -1589,8 +1583,7 @@ urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
}
|
||||
|
||||
/* Unused function for current server */
|
||||
static int
|
||||
urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
static int urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK* callback,
|
||||
BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
@ -1598,12 +1591,12 @@ urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
UINT32 UsbDevice,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 interface;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int ret, offset;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 interface;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int ret, offset;
|
||||
|
||||
if (transferDir == 0){
|
||||
LLOGLN(urbdrc_debug, ("urb_control_get_interface_request: not support transfer out\n"));
|
||||
@ -1666,8 +1659,7 @@ urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
IUDEVMAN * udevman,
|
||||
@ -1676,17 +1668,19 @@ urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
BYTE command,
|
||||
int transferDir)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 FeatureSelector, Index;
|
||||
BYTE bmRequestType, bmRequest;
|
||||
BYTE * buffer;
|
||||
BYTE * out_data;
|
||||
int ret, offset;
|
||||
IUDEVICE* pdev;
|
||||
UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status;
|
||||
UINT16 FeatureSelector, Index;
|
||||
BYTE bmRequestType, bmRequest;
|
||||
BYTE* buffer;
|
||||
BYTE* out_data;
|
||||
int ret, offset;
|
||||
|
||||
pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev));
|
||||
|
||||
data_read_UINT32(data + 0, RequestId);
|
||||
@ -1769,8 +1763,7 @@ urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
static int urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
UINT32 data_sizem,
|
||||
UINT32 MessageId,
|
||||
IUDEVMAN * udevman,
|
||||
@ -2296,13 +2289,13 @@ urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data,
|
||||
break;
|
||||
default:
|
||||
LLOGLN(urbdrc_debug, ("URB_Func: %x is not found!", URB_Function));
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void*
|
||||
urbdrc_process_udev_data_transfer(void* arg)
|
||||
void* urbdrc_process_udev_data_transfer(void* arg)
|
||||
{
|
||||
TRANSFER_DATA* transfer_data = (TRANSFER_DATA*) arg;
|
||||
URBDRC_CHANNEL_CALLBACK * callback = transfer_data->callback;
|
||||
|
@ -149,9 +149,11 @@ void isoch_queue_free(ISOCH_CALLBACK_QUEUE* queue)
|
||||
while (queue->has_next(queue))
|
||||
{
|
||||
isoch = queue->get_next(queue);
|
||||
|
||||
if (isoch != NULL)
|
||||
queue->unregister_data(queue, isoch);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&queue->isoch_loading);
|
||||
|
||||
pthread_mutex_destroy(&queue->isoch_loading);
|
||||
|
@ -26,8 +26,10 @@
|
||||
#include <libudev.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/cmdline.h>
|
||||
|
||||
#include <freerdp/dvc.h>
|
||||
#include <freerdp/addin.h>
|
||||
#include <freerdp/utils/load_plugin.h>
|
||||
|
||||
#include "urbdrc_types.h"
|
||||
@ -56,7 +58,7 @@ static int func_hardware_id_format(IUDEVICE* pdev, char (*HardwareIds)[DEVICE_HA
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int func_compat_id_format(IUDEVICE *pdev, char (*CompatibilityIds)[DEVICE_COMPATIBILITY_ID_SIZE])
|
||||
static int func_compat_id_format(IUDEVICE* pdev, char (*CompatibilityIds)[DEVICE_COMPATIBILITY_ID_SIZE])
|
||||
{
|
||||
char str[DEVICE_COMPATIBILITY_ID_SIZE];
|
||||
int bDeviceClass, bDeviceSubClass, bDeviceProtocol;
|
||||
@ -262,8 +264,9 @@ static int urbdrc_process_channel_create(URBDRC_CHANNEL_CALLBACK* callback, char
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | CLIENT_CHANNEL_NOTIFICATION);
|
||||
|
||||
out_size = 24;
|
||||
out_data = (char *) malloc(out_size);
|
||||
out_data = (char*) malloc(out_size);
|
||||
memset(out_data, 0, out_size);
|
||||
|
||||
data_write_UINT32(out_data + 0, InterfaceId); /* interface id */
|
||||
data_write_UINT32(out_data + 4, MessageId); /* message id */
|
||||
data_write_UINT32(out_data + 8, CHANNEL_CREATED); /* function id */
|
||||
@ -287,8 +290,9 @@ static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, UINT32 M
|
||||
InterfaceId = ((STREAM_ID_PROXY<<30) | CLIENT_DEVICE_SINK);
|
||||
|
||||
out_size = 12;
|
||||
out_data = (char *) malloc(out_size);
|
||||
out_data = (char*) malloc(out_size);
|
||||
memset(out_data, 0, out_size);
|
||||
|
||||
data_write_UINT32(out_data + 0, InterfaceId); /* interface */
|
||||
data_write_UINT32(out_data + 4, MessageId); /* message id */
|
||||
data_write_UINT32(out_data + 8, ADD_VIRTUAL_CHANNEL); /* function id */
|
||||
@ -758,7 +762,7 @@ static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback
|
||||
transfer_data->udevman = urbdrc->udevman;
|
||||
transfer_data->urbdrc = urbdrc;
|
||||
transfer_data->cbSize = cbSize;
|
||||
transfer_data->pBuffer = (BYTE *)malloc((cbSize));
|
||||
transfer_data->pBuffer = (BYTE*) malloc((cbSize));
|
||||
|
||||
for (i = 0; i < (cbSize); i++)
|
||||
{
|
||||
@ -921,7 +925,7 @@ static int urbdrc_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
|
||||
{
|
||||
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*) pPlugin;
|
||||
IUDEVMAN* udevman = NULL;
|
||||
USB_SEARCHMAN * searchman = NULL;
|
||||
USB_SEARCHMAN* searchman = NULL;
|
||||
|
||||
LLOGLN(10, ("urbdrc_plugin_initialize:"));
|
||||
urbdrc->listener_callback = (URBDRC_LISTENER_CALLBACK*) malloc(sizeof(URBDRC_LISTENER_CALLBACK));
|
||||
@ -937,7 +941,7 @@ static int urbdrc_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
|
||||
urbdrc->searchman = searchman;
|
||||
|
||||
return pChannelMgr->CreateListener(pChannelMgr, "URBDRC", 0,
|
||||
(IWTSListenerCallback *) urbdrc->listener_callback, NULL);
|
||||
(IWTSListenerCallback*) urbdrc->listener_callback, NULL);
|
||||
}
|
||||
|
||||
static int urbdrc_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
@ -981,7 +985,7 @@ static int urbdrc_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void urbdrc_register_udevman_plugin(IWTSPlugin* pPlugin, IUDEVMAN* udevman)
|
||||
static void urbdrc_register_udevman_addin(IWTSPlugin* pPlugin, IUDEVMAN* udevman)
|
||||
{
|
||||
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*) pPlugin;
|
||||
|
||||
@ -996,32 +1000,19 @@ static void urbdrc_register_udevman_plugin(IWTSPlugin* pPlugin, IUDEVMAN* udevma
|
||||
urbdrc->udevman = udevman;
|
||||
}
|
||||
|
||||
static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP_PLUGIN_DATA* data)
|
||||
static int urbdrc_load_udevman_addin(IWTSPlugin* pPlugin, const char* name, ADDIN_ARGV* args)
|
||||
{
|
||||
char* fullname;
|
||||
PFREERDP_URBDRC_DEVICE_ENTRY entry;
|
||||
FREERDP_URBDRC_SERVICE_ENTRY_POINTS entryPoints;
|
||||
|
||||
if (strrchr(name, '.') != NULL)
|
||||
{
|
||||
entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(name, URBDRC_UDEVMAN_EXPORT_FUNC_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
fullname = malloc(strlen(name) + 8);
|
||||
ZeroMemory(fullname, strlen(name) + 8);
|
||||
strcpy(fullname, name);
|
||||
strcat(fullname, "_udevman");
|
||||
entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(fullname, URBDRC_UDEVMAN_EXPORT_FUNC_NAME);
|
||||
free(fullname);
|
||||
}
|
||||
entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_channel_addin_entry("urbdrc", (LPSTR) name, NULL, 0);
|
||||
|
||||
if (entry == NULL)
|
||||
return FALSE;
|
||||
|
||||
entryPoints.plugin = pPlugin;
|
||||
entryPoints.pRegisterUDEVMAN = urbdrc_register_udevman_plugin;
|
||||
entryPoints.plugin_data = data;
|
||||
entryPoints.pRegisterUDEVMAN = urbdrc_register_udevman_addin;
|
||||
entryPoints.args = args;
|
||||
|
||||
if (entry(&entryPoints) != 0)
|
||||
{
|
||||
@ -1032,17 +1023,57 @@ static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int urbdrc_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data)
|
||||
void urbdrc_set_subsystem(URBDRC_PLUGIN* urbdrc, char* subsystem)
|
||||
{
|
||||
BOOL ret;
|
||||
if (urbdrc->subsystem)
|
||||
free(urbdrc->subsystem);
|
||||
|
||||
if (data->data[0] && (strcmp((char*)data->data[0], "urbdrc") == 0 || strstr((char*) data->data[0], "/urbdrc.") != NULL))
|
||||
urbdrc->subsystem = _strdup(subsystem);
|
||||
}
|
||||
|
||||
COMMAND_LINE_ARGUMENT_A urbdrc_args[] =
|
||||
{
|
||||
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
|
||||
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
|
||||
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
|
||||
};
|
||||
|
||||
static void urbdrc_process_addin_args(URBDRC_PLUGIN* urbdrc, ADDIN_ARGV* args)
|
||||
{
|
||||
int status;
|
||||
DWORD flags;
|
||||
COMMAND_LINE_ARGUMENT_A* arg;
|
||||
|
||||
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
|
||||
|
||||
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
|
||||
urbdrc_args, flags, urbdrc, NULL, NULL);
|
||||
|
||||
arg = urbdrc_args;
|
||||
|
||||
do
|
||||
{
|
||||
ret = urbdrc_load_udevman_plugin(pPlugin, "libusb", data);
|
||||
return ret;
|
||||
}
|
||||
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
|
||||
continue;
|
||||
|
||||
return TRUE;
|
||||
CommandLineSwitchStart(arg)
|
||||
|
||||
CommandLineSwitchCase(arg, "dbg")
|
||||
{
|
||||
urbdrc_debug = 0;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sys")
|
||||
{
|
||||
urbdrc_set_subsystem(urbdrc, arg->Value);
|
||||
}
|
||||
CommandLineSwitchDefault(arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CommandLineSwitchEnd(arg)
|
||||
}
|
||||
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
||||
}
|
||||
|
||||
#ifdef STATIC_CHANNELS
|
||||
@ -1051,16 +1082,17 @@ static int urbdrc_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data
|
||||
|
||||
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
{
|
||||
int error = 0;
|
||||
int status = 0;
|
||||
ADDIN_ARGV* args;
|
||||
URBDRC_PLUGIN* urbdrc;
|
||||
RDP_PLUGIN_DATA* data;
|
||||
|
||||
urbdrc = (URBDRC_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "urbdrc");
|
||||
data = pEntryPoints->GetPluginData(pEntryPoints);
|
||||
args = pEntryPoints->GetPluginData(pEntryPoints);
|
||||
|
||||
if (urbdrc == NULL)
|
||||
{
|
||||
urbdrc = xnew(URBDRC_PLUGIN);
|
||||
urbdrc = (URBDRC_PLUGIN*) malloc(sizeof(URBDRC_PLUGIN));
|
||||
ZeroMemory(urbdrc, sizeof(URBDRC_PLUGIN));
|
||||
|
||||
urbdrc->iface.Initialize = urbdrc_plugin_initialize;
|
||||
urbdrc->iface.Connected = NULL;
|
||||
@ -1071,14 +1103,16 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
|
||||
urbdrc_debug = 10;
|
||||
|
||||
if (data->data[2] && strstr((char *)data->data[2], "debug"))
|
||||
urbdrc_debug = 0;
|
||||
|
||||
error = pEntryPoints->RegisterPlugin(pEntryPoints, "urbdrc", (IWTSPlugin *) urbdrc);
|
||||
status = pEntryPoints->RegisterPlugin(pEntryPoints, "urbdrc", (IWTSPlugin*) urbdrc);
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
urbdrc_process_plugin_data((IWTSPlugin*) urbdrc, data);
|
||||
if (status == 0)
|
||||
urbdrc_process_addin_args(urbdrc, args);
|
||||
|
||||
return error;
|
||||
if (!urbdrc->subsystem)
|
||||
urbdrc_set_subsystem(urbdrc, "libusb");
|
||||
|
||||
urbdrc_load_udevman_addin((IWTSPlugin*) urbdrc, urbdrc->subsystem, args);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -35,11 +35,12 @@ typedef struct _IUDEVICE IUDEVICE;
|
||||
typedef struct _IUDEVMAN IUDEVMAN;
|
||||
|
||||
#define BASIC_DEV_STATE_DEFINED(_arg, _type) \
|
||||
_type (*get_##_arg) (IUDEVICE *pdev); \
|
||||
void (*set_##_arg) (IUDEVICE *pdev, _type _arg)
|
||||
_type (*get_##_arg) (IUDEVICE* pdev); \
|
||||
void (*set_##_arg) (IUDEVICE* pdev, _type _arg)
|
||||
|
||||
#define BASIC_DEVMAN_STATE_DEFINED(_arg, _type) \
|
||||
_type (*get_##_arg) (IUDEVMAN *udevman); \
|
||||
void (*set_##_arg) (IUDEVMAN *udevman, _type _arg)
|
||||
_type (*get_##_arg) (IUDEVMAN* udevman); \
|
||||
void (*set_##_arg) (IUDEVMAN* udevman, _type _arg)
|
||||
|
||||
typedef struct _URBDRC_LISTENER_CALLBACK URBDRC_LISTENER_CALLBACK;
|
||||
|
||||
@ -74,6 +75,7 @@ struct _URBDRC_PLUGIN
|
||||
USB_SEARCHMAN* searchman;
|
||||
UINT32 first_channel_id;
|
||||
UINT32 vchannel_status;
|
||||
char* subsystem;
|
||||
};
|
||||
|
||||
#define URBDRC_UDEVMAN_EXPORT_FUNC_NAME "FreeRDPUDEVMANEntry"
|
||||
@ -84,7 +86,7 @@ struct _FREERDP_URBDRC_SERVICE_ENTRY_POINTS
|
||||
{
|
||||
IWTSPlugin* plugin;
|
||||
PREGISTERURBDRCSERVICE pRegisterUDEVMAN;
|
||||
RDP_PLUGIN_DATA* plugin_data;
|
||||
ADDIN_ARGV* args;
|
||||
};
|
||||
typedef struct _FREERDP_URBDRC_SERVICE_ENTRY_POINTS FREERDP_URBDRC_SERVICE_ENTRY_POINTS;
|
||||
typedef FREERDP_URBDRC_SERVICE_ENTRY_POINTS* PFREERDP_URBDRC_SERVICE_ENTRY_POINTS;
|
||||
@ -106,107 +108,75 @@ struct _TRANSFER_DATA
|
||||
struct _IUDEVICE
|
||||
{
|
||||
/* Transfer */
|
||||
int (*isoch_transfer) (IUDEVICE * idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress,
|
||||
UINT32 TransferFlags,
|
||||
int NoAck,
|
||||
UINT32 *ErrorCount,
|
||||
UINT32 *UrbdStatus,
|
||||
UINT32 *StartFrame,
|
||||
UINT32 NumberOfPackets,
|
||||
BYTE *IsoPacket,
|
||||
UINT32 *BufferSize,
|
||||
BYTE *Buffer,
|
||||
int Timeout);
|
||||
int (*isoch_transfer) (IUDEVICE* idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress, UINT32 TransferFlags, int NoAck, UINT32* ErrorCount,
|
||||
UINT32* UrbdStatus, UINT32* StartFrame, UINT32 NumberOfPackets,
|
||||
BYTE* IsoPacket, UINT32* BufferSize, BYTE* Buffer, int Timeout);
|
||||
|
||||
int (*control_transfer) (IUDEVICE * idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress,
|
||||
UINT32 TransferFlags,
|
||||
BYTE bmRequestType,
|
||||
BYTE Request,
|
||||
UINT16 Value,
|
||||
UINT16 Index,
|
||||
UINT32 *UrbdStatus,
|
||||
UINT32 *BufferSize,
|
||||
BYTE *Buffer,
|
||||
UINT32 Timeout);
|
||||
int (*control_transfer) (IUDEVICE* idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress, UINT32 TransferFlags, BYTE bmRequestType, BYTE Request, UINT16 Value,
|
||||
UINT16 Index, UINT32* UrbdStatus, UINT32* BufferSize, BYTE* Buffer, UINT32 Timeout);
|
||||
|
||||
int (*bulk_or_interrupt_transfer) (IUDEVICE * idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress,
|
||||
UINT32 TransferFlags,
|
||||
UINT32 *UsbdStatus,
|
||||
UINT32 *BufferSize,
|
||||
BYTE *Buffer,
|
||||
UINT32 Timeout);
|
||||
int (*bulk_or_interrupt_transfer) (IUDEVICE* idev, UINT32 RequestId, UINT32 EndpointAddress,
|
||||
UINT32 TransferFlags, UINT32* UsbdStatus, UINT32* BufferSize, BYTE* Buffer, UINT32 Timeout);
|
||||
|
||||
int (*select_configuration) (IUDEVICE* idev, UINT32 bConfigurationValue);
|
||||
|
||||
int (*select_configuration) (IUDEVICE * idev, UINT32 bConfigurationValue);
|
||||
|
||||
int (*select_interface) (IUDEVICE * idev, BYTE InterfaceNumber,
|
||||
int (*select_interface) (IUDEVICE* idev, BYTE InterfaceNumber,
|
||||
BYTE AlternateSetting);
|
||||
|
||||
int (*control_pipe_request) (IUDEVICE * idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress,
|
||||
UINT32 *UsbdStatus,
|
||||
int command);
|
||||
int (*control_pipe_request) (IUDEVICE* idev, UINT32 RequestId,
|
||||
UINT32 EndpointAddress, UINT32* UsbdStatus, int command);
|
||||
|
||||
int (*control_query_device_text) (IUDEVICE * idev, UINT32 TextType,
|
||||
UINT32 LocaleId,
|
||||
UINT32 *BufferSize,
|
||||
BYTE * Buffer);
|
||||
int (*control_query_device_text) (IUDEVICE* idev, UINT32 TextType,
|
||||
UINT32 LocaleId, UINT32*BufferSize, BYTE* Buffer);
|
||||
|
||||
int (*os_feature_descriptor_request) (IUDEVICE * idev, UINT32 RequestId,
|
||||
BYTE Recipient,
|
||||
BYTE InterfaceNumber,
|
||||
BYTE Ms_PageIndex,
|
||||
UINT16 Ms_featureDescIndex,
|
||||
UINT32 * UsbdStatus,
|
||||
UINT32 * BufferSize,
|
||||
BYTE* Buffer,
|
||||
int Timeout);
|
||||
int (*os_feature_descriptor_request) (IUDEVICE* idev, UINT32 RequestId, BYTE Recipient,
|
||||
BYTE InterfaceNumber, BYTE Ms_PageIndex, UINT16 Ms_featureDescIndex, UINT32* UsbdStatus,
|
||||
UINT32* BufferSize, BYTE* Buffer, int Timeout);
|
||||
|
||||
void (*cancel_all_transfer_request) (IUDEVICE * idev);
|
||||
void (*cancel_all_transfer_request) (IUDEVICE* idev);
|
||||
|
||||
int (*cancel_transfer_request) (IUDEVICE * idev, UINT32 RequestId);
|
||||
int (*cancel_transfer_request) (IUDEVICE* idev, UINT32 RequestId);
|
||||
|
||||
int (*query_device_descriptor) (IUDEVICE * idev, int offset);
|
||||
int (*query_device_descriptor) (IUDEVICE* idev, int offset);
|
||||
|
||||
void (*detach_kernel_driver) (IUDEVICE * idev);
|
||||
void (*detach_kernel_driver) (IUDEVICE* idev);
|
||||
|
||||
void (*attach_kernel_driver) (IUDEVICE * idev);
|
||||
void (*attach_kernel_driver) (IUDEVICE* idev);
|
||||
|
||||
int (*wait_action_completion) (IUDEVICE * idev);
|
||||
int (*wait_action_completion) (IUDEVICE* idev);
|
||||
|
||||
void (*push_action) (IUDEVICE * idev);
|
||||
void (*push_action) (IUDEVICE* idev);
|
||||
|
||||
void (*complete_action) (IUDEVICE * idev);
|
||||
void (*complete_action) (IUDEVICE* idev);
|
||||
|
||||
/* Wait for 5 sec */
|
||||
int (*wait_for_detach) (IUDEVICE * idev);
|
||||
int (*wait_for_detach) (IUDEVICE* idev);
|
||||
|
||||
/* FIXME: Currently this is a way of stupid, SHOULD to improve it.
|
||||
* Isochronous transfer must to FIFO */
|
||||
void (*lock_fifo_isoch) (IUDEVICE * idev);
|
||||
void (*unlock_fifo_isoch) (IUDEVICE * idev);
|
||||
void (*lock_fifo_isoch) (IUDEVICE* idev);
|
||||
void (*unlock_fifo_isoch) (IUDEVICE* idev);
|
||||
|
||||
int (*query_device_port_status) (IUDEVICE * idev, UINT32 *UsbdStatus,
|
||||
UINT32 * BufferSize,
|
||||
BYTE * Buffer);
|
||||
int (*query_device_port_status) (IUDEVICE* idev, UINT32 *UsbdStatus,
|
||||
UINT32* BufferSize,
|
||||
BYTE* Buffer);
|
||||
|
||||
int (*request_queue_is_none) (IUDEVICE * idev);
|
||||
int (*request_queue_is_none) (IUDEVICE* idev);
|
||||
|
||||
MSUSB_CONFIG_DESCRIPTOR * (*complete_msconfig_setup) (IUDEVICE * idev,
|
||||
MSUSB_CONFIG_DESCRIPTOR * MsConfig);
|
||||
MSUSB_CONFIG_DESCRIPTOR* (*complete_msconfig_setup) (IUDEVICE* idev,
|
||||
MSUSB_CONFIG_DESCRIPTOR* MsConfig);
|
||||
/* Basic state */
|
||||
int (*isCompositeDevice) (IUDEVICE * idev);
|
||||
int (*isSigToEnd) (IUDEVICE * idev);
|
||||
int (*isExist) (IUDEVICE * idev);
|
||||
int (*isAlreadySend) (IUDEVICE * idev);
|
||||
int (*isChannelClosed) (IUDEVICE * idev);
|
||||
void (*SigToEnd) (IUDEVICE * idev);
|
||||
void (*setAlreadySend) (IUDEVICE * idev);
|
||||
void (*setChannelClosed) (IUDEVICE * idev);
|
||||
char *(*getPath) (IUDEVICE * idev);
|
||||
int (*isCompositeDevice) (IUDEVICE* idev);
|
||||
int (*isSigToEnd) (IUDEVICE* idev);
|
||||
int (*isExist) (IUDEVICE* idev);
|
||||
int (*isAlreadySend) (IUDEVICE* idev);
|
||||
int (*isChannelClosed) (IUDEVICE* idev);
|
||||
void (*SigToEnd) (IUDEVICE* idev);
|
||||
void (*setAlreadySend) (IUDEVICE* idev);
|
||||
void (*setChannelClosed) (IUDEVICE* idev);
|
||||
char *(*getPath) (IUDEVICE* idev);
|
||||
|
||||
BASIC_DEV_STATE_DEFINED(channel_id, UINT32);
|
||||
BASIC_DEV_STATE_DEFINED(UsbDevice, UINT32);
|
||||
@ -214,12 +184,12 @@ struct _IUDEVICE
|
||||
BASIC_DEV_STATE_DEFINED(bus_number, UINT16);
|
||||
BASIC_DEV_STATE_DEFINED(dev_number, UINT16);
|
||||
BASIC_DEV_STATE_DEFINED(port_number, int);
|
||||
BASIC_DEV_STATE_DEFINED(isoch_queue, void *);
|
||||
BASIC_DEV_STATE_DEFINED(MsConfig, MSUSB_CONFIG_DESCRIPTOR *);
|
||||
BASIC_DEV_STATE_DEFINED(isoch_queue, void*);
|
||||
BASIC_DEV_STATE_DEFINED(MsConfig, MSUSB_CONFIG_DESCRIPTOR*);
|
||||
|
||||
BASIC_DEV_STATE_DEFINED(p_udev, void *);
|
||||
BASIC_DEV_STATE_DEFINED(p_prev, void *);
|
||||
BASIC_DEV_STATE_DEFINED(p_next, void *);
|
||||
BASIC_DEV_STATE_DEFINED(p_udev, void*);
|
||||
BASIC_DEV_STATE_DEFINED(p_prev, void*);
|
||||
BASIC_DEV_STATE_DEFINED(p_next, void*);
|
||||
|
||||
/* Control semaphore or mutex lock */
|
||||
|
||||
@ -228,36 +198,32 @@ struct _IUDEVICE
|
||||
struct _IUDEVMAN
|
||||
{
|
||||
/* Standard */
|
||||
void (*free) (IUDEVMAN *idevman);
|
||||
void (*free) (IUDEVMAN* idevman);
|
||||
|
||||
/* Manage devices */
|
||||
void (*rewind) (IUDEVMAN *idevman);
|
||||
int (*has_next) (IUDEVMAN *idevman);
|
||||
int (*unregister_udevice) (IUDEVMAN* idevman, int bus_number,
|
||||
int dev_number);
|
||||
int (*register_udevice) (IUDEVMAN* idevman, int bus_number,
|
||||
int dev_number,
|
||||
int UsbDevice,
|
||||
UINT16 idVendor,
|
||||
UINT16 idProduct,
|
||||
int flag);
|
||||
IUDEVICE *(*get_next) (IUDEVMAN *idevman);
|
||||
IUDEVICE *(*get_udevice_by_UsbDevice) (IUDEVMAN * idevman,
|
||||
UINT32 UsbDevice);
|
||||
IUDEVICE *(*get_udevice_by_UsbDevice_try_again) (IUDEVMAN * idevman,
|
||||
UINT32 UsbDevice);
|
||||
void (*rewind) (IUDEVMAN* idevman);
|
||||
int (*has_next) (IUDEVMAN* idevman);
|
||||
int (*unregister_udevice) (IUDEVMAN* idevman, int bus_number, int dev_number);
|
||||
int (*register_udevice) (IUDEVMAN* idevman, int bus_number,
|
||||
int dev_number, int UsbDevice, UINT16 idVendor, UINT16 idProduct, int flag);
|
||||
IUDEVICE *(*get_next) (IUDEVMAN* idevman);
|
||||
IUDEVICE *(*get_udevice_by_UsbDevice) (IUDEVMAN* idevman, UINT32 UsbDevice);
|
||||
IUDEVICE *(*get_udevice_by_UsbDevice_try_again) (IUDEVMAN* idevman, UINT32 UsbDevice);
|
||||
|
||||
/* Extension */
|
||||
int (*check_device_exist_by_id) (IUDEVMAN * idevman, UINT16 idVendor,
|
||||
UINT16 idProduct);
|
||||
int (*isAutoAdd) (IUDEVMAN * idevman);
|
||||
int (*check_device_exist_by_id) (IUDEVMAN* idevman, UINT16 idVendor, UINT16 idProduct);
|
||||
int (*isAutoAdd) (IUDEVMAN* idevman);
|
||||
|
||||
/* Basic state */
|
||||
BASIC_DEVMAN_STATE_DEFINED(defUsbDevice, UINT32);
|
||||
BASIC_DEVMAN_STATE_DEFINED(device_num, int);
|
||||
BASIC_DEVMAN_STATE_DEFINED(sem_timeout, int);
|
||||
|
||||
/* control semaphore or mutex lock */
|
||||
void (*loading_lock) (IUDEVMAN * idevman);
|
||||
void (*loading_unlock) (IUDEVMAN * idevman);
|
||||
void (*push_urb) (IUDEVMAN * idevman);
|
||||
void (*wait_urb) (IUDEVMAN * idevman);
|
||||
void (*loading_lock) (IUDEVMAN* idevman);
|
||||
void (*loading_unlock) (IUDEVMAN* idevman);
|
||||
void (*push_urb) (IUDEVMAN* idevman);
|
||||
void (*wait_urb) (IUDEVMAN* idevman);
|
||||
};
|
||||
|
||||
#endif /* __URBDRC_MAIN_H */
|
||||
|
@ -36,10 +36,12 @@ endif()
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
set(${MODULE_PREFIX}_LIBS
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
set(${MODULE_PREFIX}_LIBS
|
||||
dbus-glib-1
|
||||
usb-1.0
|
||||
pthread
|
||||
udev)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/cmdline.h>
|
||||
|
||||
#include <freerdp/addin.h>
|
||||
|
||||
#include "urbdrc_types.h"
|
||||
#include "urbdrc_main.h"
|
||||
|
||||
@ -61,19 +66,20 @@ struct _UDEVMAN
|
||||
int sem_timeout;
|
||||
|
||||
pthread_mutex_t devman_loading;
|
||||
sem_t sem_urb_lock;
|
||||
sem_t sem_urb_lock;
|
||||
};
|
||||
typedef UDEVMAN * PUDEVMAN;
|
||||
typedef UDEVMAN* PUDEVMAN;
|
||||
|
||||
static void udevman_rewind(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
udevman->idev = udevman->head;
|
||||
}
|
||||
|
||||
static int udevman_has_next(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
|
||||
if (udevman->idev == NULL)
|
||||
return 0;
|
||||
else
|
||||
@ -82,60 +88,63 @@ static int udevman_has_next(IUDEVMAN* idevman)
|
||||
|
||||
static IUDEVICE* udevman_get_next(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN*) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
IUDEVICE* pdev;
|
||||
|
||||
pdev = udevman->idev;
|
||||
udevman->idev = (IUDEVICE*) ((UDEVICE*)udevman->idev)->next;
|
||||
udevman->idev = (IUDEVICE*) ((UDEVICE*) udevman->idev)->next;
|
||||
|
||||
return pdev;
|
||||
}
|
||||
|
||||
static IUDEVICE* udevman_get_udevice_by_addr(IUDEVMAN* idevman, int bus_number, int dev_number)
|
||||
{
|
||||
IUDEVICE * pdev;
|
||||
IUDEVICE* pdev;
|
||||
|
||||
idevman->loading_lock(idevman);
|
||||
idevman->rewind (idevman);
|
||||
while (idevman->has_next (idevman))
|
||||
idevman->rewind(idevman);
|
||||
|
||||
while (idevman->has_next(idevman))
|
||||
{
|
||||
pdev = idevman->get_next (idevman);
|
||||
if (pdev->get_bus_number(pdev) == bus_number &&
|
||||
pdev->get_dev_number(pdev) == dev_number)
|
||||
pdev = idevman->get_next(idevman);
|
||||
|
||||
if ((pdev->get_bus_number(pdev) == bus_number) && (pdev->get_dev_number(pdev) == dev_number))
|
||||
{
|
||||
idevman->loading_unlock(idevman);
|
||||
return pdev;
|
||||
}
|
||||
}
|
||||
|
||||
idevman->loading_unlock(idevman);
|
||||
LLOGLN(libusb_debug, ("%s: bus:%d dev:%d not exist in udevman",
|
||||
__func__, bus_number, dev_number));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_number,
|
||||
int UsbDevice,
|
||||
UINT16 idVendor,
|
||||
UINT16 idProduct,
|
||||
int flag)
|
||||
int UsbDevice, UINT16 idVendor, UINT16 idProduct, int flag)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
IUDEVICE * pdev = NULL;
|
||||
IUDEVICE ** devArray;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
IUDEVICE* pdev = NULL;
|
||||
IUDEVICE** devArray;
|
||||
int i, num, addnum = 0;
|
||||
|
||||
pdev = (IUDEVICE *)udevman_get_udevice_by_addr(idevman, bus_number, dev_number);
|
||||
pdev = (IUDEVICE*) udevman_get_udevice_by_addr(idevman, bus_number, dev_number);
|
||||
|
||||
if (pdev != NULL)
|
||||
return 0;
|
||||
|
||||
if (flag == UDEVMAN_FLAG_ADD_BY_ADDR)
|
||||
{
|
||||
pdev = udev_new_by_addr(bus_number, dev_number);
|
||||
|
||||
if (pdev == NULL)
|
||||
return 0;
|
||||
|
||||
pdev->set_UsbDevice(pdev, UsbDevice);
|
||||
idevman->loading_lock(idevman);
|
||||
|
||||
if (udevman->head == NULL)
|
||||
{
|
||||
/* linked list is empty */
|
||||
@ -149,6 +158,7 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
|
||||
pdev->set_p_prev(pdev, udevman->tail);
|
||||
udevman->tail = pdev;
|
||||
}
|
||||
|
||||
udevman->device_num += 1;
|
||||
idevman->loading_unlock(idevman);
|
||||
}
|
||||
@ -157,13 +167,13 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
|
||||
addnum = 0;
|
||||
/* register all device that match pid vid */
|
||||
num = udev_new_by_id(idVendor, idProduct, &devArray);
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
pdev = devArray[i];
|
||||
|
||||
if (udevman_get_udevice_by_addr(idevman,
|
||||
pdev->get_bus_number(pdev),
|
||||
pdev->get_dev_number(pdev))
|
||||
!= NULL)
|
||||
pdev->get_bus_number(pdev), pdev->get_dev_number(pdev)) != NULL)
|
||||
{
|
||||
zfree(pdev);
|
||||
continue;
|
||||
@ -171,6 +181,7 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
|
||||
|
||||
pdev->set_UsbDevice(pdev, UsbDevice);
|
||||
idevman->loading_lock(idevman);
|
||||
|
||||
if (udevman->head == NULL)
|
||||
{
|
||||
/* linked list is empty */
|
||||
@ -184,10 +195,12 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
|
||||
pdev->set_p_prev(pdev, udevman->tail);
|
||||
udevman->tail = pdev;
|
||||
}
|
||||
|
||||
udevman->device_num += 1;
|
||||
idevman->loading_unlock(idevman);
|
||||
addnum++;
|
||||
}
|
||||
|
||||
zfree(devArray);
|
||||
return addnum;
|
||||
}
|
||||
@ -196,23 +209,24 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
|
||||
printf("udevman_register_udevice: function error!!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int udevman_unregister_udevice(IUDEVMAN* idevman, int bus_number, int dev_number)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
UDEVICE * pdev, * dev;
|
||||
int ret = 0, err = 0;
|
||||
|
||||
dev = (UDEVICE *)udevman_get_udevice_by_addr(idevman, bus_number, dev_number);
|
||||
dev = (UDEVICE*) udevman_get_udevice_by_addr(idevman, bus_number, dev_number);
|
||||
|
||||
idevman->loading_lock(idevman);
|
||||
idevman->rewind(idevman);
|
||||
|
||||
while (idevman->has_next(idevman) != 0)
|
||||
{
|
||||
pdev = (UDEVICE *)idevman->get_next(idevman);
|
||||
pdev = (UDEVICE*) idevman->get_next(idevman);
|
||||
|
||||
if (pdev == dev) /* device exists */
|
||||
{
|
||||
@ -280,12 +294,11 @@ static int udevman_unregister_udevice(IUDEVMAN* idevman, int bus_number, int dev
|
||||
return 1; /* unregistration successful */
|
||||
}
|
||||
|
||||
|
||||
/* if we reach this point, the device wasn't found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void udevman_parse_device_addr (char *str, int *id1, int *id2, char sign)
|
||||
static void udevman_parse_device_addr(char *str, int *id1, int *id2, char sign)
|
||||
{
|
||||
char s1[8], *s2;
|
||||
memset(s1, 0, sizeof(s1));
|
||||
@ -297,9 +310,9 @@ static void udevman_parse_device_addr (char *str, int *id1, int *id2, char sign)
|
||||
*id2 = atoi(s2);
|
||||
}
|
||||
|
||||
static void udevman_parse_device_pid_vid (char *str, int *id1, int *id2, char sign)
|
||||
static void udevman_parse_device_pid_vid(char *str, int *id1, int *id2, char sign)
|
||||
{
|
||||
char s1[8], *s2;
|
||||
char s1[8], *s2;
|
||||
memset(s1, 0, sizeof(s1));
|
||||
|
||||
s2 = (strchr(str, sign)) + 1;
|
||||
@ -319,102 +332,108 @@ static int udevman_check_device_exist_by_id(IUDEVMAN* idevman, UINT16 idVendor,
|
||||
|
||||
static int udevman_is_auto_add(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
return (udevman->flags & UDEVMAN_FLAG_ADD_BY_AUTO) ? 1 : 0;
|
||||
}
|
||||
|
||||
static IUDEVICE* udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN* idevman, UINT32 UsbDevice)
|
||||
{
|
||||
UDEVICE * pdev;
|
||||
UDEVICE* pdev;
|
||||
idevman->loading_lock(idevman);
|
||||
idevman->rewind (idevman);
|
||||
while (idevman->has_next (idevman))
|
||||
idevman->rewind(idevman);
|
||||
|
||||
while (idevman->has_next(idevman))
|
||||
{
|
||||
pdev = (UDEVICE *)idevman->get_next (idevman);
|
||||
pdev = (UDEVICE*) idevman->get_next(idevman);
|
||||
|
||||
if (pdev->UsbDevice == UsbDevice)
|
||||
{
|
||||
idevman->loading_unlock(idevman);
|
||||
return (IUDEVICE *)pdev;
|
||||
return (IUDEVICE*) pdev;
|
||||
}
|
||||
}
|
||||
|
||||
idevman->loading_unlock(idevman);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static IUDEVICE* udevman_get_udevice_by_UsbDevice(IUDEVMAN* idevman, UINT32 UsbDevice)
|
||||
{
|
||||
UDEVICE * pdev;
|
||||
UDEVICE* pdev;
|
||||
idevman->loading_lock(idevman);
|
||||
idevman->rewind (idevman);
|
||||
while (idevman->has_next (idevman))
|
||||
idevman->rewind(idevman);
|
||||
|
||||
while (idevman->has_next(idevman))
|
||||
{
|
||||
pdev = (UDEVICE *)idevman->get_next (idevman);
|
||||
pdev = (UDEVICE*) idevman->get_next(idevman);
|
||||
|
||||
if (pdev->UsbDevice == UsbDevice)
|
||||
{
|
||||
idevman->loading_unlock(idevman);
|
||||
return (IUDEVICE *)pdev;
|
||||
return (IUDEVICE*) pdev;
|
||||
}
|
||||
}
|
||||
|
||||
idevman->loading_unlock(idevman);
|
||||
|
||||
/* try again */
|
||||
pdev = (UDEVICE *)idevman->get_udevice_by_UsbDevice_try_again(idevman, UsbDevice);
|
||||
|
||||
pdev = (UDEVICE*) idevman->get_udevice_by_UsbDevice_try_again(idevman, UsbDevice);
|
||||
|
||||
if (pdev)
|
||||
{
|
||||
return (IUDEVICE *)pdev;
|
||||
return (IUDEVICE*) pdev;
|
||||
}
|
||||
|
||||
LLOGLN(libusb_debug, ("udevman_get_udevice_by_UsbDevice: 0x%x ERROR!!\n",
|
||||
UsbDevice));
|
||||
LLOGLN(libusb_debug, ("udevman_get_udevice_by_UsbDevice: 0x%x ERROR!!\n", UsbDevice));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void udevman_loading_lock(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
pthread_mutex_lock(&udevman->devman_loading);
|
||||
}
|
||||
|
||||
static void udevman_loading_unlock(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
pthread_mutex_unlock(&udevman->devman_loading);
|
||||
}
|
||||
|
||||
|
||||
static void udevman_wait_urb(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
sem_wait(&udevman->sem_urb_lock);
|
||||
}
|
||||
|
||||
|
||||
static void udevman_push_urb(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
sem_post(&udevman->sem_urb_lock);
|
||||
}
|
||||
|
||||
|
||||
BASIC_STATE_FUNC_DEFINED(defUsbDevice, UINT32)
|
||||
BASIC_STATE_FUNC_DEFINED(device_num, int)
|
||||
BASIC_STATE_FUNC_DEFINED(sem_timeout, int)
|
||||
|
||||
|
||||
static void udevman_free(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN * udevman = (UDEVMAN *) idevman;
|
||||
UDEVMAN* udevman = (UDEVMAN*) idevman;
|
||||
|
||||
pthread_mutex_destroy(&udevman->devman_loading);
|
||||
sem_destroy(&udevman->sem_urb_lock);
|
||||
|
||||
libusb_exit(NULL);
|
||||
|
||||
/* free udevman */
|
||||
|
||||
if (udevman)
|
||||
zfree(udevman);
|
||||
}
|
||||
|
||||
|
||||
static void udevman_load_interface(UDEVMAN * udevman)
|
||||
{
|
||||
/* standard */
|
||||
@ -442,25 +461,123 @@ static void udevman_load_interface(UDEVMAN * udevman)
|
||||
udevman->iface.wait_urb = udevman_wait_urb;
|
||||
}
|
||||
|
||||
COMMAND_LINE_ARGUMENT_A urbdrc_udevman_args[] =
|
||||
{
|
||||
{ "dbg", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "debug" },
|
||||
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<devices>", NULL, NULL, -1, NULL, "device list" },
|
||||
{ "id", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_VID_PID" },
|
||||
{ "addr", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_ADDR" },
|
||||
{ "auto", COMMAND_LINE_VALUE_FLAG, "", NULL, BoolValueFalse, -1, NULL, "FLAG_ADD_BY_AUTO" },
|
||||
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
|
||||
};
|
||||
|
||||
static void urbdrc_udevman_register_devices(UDEVMAN* udevman, char* devices)
|
||||
{
|
||||
char* token;
|
||||
int idVendor;
|
||||
int idProduct;
|
||||
int bus_number;
|
||||
int dev_number;
|
||||
int success = 0;
|
||||
char hardware_id[16];
|
||||
char* default_devices = "id";
|
||||
UINT32 UsbDevice = BASE_USBDEVICE_NUM;
|
||||
|
||||
if (!devices)
|
||||
devices = default_devices;
|
||||
|
||||
/* register all usb devices */
|
||||
token = strtok(devices, "#");
|
||||
|
||||
while (token)
|
||||
{
|
||||
bus_number = 0;
|
||||
dev_number = 0;
|
||||
idVendor = 0;
|
||||
idProduct = 0;
|
||||
|
||||
strcpy(hardware_id, token);
|
||||
token = strtok(NULL, "#");
|
||||
|
||||
if (udevman->flags & UDEVMAN_FLAG_ADD_BY_VID_PID)
|
||||
{
|
||||
udevman_parse_device_pid_vid(hardware_id, &idVendor, &idProduct, '_');
|
||||
success = udevman->iface.register_udevice((IUDEVMAN*) udevman,
|
||||
0, 0, UsbDevice, (UINT16) idVendor, (UINT16) idProduct, UDEVMAN_FLAG_ADD_BY_VID_PID);
|
||||
}
|
||||
else if (udevman->flags & UDEVMAN_FLAG_ADD_BY_ADDR)
|
||||
{
|
||||
udevman_parse_device_addr(hardware_id, &bus_number, &dev_number, '_');
|
||||
|
||||
success = udevman->iface.register_udevice((IUDEVMAN*) udevman,
|
||||
bus_number, dev_number, UsbDevice, 0, 0, UDEVMAN_FLAG_ADD_BY_ADDR);
|
||||
}
|
||||
|
||||
if (success)
|
||||
UsbDevice++;
|
||||
}
|
||||
|
||||
udevman->defUsbDevice = UsbDevice;
|
||||
}
|
||||
|
||||
static void urbdrc_udevman_parse_addin_args(UDEVMAN* udevman, ADDIN_ARGV* args)
|
||||
{
|
||||
int status;
|
||||
DWORD flags;
|
||||
COMMAND_LINE_ARGUMENT_A* arg;
|
||||
|
||||
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
|
||||
|
||||
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
|
||||
urbdrc_udevman_args, flags, udevman, NULL, NULL);
|
||||
|
||||
arg = urbdrc_udevman_args;
|
||||
|
||||
do
|
||||
{
|
||||
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
|
||||
continue;
|
||||
|
||||
CommandLineSwitchStart(arg)
|
||||
|
||||
CommandLineSwitchCase(arg, "dbg")
|
||||
{
|
||||
urbdrc_debug = 0;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "dev")
|
||||
{
|
||||
urbdrc_udevman_register_devices(udevman, arg->Value);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "id")
|
||||
{
|
||||
udevman->flags = UDEVMAN_FLAG_ADD_BY_VID_PID;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "addr")
|
||||
{
|
||||
udevman->flags = UDEVMAN_FLAG_ADD_BY_ADDR;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "auto")
|
||||
{
|
||||
udevman->flags |= UDEVMAN_FLAG_ADD_BY_AUTO;
|
||||
}
|
||||
CommandLineSwitchDefault(arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CommandLineSwitchEnd(arg)
|
||||
}
|
||||
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
||||
}
|
||||
|
||||
int FreeRDPUDEVMANEntry(PFREERDP_URBDRC_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
UDEVMAN* udevman;
|
||||
RDP_PLUGIN_DATA * plugin_data = pEntryPoints->plugin_data;
|
||||
UINT32 UsbDevice = BASE_USBDEVICE_NUM;
|
||||
char * token;
|
||||
char * message = "id";
|
||||
char hardware_id[16];
|
||||
int idVendor;
|
||||
int idProduct;
|
||||
int bus_number;
|
||||
int dev_number;
|
||||
int success = 0;
|
||||
ADDIN_ARGV* args = pEntryPoints->args;
|
||||
|
||||
libusb_init(NULL);
|
||||
|
||||
udevman = (PUDEVMAN)malloc(sizeof(UDEVMAN));
|
||||
udevman = (PUDEVMAN) malloc(sizeof(UDEVMAN));
|
||||
udevman->device_num = 0;
|
||||
udevman->idev = NULL;
|
||||
udevman->head = NULL;
|
||||
@ -474,66 +591,11 @@ int FreeRDPUDEVMANEntry(PFREERDP_URBDRC_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
/* load usb device service management */
|
||||
udevman_load_interface(udevman);
|
||||
|
||||
/* set debug flag, to enable Debug message for usb data transfer*/
|
||||
if (plugin_data->data[2])
|
||||
message = (char *)plugin_data->data[2];
|
||||
/* set debug flag, to enable Debug message for usb data transfer */
|
||||
|
||||
if (strstr(message, "id"))
|
||||
udevman->flags = UDEVMAN_FLAG_ADD_BY_VID_PID;
|
||||
else if (strstr(message, "addr"))
|
||||
udevman->flags = UDEVMAN_FLAG_ADD_BY_ADDR;
|
||||
|
||||
if (strstr(message, "auto"))
|
||||
udevman->flags |= UDEVMAN_FLAG_ADD_BY_AUTO;
|
||||
libusb_debug = 10;
|
||||
if (strstr(message, "debug"))
|
||||
{
|
||||
libusb_debug = 0;
|
||||
udevman->flags |= UDEVMAN_FLAG_DEBUG;
|
||||
}
|
||||
/* register all usb device */
|
||||
token = strtok((char *)plugin_data->data[1], "#");
|
||||
while (token)
|
||||
{
|
||||
bus_number = 0;
|
||||
dev_number = 0;
|
||||
idVendor = 0;
|
||||
idProduct = 0;
|
||||
|
||||
strcpy(hardware_id, token);
|
||||
token = strtok(NULL, "#");
|
||||
if (udevman->flags & UDEVMAN_FLAG_ADD_BY_VID_PID)
|
||||
{
|
||||
udevman_parse_device_pid_vid(hardware_id, &idVendor,
|
||||
&idProduct,
|
||||
'_');
|
||||
success = udevman->iface.register_udevice((IUDEVMAN *)udevman,
|
||||
0,
|
||||
0,
|
||||
UsbDevice,
|
||||
(UINT16) idVendor,
|
||||
(UINT16) idProduct,
|
||||
UDEVMAN_FLAG_ADD_BY_VID_PID);
|
||||
}
|
||||
else if (udevman->flags & UDEVMAN_FLAG_ADD_BY_ADDR)
|
||||
{
|
||||
udevman_parse_device_addr(hardware_id, &bus_number,
|
||||
&dev_number,
|
||||
'_');
|
||||
success = udevman->iface.register_udevice((IUDEVMAN *)udevman,
|
||||
bus_number,
|
||||
dev_number,
|
||||
UsbDevice,
|
||||
0,
|
||||
0,
|
||||
UDEVMAN_FLAG_ADD_BY_ADDR);
|
||||
}
|
||||
|
||||
if (success)
|
||||
UsbDevice++;
|
||||
}
|
||||
|
||||
udevman->defUsbDevice = UsbDevice;
|
||||
urbdrc_udevman_parse_addin_args(udevman, args);
|
||||
|
||||
pEntryPoints->pRegisterUDEVMAN(pEntryPoints->plugin, (IUDEVMAN*) udevman);
|
||||
|
||||
|
@ -43,12 +43,11 @@ int request_queue_has_next(REQUEST_QUEUE* queue)
|
||||
}
|
||||
|
||||
TRANSFER_REQUEST* request_queue_register_request(REQUEST_QUEUE* queue, UINT32 RequestId,
|
||||
struct libusb_transfer * transfer,
|
||||
BYTE endpoint)
|
||||
struct libusb_transfer* transfer, BYTE endpoint)
|
||||
{
|
||||
TRANSFER_REQUEST* request;
|
||||
TRANSFER_REQUEST* request;
|
||||
|
||||
request = (TRANSFER_REQUEST*)malloc(sizeof(TRANSFER_REQUEST));
|
||||
request = (TRANSFER_REQUEST*) malloc(sizeof(TRANSFER_REQUEST));
|
||||
|
||||
request->prev = NULL;
|
||||
request->next = NULL;
|
||||
@ -57,7 +56,9 @@ TRANSFER_REQUEST* request_queue_register_request(REQUEST_QUEUE* queue, UINT32 Re
|
||||
request->transfer = transfer;
|
||||
request->endpoint = endpoint;
|
||||
request->submit = 0;
|
||||
|
||||
pthread_mutex_lock(&queue->request_loading);
|
||||
|
||||
if (queue->head == NULL)
|
||||
{
|
||||
/* linked queue is empty */
|
||||
@ -67,22 +68,24 @@ TRANSFER_REQUEST* request_queue_register_request(REQUEST_QUEUE* queue, UINT32 Re
|
||||
else
|
||||
{
|
||||
/* append data to the end of the linked queue */
|
||||
queue->tail->next = (void*)request;
|
||||
request->prev = (void*)queue->tail;
|
||||
queue->tail->next = (void*) request;
|
||||
request->prev = (void*) queue->tail;
|
||||
queue->tail = request;
|
||||
}
|
||||
|
||||
queue->request_num += 1;
|
||||
pthread_mutex_unlock(&queue->request_loading);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
void request_queue_rewind(REQUEST_QUEUE *queue)
|
||||
void request_queue_rewind(REQUEST_QUEUE* queue)
|
||||
{
|
||||
queue->ireq = queue->head;
|
||||
}
|
||||
|
||||
/* Get first*/
|
||||
TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, BYTE ep)
|
||||
TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE* queue, BYTE ep)
|
||||
{
|
||||
TRANSFER_REQUEST * request;
|
||||
pthread_mutex_lock(&queue->request_loading);
|
||||
@ -101,7 +104,7 @@ TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, BY
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int request_queue_unregister_request(REQUEST_QUEUE *queue, UINT32 RequestId)
|
||||
int request_queue_unregister_request(REQUEST_QUEUE* queue, UINT32 RequestId)
|
||||
{
|
||||
TRANSFER_REQUEST *request, *request_temp;
|
||||
pthread_mutex_lock(&queue->request_loading);
|
||||
@ -110,27 +113,28 @@ int request_queue_unregister_request(REQUEST_QUEUE *queue, UINT32 RequestId)
|
||||
while (queue->has_next(queue) != 0)
|
||||
{
|
||||
request = queue->get_next(queue);
|
||||
|
||||
if (request->RequestId == RequestId)
|
||||
{
|
||||
|
||||
if (request->prev != NULL)
|
||||
{
|
||||
request_temp = (TRANSFER_REQUEST*)request->prev;
|
||||
request_temp->next = (TRANSFER_REQUEST*)request->next;
|
||||
request_temp = (TRANSFER_REQUEST*) request->prev;
|
||||
request_temp->next = (TRANSFER_REQUEST*) request->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue->head = (TRANSFER_REQUEST*)request->next;
|
||||
queue->head = (TRANSFER_REQUEST*) request->next;
|
||||
}
|
||||
|
||||
if (request->next != NULL)
|
||||
{
|
||||
request_temp = (TRANSFER_REQUEST*)request->next;
|
||||
request_temp->prev = (TRANSFER_REQUEST*)request->prev;
|
||||
request_temp = (TRANSFER_REQUEST*) request->next;
|
||||
request_temp->prev = (TRANSFER_REQUEST*) request->prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue->tail = (TRANSFER_REQUEST*)request->prev;
|
||||
queue->tail = (TRANSFER_REQUEST*) request->prev;
|
||||
|
||||
}
|
||||
|
||||
@ -156,7 +160,7 @@ REQUEST_QUEUE* request_queue_new()
|
||||
{
|
||||
REQUEST_QUEUE* queue;
|
||||
|
||||
queue = (REQUEST_QUEUE*)malloc(sizeof(REQUEST_QUEUE));
|
||||
queue = (REQUEST_QUEUE*) malloc(sizeof(REQUEST_QUEUE));
|
||||
queue->request_num = 0;
|
||||
queue->ireq = NULL;
|
||||
queue->head = NULL;
|
||||
|
@ -134,7 +134,7 @@ static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// Translate to desktop coordinates
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfi->display, event->xmotion.window,
|
||||
RootWindowOfScreen(xfi->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
@ -197,18 +197,18 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
|
||||
break;
|
||||
|
||||
case 6: // wheel left or back
|
||||
case 8: // back
|
||||
case 97: // Xming
|
||||
case 6: /* wheel left or back */
|
||||
case 8: /* back */
|
||||
case 97: /* Xming */
|
||||
extended = TRUE;
|
||||
x = event->xbutton.x;
|
||||
y = event->xbutton.y;
|
||||
flags = PTR_XFLAGS_DOWN | PTR_XFLAGS_BUTTON1;
|
||||
break;
|
||||
|
||||
case 7: // wheel right or forward
|
||||
case 9: // forward
|
||||
case 112: // Xming
|
||||
case 7: /* wheel right or forward */
|
||||
case 9: /* forward */
|
||||
case 112: /* Xming */
|
||||
extended = TRUE;
|
||||
x = event->xbutton.x;
|
||||
y = event->xbutton.y;
|
||||
@ -237,7 +237,7 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// Translate to desktop coordinates
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfi->display, event->xbutton.window,
|
||||
RootWindowOfScreen(xfi->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
@ -320,7 +320,7 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// Translate to desktop coordinates
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfi->display, event->xbutton.window,
|
||||
RootWindowOfScreen(xfi->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
@ -393,7 +393,7 @@ static BOOL xf_event_FocusIn(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
|
||||
window = window_list_get_by_extra_id(rail->list, (void*) event->xany.window);
|
||||
|
||||
//Update the server with any window changes that occured while the window was not focused.
|
||||
/* Update the server with any window changes that occured while the window was not focused. */
|
||||
if (window != NULL)
|
||||
xf_rail_adjust_position(xfi, window);
|
||||
}
|
||||
@ -537,10 +537,12 @@ static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
(UINT32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom,
|
||||
xfw->width, xfw->height, event->xconfigure.send_event);
|
||||
|
||||
/* additonal checks for not in a local move and not ignoring configure to send
|
||||
/*
|
||||
* Additonal checks for not in a local move and not ignoring configure to send
|
||||
* position update to server, also should the window not be focused then do not
|
||||
* send to server yet(ie. resizing using window decoration).
|
||||
* The server will be updated when the window gets refocused. */
|
||||
* The server will be updated when the window gets refocused.
|
||||
*/
|
||||
if (app && xfw->decorations)
|
||||
{
|
||||
/* moving resizing using window decoration */
|
||||
@ -590,9 +592,12 @@ static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
if (window != NULL)
|
||||
{
|
||||
/* local restore event */
|
||||
//This is now handled as part of the PropertyNotify
|
||||
//Doing this here would inhibit the ability to restore a maximized window
|
||||
//that is minimized back to the maximized state
|
||||
|
||||
/* This is now handled as part of the PropertyNotify
|
||||
* Doing this here would inhibit the ability to restore a maximized window
|
||||
* that is minimized back to the maximized state
|
||||
*/
|
||||
|
||||
//xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE);
|
||||
xfWindow *xfw = (xfWindow*) window->extra;
|
||||
xfw->is_mapped = TRUE;
|
||||
@ -667,9 +672,12 @@ static BOOL xf_event_SelectionClear(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
|
||||
static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
{
|
||||
//This section handles sending the appropriate commands to the rail server
|
||||
//when the window has been minimized, maximized, restored locally
|
||||
//ie. not using the buttons on the rail window itself
|
||||
/*
|
||||
* This section handles sending the appropriate commands to the rail server
|
||||
* when the window has been minimized, maximized, restored locally
|
||||
* ie. not using the buttons on the rail window itself
|
||||
*/
|
||||
|
||||
if (app == TRUE)
|
||||
{
|
||||
rdpWindow* window;
|
||||
@ -699,7 +707,7 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
DEBUG_X11_LMS("No return _NET_WM_STATE, window is not maximized");
|
||||
}
|
||||
|
||||
for (i=0;i<nitems;i++)
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
if ((Atom) ((UINT16 **) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
|
||||
{
|
||||
@ -722,11 +730,9 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the window is in the iconic state
|
||||
/* If the window is in the iconic state */
|
||||
if (((UINT32) *prop == 3))
|
||||
{
|
||||
minimized = TRUE;
|
||||
}
|
||||
else
|
||||
minimized = FALSE;
|
||||
|
||||
@ -773,9 +779,10 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
|
||||
switch (xfi->window->local_move.state)
|
||||
{
|
||||
case LMS_NOT_ACTIVE:
|
||||
// No local move in progress, nothing to do
|
||||
/* No local move in progress, nothing to do */
|
||||
|
||||
/* Prevent Configure from happening during indeterminant state of Horz or Vert Max only */
|
||||
|
||||
//Prevent Configure from happening during indeterminant state of Horz or Vert Max only
|
||||
if ( (event->type == ConfigureNotify) && xfi->window->rail_ignore_configure)
|
||||
{
|
||||
DEBUG_X11_LMS("ConfigureNotify Event Ignored");
|
||||
@ -784,45 +791,41 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LMS_STARTING:
|
||||
// Local move initiated by RDP server, but we
|
||||
// have not yet seen any updates from the X server
|
||||
/* Local move initiated by RDP server, but we have not yet seen any updates from the X server */
|
||||
switch(event->type)
|
||||
{
|
||||
case ConfigureNotify:
|
||||
// Starting to see move events
|
||||
// from the X server. Local
|
||||
// move is now in progress.
|
||||
/* Starting to see move events from the X server. Local move is now in progress. */
|
||||
xfi->window->local_move.state = LMS_ACTIVE;
|
||||
|
||||
// Allow these events to be processed during move to keep
|
||||
// our state up to date.
|
||||
/* Allow these events to be processed during move to keep our state up to date. */
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
case UnmapNotify:
|
||||
// A button release event means the X
|
||||
// window server did not grab the
|
||||
// mouse before the user released it.
|
||||
// In this case we must cancel the
|
||||
// local move. The event will be
|
||||
// processed below as normal, below.
|
||||
/*
|
||||
* A button release event means the X window server did not grab the
|
||||
* mouse before the user released it. In this case we must cancel the
|
||||
* local move. The event will be processed below as normal, below.
|
||||
*/
|
||||
break;
|
||||
case VisibilityNotify:
|
||||
case PropertyNotify:
|
||||
case Expose:
|
||||
// Allow these events to pass
|
||||
/* Allow these events to pass */
|
||||
break;
|
||||
default:
|
||||
// Eat any other events
|
||||
/* Eat any other events */
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case LMS_ACTIVE:
|
||||
// Local move is in progress
|
||||
/* Local move is in progress */
|
||||
switch(event->type)
|
||||
{
|
||||
case ConfigureNotify:
|
||||
@ -830,19 +833,18 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
|
||||
case PropertyNotify:
|
||||
case Expose:
|
||||
case GravityNotify:
|
||||
// Keep us up to date on position
|
||||
/* Keep us up to date on position */
|
||||
break;
|
||||
default:
|
||||
DEBUG_X11_LMS("Event Type to break LMS: %s", X11_EVENT_STRINGS[event->type]);
|
||||
// Any other event terminates move
|
||||
/* Any other event terminates move */
|
||||
xf_rail_end_local_move(xfi, window);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case LMS_TERMINATING:
|
||||
// Already sent RDP end move to sever
|
||||
// Allow events to pass.
|
||||
/* Already sent RDP end move to server. Allow events to pass. */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -859,11 +861,11 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
|
||||
|
||||
if (xfi->remote_app)
|
||||
{
|
||||
window = window_list_get_by_extra_id(
|
||||
rail->list, (void*) event->xexpose.window);
|
||||
window = window_list_get_by_extra_id(rail->list, (void*) event->xexpose.window);
|
||||
|
||||
if (window)
|
||||
{
|
||||
// Update "current" window for cursor change orders
|
||||
/* Update "current" window for cursor change orders */
|
||||
xfi->window = (xfWindow *) window->extra;
|
||||
|
||||
if (xf_event_suppress_events(xfi, window, event))
|
||||
|
@ -65,6 +65,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
|
||||
{ "shell-dir", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Shell working directory" },
|
||||
{ "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Audio output mode" },
|
||||
{ "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Audio input (microphone)" },
|
||||
{ "clipboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect clipboard" },
|
||||
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (cleartype)" },
|
||||
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Desktop composition" },
|
||||
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Full window drag" },
|
||||
@ -644,6 +645,10 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
|
||||
{
|
||||
settings->CompressionEnabled = arg->Value ? TRUE : FALSE;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "clipboard")
|
||||
{
|
||||
settings->RedirectClipboard = arg->Value ? TRUE : FALSE;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "shell")
|
||||
{
|
||||
settings->AlternateShell = _strdup(arg->Value);
|
||||
@ -857,6 +862,17 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->RedirectClipboard)
|
||||
{
|
||||
entry = freerdp_load_channel_addin_entry("cliprdr", NULL, NULL, 0);
|
||||
|
||||
if (entry)
|
||||
{
|
||||
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
|
||||
printf("loading channel %s\n", "cliprdr");
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->RemoteApplicationMode)
|
||||
{
|
||||
entry = freerdp_load_channel_addin_entry("rail", NULL, NULL, 0);
|
||||
|
@ -930,6 +930,12 @@ struct rdp_settings
|
||||
/* Parallel Port Redirection */
|
||||
ALIGN64 BOOL RedirectParallelPorts; /* */
|
||||
|
||||
/**
|
||||
* Other Redirection
|
||||
*/
|
||||
|
||||
ALIGN64 BOOL RedirectClipboard; /* */
|
||||
|
||||
/**
|
||||
* Static Virtual Channels
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user