channels: fix tsmf and urbdrc

This commit is contained in:
Marc-André Moreau 2012-10-09 14:26:07 -04:00
parent 2431733043
commit 9b97a5d70e
5 changed files with 49 additions and 80 deletions

View File

@ -24,16 +24,19 @@
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/shape.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <gst/interfaces/xoverlay.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/mman.h>

View File

@ -32,7 +32,7 @@ set(${MODULE_PREFIX}_SRCS
include_directories(..)
add_library(${MODULE_NAME} ${URBDRC_SRCS})
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set(${MODULE_PREFIX}_LIBS
@ -42,10 +42,10 @@ set(${MODULE_PREFIX}_LIBS
if(MONOLITHIC_BUILD)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp)
target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
else()
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils)
target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
endif()
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@ -16,7 +16,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(LIBUSB_UDEVMAN_SRCS
set(MODULE_NAME "libusb-devman")
set(MODULE_PREFIX "CHANNEL_URBDRC_LIBUSB_DEVMAN")
set(${MODULE_PREFIX}_SRCS
libusb_udevman.c
libusb_udevice.c
libusb_udevice.h
@ -25,14 +28,15 @@ set(LIBUSB_UDEVMAN_SRCS
include_directories(../client)
add_library(libusb_udevman ${LIBUSB_UDEVMAN_SRCS})
set_target_properties(libusb_udevman PROPERTIES PREFIX "")
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
target_link_libraries(libusb_udevman udev)
target_link_libraries(libusb_udevman dbus-glib-1)
target_link_libraries(libusb_udevman pthread)
target_link_libraries(libusb_udevman usb-1.0)
target_link_libraries(libusb_udevman freerdp-utils)
set(${MODULE_PREFIX}_LIBS
dbus-glib-1
usb-1.0
pthread
udev)
install(TARGETS libusb_udevman DESTINATION ${FREERDP_PLUGIN_PATH})
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@ -22,20 +22,20 @@
#include <stdlib.h>
#include <string.h>
#include "urbdrc_types.h"
#include "urbdrc_main.h"
#include "libusb_udevice.h"
int libusb_debug;
#define BASIC_STATE_FUNC_DEFINED(_arg, _type) \
static _type udevman_get_##_arg (IUDEVMAN * idevman) \
static _type udevman_get_##_arg (IUDEVMAN* idevman) \
{ \
UDEVMAN * udevman = (UDEVMAN *) idevman; \
return udevman->_arg; \
} \
static void udevman_set_##_arg (IUDEVMAN * idevman, _type _t) \
static void udevman_set_##_arg (IUDEVMAN* idevman, _type _t) \
{ \
UDEVMAN * udevman = (UDEVMAN *) idevman; \
udevman->_arg = _t; \
@ -45,8 +45,8 @@ static void udevman_set_##_arg (IUDEVMAN * idevman, _type _t) \
_man->iface.get_##_arg = udevman_get_##_arg; \
_man->iface.set_##_arg = udevman_set_##_arg
typedef struct _UDEVMAN UDEVMAN;
struct _UDEVMAN
{
IUDEVMAN iface;
@ -65,17 +65,13 @@ struct _UDEVMAN
};
typedef UDEVMAN * PUDEVMAN;
static void
udevman_rewind(IUDEVMAN * idevman)
static void udevman_rewind(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
udevman->idev = udevman->head;
}
static int
udevman_has_next(IUDEVMAN * idevman)
static int udevman_has_next(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
if (udevman->idev == NULL)
@ -84,10 +80,9 @@ udevman_has_next(IUDEVMAN * idevman)
return 1;
}
static IUDEVICE*
udevman_get_next(IUDEVMAN * idevman)
static IUDEVICE* udevman_get_next(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
UDEVMAN * udevman = (UDEVMAN*) idevman;
IUDEVICE* pdev;
pdev = udevman->idev;
@ -96,9 +91,7 @@ udevman_get_next(IUDEVMAN * idevman)
return pdev;
}
static IUDEVICE*
udevman_get_udevice_by_addr(IUDEVMAN * idevman, int bus_number, int dev_number)
static IUDEVICE* udevman_get_udevice_by_addr(IUDEVMAN* idevman, int bus_number, int dev_number)
{
IUDEVICE * pdev;
@ -120,10 +113,7 @@ udevman_get_udevice_by_addr(IUDEVMAN * idevman, int bus_number, int dev_number)
return NULL;
}
static int
udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_number,
static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_number,
int UsbDevice,
UINT16 idVendor,
UINT16 idProduct,
@ -210,8 +200,7 @@ udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_number,
}
static int
udevman_unregister_udevice(IUDEVMAN * idevman, int bus_number, int dev_number)
static int udevman_unregister_udevice(IUDEVMAN* idevman, int bus_number, int dev_number)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
UDEVICE * pdev, * dev;
@ -296,8 +285,7 @@ udevman_unregister_udevice(IUDEVMAN * idevman, int bus_number, int dev_number)
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));
@ -309,8 +297,7 @@ 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;
memset(s1, 0, sizeof(s1));
@ -322,9 +309,7 @@ udevman_parse_device_pid_vid (char *str, int *id1, int *id2, char sign)
*id2 = (int) strtol(s2, NULL, 16);
}
static int
udevman_check_device_exist_by_id(IUDEVMAN * idevman, UINT16 idVendor, UINT16 idProduct)
static int udevman_check_device_exist_by_id(IUDEVMAN* idevman, UINT16 idVendor, UINT16 idProduct)
{
if (libusb_open_device_with_vid_pid (NULL, idVendor, idProduct))
return 1;
@ -332,17 +317,13 @@ udevman_check_device_exist_by_id(IUDEVMAN * idevman, UINT16 idVendor, UINT16 idP
return 0;
}
static int
udevman_is_auto_add(IUDEVMAN * idevman)
static int udevman_is_auto_add(IUDEVMAN* 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)
static IUDEVICE* udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN* idevman, UINT32 UsbDevice)
{
UDEVICE * pdev;
idevman->loading_lock(idevman);
@ -360,8 +341,7 @@ udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN * idevman, UINT32 UsbDevice)
return NULL;
}
static IUDEVICE*
udevman_get_udevice_by_UsbDevice(IUDEVMAN * idevman, UINT32 UsbDevice)
static IUDEVICE* udevman_get_udevice_by_UsbDevice(IUDEVMAN* idevman, UINT32 UsbDevice)
{
UDEVICE * pdev;
idevman->loading_lock(idevman);
@ -389,31 +369,27 @@ udevman_get_udevice_by_UsbDevice(IUDEVMAN * idevman, UINT32 UsbDevice)
}
static void
udevman_loading_lock(IUDEVMAN * idevman)
static void udevman_loading_lock(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
pthread_mutex_lock(&udevman->devman_loading);
}
static void
udevman_loading_unlock(IUDEVMAN * idevman)
static void udevman_loading_unlock(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
pthread_mutex_unlock(&udevman->devman_loading);
}
static void
udevman_wait_urb(IUDEVMAN * idevman)
static void udevman_wait_urb(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
sem_wait(&udevman->sem_urb_lock);
}
static void
udevman_push_urb(IUDEVMAN * idevman)
static void udevman_push_urb(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
sem_post(&udevman->sem_urb_lock);
@ -425,8 +401,7 @@ BASIC_STATE_FUNC_DEFINED(device_num, int)
BASIC_STATE_FUNC_DEFINED(sem_timeout, int)
static void
udevman_free(IUDEVMAN* idevman)
static void udevman_free(IUDEVMAN* idevman)
{
UDEVMAN * udevman = (UDEVMAN *) idevman;
pthread_mutex_destroy(&udevman->devman_loading);
@ -440,8 +415,7 @@ udevman_free(IUDEVMAN* idevman)
}
static void
udevman_load_interface(UDEVMAN * udevman)
static void udevman_load_interface(UDEVMAN * udevman)
{
/* standard */
udevman->iface.free = udevman_free;

View File

@ -24,11 +24,7 @@
#include <unistd.h>
#include "request_queue.h"
TRANSFER_REQUEST*
request_queue_get_next(REQUEST_QUEUE* queue)
TRANSFER_REQUEST* request_queue_get_next(REQUEST_QUEUE* queue)
{
TRANSFER_REQUEST* request;
@ -38,8 +34,7 @@ request_queue_get_next(REQUEST_QUEUE* queue)
return request;
}
int
request_queue_has_next(REQUEST_QUEUE* queue)
int request_queue_has_next(REQUEST_QUEUE* queue)
{
if (queue->ireq == NULL)
return 0;
@ -47,8 +42,7 @@ request_queue_has_next(REQUEST_QUEUE* queue)
return 1;
}
TRANSFER_REQUEST*
request_queue_register_request(REQUEST_QUEUE* queue, UINT32 RequestId,
TRANSFER_REQUEST* request_queue_register_request(REQUEST_QUEUE* queue, UINT32 RequestId,
struct libusb_transfer * transfer,
BYTE endpoint)
{
@ -82,15 +76,13 @@ request_queue_register_request(REQUEST_QUEUE* queue, UINT32 RequestId,
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);
@ -109,8 +101,7 @@ request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, BYTE ep)
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);
@ -161,9 +152,7 @@ request_queue_unregister_request(REQUEST_QUEUE *queue, UINT32 RequestId)
return 1;
}
REQUEST_QUEUE*
request_queue_new()
REQUEST_QUEUE* request_queue_new()
{
REQUEST_QUEUE* queue;
@ -185,4 +174,3 @@ request_queue_new()
return queue;
}