Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style improvement #9

Merged
merged 5 commits into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove type alias.
Note: Modern Windows devices use little endian.
  • Loading branch information
imbushuo committed Sep 6, 2017
commit 85f49d109258690e3ae79538e7b7903d9f372ed2
10 changes: 4 additions & 6 deletions src/MagicTrackpad2PtpDevice/AppleDefinition.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "Types.h"

#define USB_VENDOR_ID_APPLE 0x05ac

/* MacbookAir, aka wellspring */
Expand Down Expand Up @@ -61,10 +59,10 @@

/* button data structure */
struct TRACKPAD_BUTTON_DATA {
u8 unknown1; /* constant */
u8 button; /* left button */
u8 rel_x; /* relative x coordinate */
u8 rel_y; /* relative y coordinate */
UCHAR unknown1; /* constant */
UCHAR button; /* left button */
UCHAR rel_x; /* relative x coordinate */
UCHAR rel_y; /* relative y coordinate */
};

/* trackpad header types */
Expand Down
2 changes: 1 addition & 1 deletion src/MagicTrackpad2PtpDevice/Device.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AmtPtpGetDeviceConfig(
_In_ USB_DEVICE_DESCRIPTOR deviceInfo
)
{
u16 id = deviceInfo.idProduct;
USHORT id = deviceInfo.idProduct;
const struct BCM5974_CONFIG *cfg;

for (cfg = Bcm5974ConfigTable; cfg->ansi; ++cfg) {
Expand Down
16 changes: 8 additions & 8 deletions src/MagicTrackpad2PtpDevice/InputInterrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ AmtPtpServiceTouchInputInterruptType5(
);

status = STATUS_SUCCESS;
s32 x, y = 0;
INT x, y = 0;

size_t raw_n, i = 0;
size_t headerSize = (unsigned int) DeviceContext->DeviceInfo->tp_header;
Expand Down Expand Up @@ -182,17 +182,17 @@ AmtPtpServiceTouchInputInterruptType5(

// Fingers
for (i = 0; i < raw_n; i++) {
u8 *f_base = Buffer + headerSize + DeviceContext->DeviceInfo->tp_delta;
UCHAR *f_base = Buffer + headerSize + DeviceContext->DeviceInfo->tp_delta;
f = (const struct TRACKPAD_FINGER*) (f_base + i * fingerprintSize);
f_type5 = (const struct TRACKPAD_FINGER_TYPE5*) f;

u16 tmp_x;
u32 tmp_y;
tmp_x = (*((__le16*)f_type5)) & 0x1fff;
tmp_y = (s32) (*((__le32*)f_type5));
USHORT tmp_x;
UINT tmp_y;
tmp_x = (*((USHORT*)f_type5)) & 0x1fff;
tmp_y = (INT) (*((UINT*)f_type5));

x = (s16) (tmp_x << 3) >> 3;
y = -(s32) (tmp_y << 6) >> 19;
x = (SHORT) (tmp_x << 3) >> 3;
y = -(INT) (tmp_y << 6) >> 19;

// We need to defuzz input
if (DeviceContext->ContactRepository[i].ContactId == f_type5->ContactIdentifier.Id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<ClInclude Include="Resource.h" />
<ClInclude Include="Trace.h" />
<ClInclude Include="Queue.h" />
<ClInclude Include="Types.h" />
</ItemGroup>
<ItemGroup>
<Inf Include="MagicTrackpad2PtpDevice.inf" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
<ClInclude Include="AppleDefinition.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
13 changes: 0 additions & 13 deletions src/MagicTrackpad2PtpDevice/Types.h

This file was deleted.