Skip to content

Commit

Permalink
Added preliminary support for the Kinect4Windows sensor.
Browse files Browse the repository at this point in the history
  • Loading branch information
avin2 committed May 24, 2012
1 parent 4204f59 commit 9a46188
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 38 deletions.
2 changes: 2 additions & 0 deletions Platform/Linux/Install/55-primesense-usb.rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ SUBSYSTEM=="usb", ATTR{idProduct}=="0601", ATTR{idVendor}=="1d27", MODE:="0666",
SUBSYSTEM=="usb", ATTR{idProduct}=="02ae", ATTR{idVendor}=="045e", MODE:="0666", OWNER:="root", GROUP:="video"
SUBSYSTEM=="usb", ATTR{idProduct}=="02ad", ATTR{idVendor}=="045e", MODE:="0666", OWNER:="root", GROUP:="audio"
SUBSYSTEM=="usb", ATTR{idProduct}=="02b0", ATTR{idVendor}=="045e", MODE:="0666", OWNER:="root", GROUP:="video"
SUBSYSTEM=="usb", ATTR{idProduct}=="02be", ATTR{idVendor}=="045e", MODE:="0666", OWNER:="root", GROUP:="audio"
SUBSYSTEM=="usb", ATTR{idProduct}=="02bf", ATTR{idVendor}=="045e", MODE:="0666", OWNER:="root", GROUP:="video"
14 changes: 12 additions & 2 deletions Platform/Win32/Driver/psdrv3.inf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Signature="$WINDOWS NT$"
Class=PrimeSense
ClassGuid={dce97d75-aef7-1980-1909-531357633222}
Provider=%PS%
DriverVer=11/21/2011,3.1.3.1
DriverVer=05/22/2012,3.1.3.1
CatalogFile=psdrv3.cat

; ================= Class section =====================
Expand Down Expand Up @@ -68,6 +68,10 @@ DefaultDestDir = 12 ; Driver Dir
%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE&MI_00
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE
%USB\VID_045E&PID_02BE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BE&MI_00
%USB\VID_045E&PID_02BE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BE
%USB\VID_045E&PID_02BF.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BF&MI_00
%USB\VID_045E&PID_02BF.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BF

[PrimeSense.NTamd64]
%USB\VID_1D27&PID_0200.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0200&MI_00
Expand Down Expand Up @@ -95,6 +99,10 @@ DefaultDestDir = 12 ; Driver Dir
%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE&MI_00
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE
%USB\VID_045E&PID_02BE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BE&MI_00
%USB\VID_045E&PID_02BE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BE
%USB\VID_045E&PID_02BF.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BF&MI_00
%USB\VID_045E&PID_02BF.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02BF

[psdrv3.Dev.NT]
CopyFiles=psdrv3.Files.Ext
Expand Down Expand Up @@ -178,4 +186,6 @@ USB\VID_1D27&PID_2200.DeviceDesc="PrimeSense Sensor Development Kit NG 2200"
USB\VID_1D27&PID_F9DB.DeviceDesc="PrimeSense Sensor Development Kit NG Debug"
USB\VID_045E&PID_02B0.DeviceDesc="Kinect Motor"
USB\VID_045E&PID_02AD.DeviceDesc="Kinect Audio"
USB\VID_045E&PID_02AE.DeviceDesc="Kinect Camera"
USB\VID_045E&PID_02AE.DeviceDesc="Kinect Camera"
USB\VID_045E&PID_02BE.DeviceDesc="Kinect4Windows Audio"
USB\VID_045E&PID_02BF.DeviceDesc="Kinect4Windows Camera"
6 changes: 5 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ You must use this kinect mod version with the unstable OpenNI release which is a
http://www.openni.org/Downloads/OpenNIModules.aspx

Changes:
v0.93:
1) Added preliminary support for the Kinect4Windows sensor.

v0.92:
1) Updated codebase to the latest OpenNI / Sensor version (1.5.4.0 / 5.1.2.1)

Expand Down Expand Up @@ -82,7 +85,8 @@ TIPs:

Todo:
1) Add motor & led control.
2) Add support for the K4W device.
2) Add windows 8 support - it's not working at the moment due to manually modified INF files.
3) Fix kinect4windows on Linux/MacOSX - it's very unstable.

The source code for this version is available at:
https://github.com/avin2/SensorKinect
Expand Down
43 changes: 15 additions & 28 deletions Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef enum
XnUInt16 XnSensorIO::ms_supportedProducts[] =
{
0x02AE,
0x02BF,
};

XnUInt32 XnSensorIO::ms_supportedProductsCount = sizeof(XnSensorIO::ms_supportedProducts) / sizeof(XnSensorIO::ms_supportedProducts[0]);
Expand Down Expand Up @@ -141,6 +142,8 @@ XnStatus XnSensorIO::OpenDataEndPoints(XnSensorUsbInterface nInterface, const Xn
{
XnStatus nRetVal = XN_STATUS_OK;

// --avin mod--
/*
// try to set requested interface
if (nInterface != XN_SENSOR_USB_INTERFACE_DEFAULT)
{
Expand All @@ -158,13 +161,12 @@ XnStatus XnSensorIO::OpenDataEndPoints(XnSensorUsbInterface nInterface, const Xn
XN_ASSERT(FALSE);
XN_LOG_WARNING_RETURN(XN_STATUS_USB_INTERFACE_NOT_SUPPORTED, XN_MASK_DEVICE_IO, "Unknown interface type: %d", nInterface);
}
// --avin mod--
/*
xnLogVerbose(XN_MASK_DEVICE_IO, "Setting USB alternative interface to %d...", nAlternativeInterface);
nRetVal = xnUSBSetInterface(m_pSensorHandle->USBDevice, 0, nAlternativeInterface);
XN_IS_STATUS_OK(nRetVal);
*/
}
*/

xnLogVerbose(XN_MASK_DEVICE_IO, "Opening endpoints...");

Expand All @@ -174,39 +176,24 @@ XnStatus XnSensorIO::OpenDataEndPoints(XnSensorUsbInterface nInterface, const Xn
XnBool bNewUSB = TRUE;

// Depth
m_pSensorHandle->DepthConnection.bIsISO = FALSE;

// --avin mod--
m_pSensorHandle->DepthConnection.bIsISO = TRUE;
bNewUSB = TRUE;

xnLogVerbose(XN_MASK_DEVICE_IO, "Opening endpoint 0x81 for depth...");
nRetVal = xnUSBOpenEndPoint(m_pSensorHandle->USBDevice, 0x81, XN_USB_EP_BULK, XN_USB_DIRECTION_IN, &m_pSensorHandle->DepthConnection.UsbEp);
nRetVal = xnUSBOpenEndPoint(m_pSensorHandle->USBDevice, 0x81, XN_USB_EP_ISOCHRONOUS, XN_USB_DIRECTION_IN, &m_pSensorHandle->DepthConnection.UsbEp);
if (nRetVal == XN_STATUS_USB_ENDPOINT_NOT_FOUND)
{
bNewUSB = FALSE;
xnLogVerbose(XN_MASK_DEVICE_IO, "Endpoint 0x81 does not exist. Trying old USB: Opening 0x82 for depth...");
nRetVal = xnUSBOpenEndPoint(m_pSensorHandle->USBDevice, 0x82, XN_USB_EP_BULK, XN_USB_DIRECTION_IN, &m_pSensorHandle->DepthConnection.UsbEp);
nRetVal = xnUSBSetInterface(m_pSensorHandle->USBDevice, 0, 1);
XN_IS_STATUS_OK(nRetVal);
}
else
{
if (nRetVal == XN_STATUS_USB_WRONG_ENDPOINT_TYPE)
{
nRetVal = xnUSBOpenEndPoint(m_pSensorHandle->USBDevice, 0x81, XN_USB_EP_ISOCHRONOUS, XN_USB_DIRECTION_IN, &m_pSensorHandle->DepthConnection.UsbEp);

m_pSensorHandle->DepthConnection.bIsISO = TRUE;
}

bNewUSB = TRUE;

nRetVal = xnUSBOpenEndPoint(m_pSensorHandle->USBDevice, 0x81, XN_USB_EP_ISOCHRONOUS, XN_USB_DIRECTION_IN, &m_pSensorHandle->DepthConnection.UsbEp);
XN_IS_STATUS_OK(nRetVal);

if (m_pSensorHandle->DepthConnection.bIsISO == TRUE)
{
xnLogVerbose(XN_MASK_DEVICE_IO, "Depth endpoint is isochronous.");
}
else
{
xnLogVerbose(XN_MASK_DEVICE_IO, "Depth endpoint is bulk.");
}
}

xnLogVerbose(XN_MASK_DEVICE_IO, "Depth endpoint is isochronous.");

m_pSensorHandle->DepthConnection.bIsOpen = TRUE;

nRetVal = xnUSBGetEndPointMaxPacketSize(m_pSensorHandle->DepthConnection.UsbEp, &m_pSensorHandle->DepthConnection.nMaxPacketSize);
Expand Down
14 changes: 7 additions & 7 deletions Source/XnDeviceSensorV2/XnHostProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnU
pDevicePrivateData->FWInfo.nOpcodeGetPlatformString = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetUsbCore = OPCODE_GET_USB_CORE_TYPE;


pDevicePrivateData->FWInfo.nUSBDelayReceive = 100;
pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 1;
pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 10;
pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 800;
pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 3000;
// --avin mod--
pDevicePrivateData->FWInfo.nUSBDelayReceive = 1;
pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 0;
pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 0;
pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 1;
pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 300;
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream0Mode = 1;
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 300;
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 1;
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;

pDevicePrivateData->FWInfo.bGetImageCmosTypeSupported = FALSE;
Expand Down

0 comments on commit 9a46188

Please sign in to comment.