diff options
Diffstat (limited to 'LibOVR')
-rw-r--r-- | LibOVR/Src/OVR_Linux_HMDDevice.cpp | 24 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Linux_HMDDevice.h | 16 |
2 files changed, 20 insertions, 20 deletions
diff --git a/LibOVR/Src/OVR_Linux_HMDDevice.cpp b/LibOVR/Src/OVR_Linux_HMDDevice.cpp index cce37d5..f59a49f 100644 --- a/LibOVR/Src/OVR_Linux_HMDDevice.cpp +++ b/LibOVR/Src/OVR_Linux_HMDDevice.cpp @@ -25,23 +25,23 @@ namespace OVR { namespace Linux { //------------------------------------------------------------------------------------- -HMDDeviceCreateDesc::HMDDeviceCreateDesc(DeviceFactory* factory, const String& displayDeviceName, long dispId) +HMDDeviceCreateDesc::HMDDeviceCreateDesc( + DeviceFactory* factory, + const String& displayDeviceName, + const String& deviceId) : DeviceCreateDesc(factory, Device_HMD), DisplayDeviceName(displayDeviceName), DesktopX(0), DesktopY(0), Contents(0), HResolution(0), VResolution(0), HScreenSize(0), VScreenSize(0), - DisplayId(dispId) -{ - DeviceId = DisplayDeviceName; -} + DeviceId(deviceId) +{ } HMDDeviceCreateDesc::HMDDeviceCreateDesc(const HMDDeviceCreateDesc& other) : DeviceCreateDesc(other.pFactory, Device_HMD), DeviceId(other.DeviceId), DisplayDeviceName(other.DisplayDeviceName), DesktopX(other.DesktopX), DesktopY(other.DesktopY), Contents(other.Contents), HResolution(other.HResolution), VResolution(other.VResolution), - HScreenSize(other.HScreenSize), VScreenSize(other.VScreenSize), - DisplayId(other.DisplayId) + HScreenSize(other.HScreenSize), VScreenSize(other.VScreenSize) { } @@ -61,8 +61,7 @@ HMDDeviceCreateDesc::MatchResult HMDDeviceCreateDesc::MatchDevice(const DeviceCr const HMDDeviceCreateDesc& s2 = (const HMDDeviceCreateDesc&) other; - if ((DeviceId == s2.DeviceId) && - (DisplayId == s2.DisplayId)) + if (DeviceId == s2.DeviceId) { // Non-null DeviceId may match while size is different if screen size was overwritten // by SensorDisplayInfo in prior iteration. @@ -132,14 +131,12 @@ bool HMDDeviceCreateDesc::UpdateMatchedCandidate(const DeviceCreateDesc& other, Contents |= Contents_Distortion; } DeviceId = s2.DeviceId; - DisplayId = s2.DisplayId; DisplayDeviceName = s2.DisplayDeviceName; if (newDeviceFlag) *newDeviceFlag = true; } else if (DeviceId.IsEmpty()) { DeviceId = s2.DeviceId; - DisplayId = s2.DisplayId; DisplayDeviceName = s2.DisplayDeviceName; // ScreenSize and Resolution are NOT assigned here, since they may have @@ -194,7 +191,9 @@ void HMDDeviceFactory::EnumerateDevices(EnumerateVisitor& visitor) h = crtc_info->height; XRRFreeCrtcInfo(crtc_info); } - HMDDeviceCreateDesc hmdCreateDesc(this, info->name, output); + char buffer[512]; + sprintf(buffer, "%s%04d", mi->manufacturer_code, mi->product_code); + HMDDeviceCreateDesc hmdCreateDesc(this, info->name, buffer); hmdCreateDesc.SetScreenParameters(x, y, w, h, 0.14976f, 0.0936f); // Notify caller about detected device. This will call EnumerateAddDevice // if the this is the first time device was detected. @@ -318,7 +317,6 @@ bool HMDDeviceCreateDesc::GetDeviceInfo(DeviceInfo* info) const OVR_strcpy(hmdInfo->DisplayDeviceName, sizeof(hmdInfo->DisplayDeviceName), DisplayDeviceName.ToCStr()); - hmdInfo->DisplayId = DisplayId; } return true; diff --git a/LibOVR/Src/OVR_Linux_HMDDevice.h b/LibOVR/Src/OVR_Linux_HMDDevice.h index d0585d1..f3191a9 100644 --- a/LibOVR/Src/OVR_Linux_HMDDevice.h +++ b/LibOVR/Src/OVR_Linux_HMDDevice.h @@ -59,11 +59,13 @@ protected: unsigned Contents; unsigned HResolution, VResolution; float HScreenSize, VScreenSize; - long DisplayId; float DistortionK[4]; public: - HMDDeviceCreateDesc(DeviceFactory* factory, const String& displayDeviceName, long dispId); + HMDDeviceCreateDesc( + DeviceFactory* factory, + const String& displayDeviceName, + const String& displayDeviceId); HMDDeviceCreateDesc(const HMDDeviceCreateDesc& other); virtual DeviceCreateDesc* Clone() const @@ -84,7 +86,7 @@ public: virtual bool GetDeviceInfo(DeviceInfo* info) const; // Requests the currently used default profile. This profile affects the - // settings reported by HMDInfo. + // settings reported by HMDInfo. Profile* GetProfileAddRef() const; ProfileType GetProfileType() const @@ -120,26 +122,26 @@ public: // HMDDevice represents an Oculus HMD device unit. An instance of this class // is typically created from the DeviceManager. -// After HMD device is created, we its sensor data can be obtained by +// After HMD device is created, we its sensor data can be obtained by // first creating a Sensor object and then wrappig it in SensorFusion. class HMDDevice : public DeviceImpl<OVR::HMDDevice> { public: HMDDevice(HMDDeviceCreateDesc* createDesc); - ~HMDDevice(); + ~HMDDevice(); virtual bool Initialize(DeviceBase* parent); virtual void Shutdown(); // Requests the currently used default profile. This profile affects the - // settings reported by HMDInfo. + // settings reported by HMDInfo. virtual Profile* GetProfile() const; virtual const char* GetProfileName() const; virtual bool SetProfileName(const char* name); // Query associated sensor. - virtual OVR::SensorDevice* GetSensor(); + virtual OVR::SensorDevice* GetSensor(); protected: HMDDeviceCreateDesc* getDesc() const { return (HMDDeviceCreateDesc*)pCreateDesc.GetPtr(); } |