Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions FrameworkSensors/AccelerometerClient.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
Expand Down Expand Up @@ -52,7 +54,7 @@ UINT8 CrosEcGetMotionSensorCount(HANDLE Handle)
req.MaxSensorCount = 0;
if (0 == CrosEcSendCommand(
Handle,
EC_CMD_MOTION_SENSE,
EC_CMD_MOTION_SENSE_CMD,
1,
&req,
sizeof(req),
Expand Down Expand Up @@ -95,7 +97,7 @@ CrosEcGetAccelIndeces(HANDLE Handle, UINT8 *BaseSensor, UINT8 *LidSensor)
req.SensorNum = i;
if (0 == CrosEcSendCommand(
Handle,
EC_CMD_MOTION_SENSE,
EC_CMD_MOTION_SENSE_CMD,
1,
&req,
sizeof(req),
Expand All @@ -105,18 +107,18 @@ CrosEcGetAccelIndeces(HANDLE Handle, UINT8 *BaseSensor, UINT8 *LidSensor)
TraceError("%!FUNC! EC_CMD_MOTION_SENSE_INFO failed for sensor %d", i);
continue;
}
if (res.SensorType != MOTION_SENSE_TYPE_ACCEL) {
if (res.SensorType != MOTIONSENSE_TYPE_ACCEL) {
TraceError("%!FUNC! Found sensor of type %d. Not Accelerometer - ignoring.", res.SensorType);
continue;
}

switch (res.Location) {
case MOTION_SENSE_LOCATION_BASE:
case MOTIONSENSE_LOC_BASE:
TraceInformation("%!FUNC! Found base accel sensor at index: %d", i);
FoundBase = TRUE;
*BaseSensor = i;
break;
case MOTION_SENSE_LOCATION_LID:
case MOTIONSENSE_LOC_LID:
TraceInformation("%!FUNC! Found lid accel sensor at index: %d", i);
FoundLid = TRUE;
*LidSensor = i;
Expand Down Expand Up @@ -663,4 +665,4 @@ AccelerometerDevice::UpdateCachedThreshold(
Exit:
SENSOR_FunctionExit(Status);
return Status;
}
}
5 changes: 4 additions & 1 deletion FrameworkSensors/AlsClient.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down Expand Up @@ -646,4 +649,4 @@ AlsDevice::UpdateCachedThreshold(

SENSOR_FunctionExit(Status);
return Status;
}
}
5 changes: 4 additions & 1 deletion FrameworkSensors/Clients.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down Expand Up @@ -877,4 +880,4 @@ NTSTATUS OnCancelHistoryRetrieval(_In_ SENSOROBJECT SensorInstance, _Out_ PULONG

SENSOR_FunctionExit(Status);
return Status;
}
}
3 changes: 3 additions & 0 deletions FrameworkSensors/Clients.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down
3 changes: 3 additions & 0 deletions FrameworkSensors/Device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down
5 changes: 4 additions & 1 deletion FrameworkSensors/Driver.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down Expand Up @@ -97,4 +100,4 @@ OnDriverUnload(
WPP_CLEANUP(Driver);

return;
}
}
5 changes: 4 additions & 1 deletion FrameworkSensors/Driver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down Expand Up @@ -28,4 +31,4 @@ EVT_WDF_DEVICE_RELEASE_HARDWARE OnReleaseHardware;
EVT_WDF_DEVICE_D0_ENTRY OnD0Entry;
EVT_WDF_DEVICE_D0_EXIT OnD0Exit;

WDF_EXTERN_C_END
WDF_EXTERN_C_END
2 changes: 2 additions & 0 deletions FrameworkSensors/EcCommunication.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
Expand Down
40 changes: 7 additions & 33 deletions FrameworkSensors/EcCommunication.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//SPDX-License-Identifier: MS-PL
//
//Copyright (C) Framework Computer Inc
//Copyright (C) 2014 The ChromiumOS Authors
//
//Abstract:
//
Expand All @@ -16,24 +17,11 @@ extern "C" {
#include <wdf.h>
#include "Trace.h"

/* Command version mask */
#define EC_VER_MASK(version) (1UL << (version))

#define EC_MEMMAP_ALS 0x80 /* ALS readings in lux (2 X 16 bits) */
/* Unused 0x84 - 0x8f */
#define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/
/* Unused 0x91 */
#define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometers data 0x92 - 0x9f */
/* 0x92: Lid Angle if available, LID_ANGLE_UNRELIABLE otherwise */
/* 0x94 - 0x99: 1st Accelerometer */
/* 0x9a - 0x9f: 2nd Accelerometer */

/* Define the format of the accelerometer mapped memory status byte. */
#define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f
// BIT(4)
#define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4)
// BIT(7)
#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7)
#include "ec_compat_win.h"
#pragma pack(push, 1)
#include "ec_commands.h"
#pragma pack(pop)
#pragma warning(pop) /* matches push in ec_compat_win.h */

#define FILE_DEVICE_CROS_EMBEDDED_CONTROLLER 0x80EC

Expand All @@ -49,10 +37,6 @@ NTSTATUS ConnectToEc(
_Inout_ HANDLE* Handle
);

#define EC_CMD_MOTION_SENSE 0x002B
#define EC_CMD_RGBKBD_SET_COLOR 0x013A
#define EC_CMD_RGBKBD 0x013B

#define EC_RES_SUCCESS 0
#define EC_INVALID_COMMAND 1
#define EC_ERROR 2
Expand Down Expand Up @@ -115,16 +99,6 @@ typedef struct {
UINT8 SensorNum;
} EC_REQUEST_MOTION_SENSE_INFO;

#define MOTION_SENSE_TYPE_ACCEL 0x00
#define MOTION_SENSE_TYPE_GYRO 0x01
#define MOTION_SENSE_TYPE_MAG 0x02
#define MOTION_SENSE_TYPE_PROX 0x03
#define MOTION_SENSE_TYPE_LIGHT 0x04

#define MOTION_SENSE_LOCATION_BASE 0x00
#define MOTION_SENSE_LOCATION_LID 0x01
#define MOTION_SENSE_LOCATION_CAMERA 0x02

typedef struct {
UINT8 SensorType;
UINT8 Location;
Expand Down
3 changes: 3 additions & 0 deletions FrameworkSensors/SimpleDeviceOrientationClient.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// SPDX-License-Identifier: MS-PL
//
// Copyright (C) Microsoft Corporation, All Rights Reserved.
// Copyright (C) Framework Computer Inc, All Rights Reserved.
//
// Abstract:
//
Expand Down
2 changes: 2 additions & 0 deletions FrameworkSensors/Trace.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//SPDX-License-Identifier: MS-PL
//
//Copyright (C) Microsoft Corporation, All Rights Reserved
//Copyright (C) Framework Computer Inc, All Rights Reserved
//
Expand Down
Loading