merge from donut

This commit is contained in:
Jean-Baptiste Queru
2009-08-03 07:45:28 -07:00
2998 changed files with 82025 additions and 16091 deletions

View File

@@ -336,6 +336,7 @@ out: for (String name : entries) {
mAdapter.clear(); mAdapter.clear();
} }
@Override
protected Integer doInBackground(Void... params) { protected Integer doInBackground(Void... params) {
if (isCancelled()) return STATUS_CANCELLED; if (isCancelled()) return STATUS_CANCELLED;
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
@@ -386,7 +387,7 @@ out: for (String name : entries) {
super.onPostExecute(result); super.onPostExecute(result);
if (result == STATUS_NO_STORAGE) { if (result == STATUS_NO_STORAGE) {
mList.setVisibility(View.GONE); getListView().setVisibility(View.GONE);
mEmpty.setVisibility(View.VISIBLE); mEmpty.setVisibility(View.VISIBLE);
mEmpty.setText(getString(R.string.gestures_error_loading, mEmpty.setText(getString(R.string.gestures_error_loading,
mStoreFile.getAbsolutePath())); mStoreFile.getAbsolutePath()));

View File

@@ -18,6 +18,11 @@
# These are the files that comprise that SDK # These are the files that comprise that SDK
# #
# version files for the SDK updater
development/tools/scripts/doc_source.properties docs/source.properties
development/tools/scripts/tools_source.properties tools/source.properties
development/tools/scripts/platform_source.properties platforms/${PLATFORM_NAME}/source.properties
# host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/ # host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/
bin/aapt platforms/${PLATFORM_NAME}/tools/aapt bin/aapt platforms/${PLATFORM_NAME}/tools/aapt
bin/aidl platforms/${PLATFORM_NAME}/tools/aidl bin/aidl platforms/${PLATFORM_NAME}/tools/aidl
@@ -63,6 +68,7 @@ development/tools/scripts/build.alias.template tools/lib/build.alias.template
development/tools/scripts/android.el tools/lib/android.el development/tools/scripts/android.el tools/lib/android.el
# samples # samples
development/apps/GestureBuilder platforms/${PLATFORM_NAME}/samples/GestureBuilder
development/samples/HelloActivity platforms/${PLATFORM_NAME}/samples/HelloActivity development/samples/HelloActivity platforms/${PLATFORM_NAME}/samples/HelloActivity
development/samples/Home platforms/${PLATFORM_NAME}/samples/Home development/samples/Home platforms/${PLATFORM_NAME}/samples/Home
development/samples/LunarLander platforms/${PLATFORM_NAME}/samples/LunarLander development/samples/LunarLander platforms/${PLATFORM_NAME}/samples/LunarLander
@@ -126,6 +132,7 @@ framework/anttasks.jar tools/lib/anttasks.jar
# sdkmanager # sdkmanager
bin/android tools/android bin/android tools/android
framework/commons-compress-1.0.jar tools/lib/commons-compress-1.0.jar
framework/sdklib.jar tools/lib/sdklib.jar framework/sdklib.jar tools/lib/sdklib.jar
framework/sdkuilib.jar tools/lib/sdkuilib.jar framework/sdkuilib.jar tools/lib/sdkuilib.jar
framework/sdkmanager.jar tools/lib/sdkmanager.jar framework/sdkmanager.jar tools/lib/sdkmanager.jar
@@ -140,12 +147,15 @@ external/qemu/android/avd/hardware-properties.ini tools/lib/hardware-properties.
# emulator skins # emulator skins
development/emulator/skins/HVGA platforms/${PLATFORM_NAME}/skins/HVGA development/emulator/skins/HVGA platforms/${PLATFORM_NAME}/skins/HVGA
development/emulator/skins/HVGA-L platforms/${PLATFORM_NAME}/skins/HVGA-L development/emulator/skins/QVGA platforms/${PLATFORM_NAME}/skins/QVGA
development/emulator/skins/HVGA-P platforms/${PLATFORM_NAME}/skins/HVGA-P development/emulator/skins/WVGA platforms/${PLATFORM_NAME}/skins/WVGA
development/emulator/skins/QVGA-L platforms/${PLATFORM_NAME}/skins/QVGA-L
development/emulator/skins/QVGA-P platforms/${PLATFORM_NAME}/skins/QVGA-P
# NOTICE files are copied by build/core/Makefile # NOTICE files are copied by build/core/Makefile
development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/templates/NOTICE.txt
development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/samples/NOTICE.txt
development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/data/NOTICE.txt
development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/skins/NOTICE.txt
development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/tools/NOTICE.txt
# the readme # the readme
development/docs/SDK_RELEASE_NOTES RELEASE_NOTES.html development/docs/SDK_RELEASE_NOTES RELEASE_NOTES.html

View File

@@ -125,12 +125,6 @@ function package() {
[[ -d "$PLATFORM_TOOLS" ]] || die "Missing folder $PLATFORM_TOOLS." [[ -d "$PLATFORM_TOOLS" ]] || die "Missing folder $PLATFORM_TOOLS."
# USB Driver for ADB
mkdir -pv $TEMP_SDK_DIR/usb_driver/x86
cp -rv development/host/windows/prebuilt/usb/driver/* $TEMP_SDK_DIR/usb_driver/x86/
mkdir -pv $TEMP_SDK_DIR/usb_driver/x86_64
cp -rv development/host/windows/prebuilt/usb/driver_amd_64/* $TEMP_SDK_DIR/usb_driver/x86_64/
# Remove obsolete stuff from tools & platform # Remove obsolete stuff from tools & platform
TOOLS="$TEMP_SDK_DIR/tools" TOOLS="$TEMP_SDK_DIR/tools"
LIB="$TEMP_SDK_DIR/tools/lib" LIB="$TEMP_SDK_DIR/tools/lib"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -1,332 +0,0 @@
display {
width 480
height 320
x 145
y 78
}
background {
image background.png
x 0
y 0
}
button {
1 {
image key.png
x 224
y 468
}
2 {
image key.png
x 261
y 468
}
3 {
image key.png
x 298
y 468
}
4 {
image key.png
x 335
y 468
}
5 {
image key.png
x 372
y 468
}
6 {
image key.png
x 409
y 468
}
7 {
image key.png
x 446
y 468
}
8 {
image key.png
x 482
y 468
}
9 {
image key.png
x 520
y 468
}
0 {
image key.png
x 557
y 468
}
q {
image key.png
x 224
y 504
}
w {
image key.png
x 261
y 504
}
e {
image key.png
x 298
y 504
}
r {
image key.png
x 335
y 504
}
t {
image key.png
x 372
y 504
}
y {
image key.png
x 409
y 504
}
u {
image key.png
x 446
y 504
}
i {
image key.png
x 482
y 504
}
o {
image key.png
x 520
y 504
}
p {
image key.png
x 557
y 504
}
a {
image key.png
x 224
y 540
}
s {
image key.png
x 261
y 540
}
d {
image key.png
x 298
y 540
}
f {
image key.png
x 335
y 540
}
g {
image key.png
x 372
y 540
}
h {
image key.png
x 409
y 540
}
j {
image key.png
x 446
y 540
}
k {
image key.png
x 482
y 540
}
l {
image key.png
x 520
y 540
}
DEL {
image key.png
x 557
y 540
}
CAP {
image key.png
x 224
y 576
}
z {
image key.png
x 261
y 576
}
x {
image key.png
x 298
y 576
}
c {
image key.png
x 335
y 576
}
v {
image key.png
x 372
y 576
}
b {
image key.png
x 409
y 576
}
n {
image key.png
x 446
y 576
}
m {
image key.png
x 482
y 576
}
PERIOD {
image key.png
x 520
y 576
}
ENTER {
image key.png
x 557
y 576
}
ALT {
image key.png
x 224
y 612
}
SYM {
image key.png
x 261
y 612
}
AT {
image key.png
x 298
y 612
}
SPACE {
image spacebar.png
x 335
y 612
}
SLASH {
image key.png
x 482
y 612
}
COMMA {
image key.png
x 520
y 612
}
ALT2 {
image key.png
x 557
y 612
}
soft-left {
image menu.png
x 630
y 196
}
home {
image home.png
x 665
y 334
}
back {
image back.png
x 664
y 96
}
dpad-up {
image arrow_up.png
x 671
y 160
}
dpad-down {
image arrow_down.png
x 671
y 270
}
dpad-left {
image arrow_left.png
x 669
y 190
}
dpad-right {
image arrow_right.png
x 730
y 190
}
dpad-center {
image select.png
x 698
y 190
}
phone-dial {
image send.png
x 720
y 334
}
phone-hangup {
image end.png
x 720
y 96
}
power {
image power.png
x 128
y 407
}
volume-up {
image volume_up.png
x 336
y 0
}
volume-down {
image volume_down.png
x 386
y 0
}
}
network {
speed full
delay none
}
keyboard {
charmap qwerty2
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -1,2 +0,0 @@
# skin-specific hardware values
hw.lcd.density=160

View File

@@ -1,332 +0,0 @@
display {
width 320
height 480
x 75
y 84
}
background {
image background.png
x 0
y 0
}
button {
1 {
image key.png
x 468
y 276
}
2 {
image key.png
x 505
y 276
}
3 {
image key.png
x 543
y 276
}
4 {
image key.png
x 579
y 276
}
5 {
image key.png
x 616
y 276
}
6 {
image key.png
x 653
y 276
}
7 {
image key.png
x 690
y 276
}
8 {
image key.png
x 727
y 276
}
9 {
image key.png
x 763
y 276
}
0 {
image key.png
x 801
y 276
}
q {
image key.png
x 468
y 312
}
w {
image key.png
x 505
y 312
}
e {
image key.png
x 543
y 312
}
r {
image key.png
x 579
y 312
}
t {
image key.png
x 616
y 312
}
y {
image key.png
x 653
y 312
}
u {
image key.png
x 690
y 312
}
i {
image key.png
x 727
y 312
}
o {
image key.png
x 763
y 312
}
p {
image key.png
x 801
y 312
}
a {
image key.png
x 468
y 348
}
s {
image key.png
x 505
y 348
}
d {
image key.png
x 543
y 348
}
f {
image key.png
x 579
y 348
}
g {
image key.png
x 616
y 348
}
h {
image key.png
x 653
y 348
}
j {
image key.png
x 690
y 348
}
k {
image key.png
x 727
y 348
}
l {
image key.png
x 763
y 348
}
DEL {
image key.png
x 801
y 348
}
CAP {
image key.png
x 468
y 384
}
z {
image key.png
x 505
y 384
}
x {
image key.png
x 543
y 384
}
c {
image key.png
x 579
y 384
}
v {
image key.png
x 616
y 384
}
b {
image key.png
x 653
y 384
}
n {
image key.png
x 690
y 384
}
m {
image key.png
x 727
y 384
}
PERIOD {
image key.png
x 763
y 384
}
ENTER {
image key.png
x 801
y 384
}
ALT {
image key.png
x 468
y 420
}
SYM {
image key.png
x 505
y 420
}
AT {
image key.png
x 543
y 420
}
SPACE {
image spacebar.png
x 579
y 420
}
SLASH {
image key.png
x 727
y 420
}
COMMA {
image key.png
x 763
y 420
}
ALT2 {
image key.png
x 801
y 420
}
soft-left {
image menu.png
x 192
y 569
}
home {
image home.png
x 93
y 602
}
back {
image back.png
x 331
y 602
}
dpad-up {
image arrow_up.png
x 185
y 608
}
dpad-down {
image arrow_down.png
x 185
y 669
}
dpad-left {
image arrow_left.png
x 155
y 610
}
dpad-right {
image arrow_right.png
x 266
y 610
}
dpad-center {
image select.png
x 186
y 637
}
phone-dial {
image send.png
x 93
y 658
}
phone-hangup {
image end.png
x 331
y 658
}
power {
image power.png
x 7
y 66
}
volume-up {
image volume_up.png
x 407
y 274
}
volume-down {
image volume_down.png
x 407
y 324
}
}
keyboard {
charmap qwerty2
}
network {
speed full
delay none
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,275 +0,0 @@
display {
width 320
height 240
x 78
y 96
}
background {
image background.png
x 0
y 0
}
button {
soft-left {
image menu.png
x 136
y 378
}
home {
image home.png
x 312
y 372
}
back {
image back.png
x 137
y 420
}
dpad-up {
image arrow_up.png
x 190
y 364
}
dpad-down {
image arrow_down.png
x 190
y 421
}
dpad-left {
image arrow_left.png
x 181
y 372
}
dpad-right {
image arrow_right.png
x 257
y 372
}
dpad-center {
image select.png
x 216
y 394
}
phone-dial {
image send.png
x 76
y 394
}
phone-hangup {
image end.png
x 358
y 394
}
q {
image key.png
x 55
y 480
}
w {
image key.png
x 91
y 480
}
e {
image key.png
x 128
y 480
}
r {
image key.png
x 163
y 480
}
t {
image key.png
x 200
y 480
}
y {
image key.png
x 237
y 480
}
u {
image key.png
x 273
y 480
}
i {
image key.png
x 310
y 480
}
o {
image key.png
x 346
y 480
}
p {
image key.png
x 382
y 480
}
a {
image key.png
x 55
y 530
}
s {
image key.png
x 91
y 530
}
d {
image key.png
x 128
y 530
}
f {
image key.png
x 163
y 530
}
g {
image key.png
x 200
y 530
}
h {
image key.png
x 237
y 530
}
j {
image key.png
x 273
y 530
}
k {
image key.png
x 310
y 530
}
l {
image key.png
x 346
y 530
}
DEL {
image key.png
x 382
y 530
}
CAP {
image key.png
x 55
y 580
}
z {
image key.png
x 91
y 580
}
x {
image key.png
x 128
y 580
}
c {
image key.png
x 163
y 580
}
v {
image key.png
x 200
y 580
}
b {
image key.png
x 237
y 580
}
n {
image key.png
x 273
y 580
}
m {
image key.png
x 310
y 580
}
PERIOD {
image key.png
x 346
y 580
}
ENTER {
image key.png
x 382
y 580
}
ALT {
image key.png
x 55
y 630
}
SYM {
image key.png
x 91
y 630
}
AT {
image key.png
x 128
y 630
}
SPACE {
image spacebar.png
x 165
y 630
}
SLASH {
image key.png
x 310
y 630
}
COMMA {
image key.png
x 346
y 630
}
CAP2 {
image key.png
x 382
y 630
}
power {
image power.png
x 4
y 38
}
volume-up {
image volume_up.png
x 420
y 165
}
volume-down {
image volume_down.png
x 420
y 218
}
}
network {
speed full
delay none
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -1,2 +0,0 @@
# skin-specific hardware values
hw.lcd.density=120

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,329 +0,0 @@
display {
width 240
height 320
x 50
y 83
}
background {
image background.png
x 0
y 0
}
button {
soft-left {
image button.png
x 148
y 418
}
home {
image button.png
x 94
y 418
}
back {
image button.png
x 202
y 418
}
dpad-up {
image arrow_up.png
x 122
y 475
}
dpad-down {
image arrow_down.png
x 122
y 534
}
dpad-left {
image arrow_left.png
x 113
y 483
}
dpad-right {
image arrow_right.png
x 189
y 483
}
dpad-center {
image select.png
x 148
y 506
}
phone-dial {
image button.png
x 40
y 418
}
phone-hangup {
image button.png
x 256
y 418
}
power {
image power.png
x 5
y 18
}
volume-up {
image volume_up.png
x 306
y 192
}
volume-down {
image volume_down.png
x 306
y 245
}
1 {
image key.png
x 367
y 242
}
2 {
image key.png
x 404
y 242
}
3 {
image key.png
x 441
y 242
}
4 {
image key.png
x 478
y 242
}
5 {
image key.png
x 515
y 242
}
6 {
image key.png
x 552
y 242
}
7 {
image key.png
x 589
y 242
}
8 {
image key.png
x 626
y 242
}
9 {
image key.png
x 663
y 242
}
0 {
image key.png
x 700
y 242
}
q {
image key.png
x 367
y 278
}
w {
image key.png
x 404
y 278
}
e {
image key.png
x 441
y 278
}
r {
image key.png
x 478
y 278
}
t {
image key.png
x 515
y 278
}
y {
image key.png
x 552
y 278
}
u {
image key.png
x 589
y 278
}
i {
image key.png
x 626
y 278
}
o {
image key.png
x 663
y 278
}
p {
image key.png
x 700
y 278
}
a {
image key.png
x 367
y 314
}
s {
image key.png
x 404
y 314
}
d {
image key.png
x 441
y 314
}
f {
image key.png
x 478
y 314
}
g {
image key.png
x 515
y 314
}
h {
image key.png
x 552
y 314
}
j {
image key.png
x 589
y 314
}
k {
image key.png
x 626
y 314
}
l {
image key.png
x 663
y 314
}
DEL {
image key.png
x 700
y 314
}
CAP {
image key.png
x 367
y 350
}
z {
image key.png
x 404
y 350
}
x {
image key.png
x 441
y 350
}
c {
image key.png
x 478
y 350
}
v {
image key.png
x 515
y 350
}
b {
image key.png
x 552
y 350
}
n {
image key.png
x 589
y 350
}
m {
image key.png
x 626
y 350
}
PERIOD {
image key.png
x 663
y 350
}
ENTER {
image key.png
x 700
y 350
}
ALT {
image key.png
x 367
y 386
}
SYM {
image key.png
x 404
y 386
}
AT {
image key.png
x 441
y 386
}
SPACE {
image spacebar.png
x 478
y 386
}
SLASH {
image key.png
x 626
y 386
}
COMMA {
image key.png
x 663
y 386
}
ALT2 {
image key.png
x 408
y 855
}
}
network {
speed full
delay none
}
keyboard {
charmap qwerty2
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

BIN
emulator/skins/QVGA/.DS_Store vendored Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

380
emulator/skins/QVGA/layout Normal file
View File

@@ -0,0 +1,380 @@
parts {
device {
background {
image device.png
}
display {
width 240
height 320
x 33
y 69
}
buttons {
soft-left {
image menu.png
x 131
y 404
}
home {
image home.png
x 77
y 404
}
back {
image back.png
x 185
y 404
}
dpad-up {
image arrow_up.png
x 105
y 463
}
dpad-down {
image arrow_down.png
x 104
y 519
}
dpad-left {
image arrow_left.png
x 96
y 470
}
dpad-right {
image arrow_right.png
x 172
y 470
}
dpad-center {
image select.png
x 131
y 492
}
phone-dial {
image send.png
x 23
y 404
}
phone-hangup {
image end.png
x 238
y 404
}
power {
image power.png
x -16
y 0
}
volume-up {
image volume_up.png
x 289
y 177
}
volume-down {
image volume_down.png
x 289
y 233
}
}
}
keyboard {
background {
image keyboard.png
}
buttons {
1 {
image key.png
x 0
y 0
}
2 {
image key.png
x 37
y 0
}
3 {
image key.png
x 74
y 0
}
4 {
image key.png
x 111
y 0
}
5 {
image key.png
x 148
y 0
}
6 {
image key.png
x 185
y 0
}
7 {
image key.png
x 222
y 0
}
8 {
image key.png
x 259
y 0
}
9 {
image key.png
x 296
y 0
}
0 {
image key.png
x 333
y 0
}
q {
image key.png
x 0
y 36
}
w {
image key.png
x 37
y 36
}
e {
image key.png
x 74
y 36
}
r {
image key.png
x 111
y 36
}
t {
image key.png
x 148
y 36
}
y {
image key.png
x 185
y 36
}
u {
image key.png
x 222
y 36
}
i {
image key.png
x 259
y 36
}
o {
image key.png
x 296
y 36
}
p {
image key.png
x 333
y 36
}
a {
image key.png
x 0
y 72
}
s {
image key.png
x 37
y 72
}
d {
image key.png
x 74
y 72
}
f {
image key.png
x 111
y 72
}
g {
image key.png
x 148
y 72
}
h {
image key.png
x 185
y 72
}
j {
image key.png
x 222
y 72
}
k {
image key.png
x 259
y 72
}
l {
image key.png
x 296
y 72
}
DEL {
image key.png
x 333
y 72
}
CAP {
image key.png
x 0
y 108
}
z {
image key.png
x 37
y 108
}
x {
image key.png
x 74
y 108
}
c {
image key.png
x 111
y 108
}
v {
image key.png
x 148
y 108
}
b {
image key.png
x 185
y 108
}
n {
image key.png
x 222
y 108
}
m {
image key.png
x 259
y 108
}
PERIOD {
image key.png
x 296
y 108
}
ENTER {
image key.png
x 333
y 108
}
ALT {
image key.png
x 0
y 144
}
SYM {
image key.png
x 37
y 144
}
AT {
image key.png
x 74
y 144
}
SPACE {
image spacebar.png
x 111
y 144
}
SLASH {
image key.png
x 259
y 144
}
COMMA {
image key.png
x 296
y 144
}
ALT2 {
image key.png
x 333
y 144
}
}
}
}
layouts {
portrait {
width 750
height 610
color 0xe0e0e0
event EV_SW:0:1
part1 {
name device
x 30
y 097
}
part2 {
name keyboard
x 360
y 300
}
}
landscape {
width 645
height 575
color 0xe0e0e0
event EV_SW:0:0
part1 {
name device
x 10
y 360
rotation 3
}
part2 {
name keyboard
x 135
y 380
}
}
}
keyboard {
charmap qwerty2
}
network {
speed full
delay none
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,2 +1,2 @@
# skin-specific hardware values # skin-specific hardware values
hw.lcd.density=160 hw.lcd.density=240

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

385
emulator/skins/WVGA/layout Normal file
View File

@@ -0,0 +1,385 @@
parts {
device {
background {
image device.png
}
display {
width 480
height 800
x 65
y 135
}
buttons {
soft-left {
image menu.png
x 222
y 945
}
home {
image home.png
x 106
y 945
}
back {
image back.png
x 341
y 945
}
search {
image search.png
x 460
y 945
}
dpad-up {
image arrow_up.png
x 260
y 1019
}
dpad-down {
image arrow_down.png
x 260
y 1081
}
dpad-left {
image arrow_left.png
x 223
y 1023
}
dpad-right {
image arrow_right.png
x 343
y 1023
}
dpad-center {
image select.png
x 259
y 1049
}
phone-dial {
image send.png
x 107
y 1043
}
phone-hangup {
image end.png
x 458
y 1043
}
power {
image power.png
x -10
y 120
}
volume-up {
image volume_up.png
x 570
y 260
}
volume-down {
image volume_down.png
x 570
y 310
}
}
}
keyboard {
background {
image keyboard.png
}
buttons {
1 {
image key.png
x 0
y 0
}
2 {
image key.png
x 37
y 0
}
3 {
image key.png
x 74
y 0
}
4 {
image key.png
x 111
y 0
}
5 {
image key.png
x 148
y 0
}
6 {
image key.png
x 185
y 0
}
7 {
image key.png
x 222
y 0
}
8 {
image key.png
x 259
y 0
}
9 {
image key.png
x 296
y 0
}
0 {
image key.png
x 333
y 0
}
q {
image key.png
x 0
y 36
}
w {
image key.png
x 37
y 36
}
e {
image key.png
x 74
y 36
}
r {
image key.png
x 111
y 36
}
t {
image key.png
x 148
y 36
}
y {
image key.png
x 185
y 36
}
u {
image key.png
x 222
y 36
}
i {
image key.png
x 259
y 36
}
o {
image key.png
x 296
y 36
}
p {
image key.png
x 333
y 36
}
a {
image key.png
x 0
y 72
}
s {
image key.png
x 37
y 72
}
d {
image key.png
x 74
y 72
}
f {
image key.png
x 111
y 72
}
g {
image key.png
x 148
y 72
}
h {
image key.png
x 185
y 72
}
j {
image key.png
x 222
y 72
}
k {
image key.png
x 259
y 72
}
l {
image key.png
x 296
y 72
}
DEL {
image key.png
x 333
y 72
}
CAP {
image key.png
x 0
y 108
}
z {
image key.png
x 37
y 108
}
x {
image key.png
x 74
y 108
}
c {
image key.png
x 111
y 108
}
v {
image key.png
x 148
y 108
}
b {
image key.png
x 185
y 108
}
n {
image key.png
x 222
y 108
}
m {
image key.png
x 259
y 108
}
PERIOD {
image key.png
x 296
y 108
}
ENTER {
image key.png
x 333
y 108
}
ALT {
image key.png
x 0
y 144
}
SYM {
image key.png
x 37
y 144
}
AT {
image key.png
x 74
y 144
}
SPACE {
image spacebar.png
x 111
y 144
}
SLASH {
image key.png
x 259
y 144
}
COMMA {
image key.png
x 296
y 144
}
ALT2 {
image key.png
x 333
y 144
}
}
}
}
layouts {
portrait {
width 975
height 1080
color 0xffffff
event EV_SW:0:1
part1 {
name device
x 10
y -70
}
part2 {
name keyboard
x 600
y 400
}
}
landscape {
width 1080
height 810
color 0xffffff
event EV_SW:0:0
part1 {
name device
x -70
y 640
rotation 3
}
part2 {
name keyboard
x 250
y 620
}
}
}
keyboard {
charmap qwerty2
}
network {
speed full
delay none
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

9
host/windows/.gitignore vendored Executable file
View File

@@ -0,0 +1,9 @@
*.sln
*.vcproj*
usb/api.*
usb/Debug
usb/Release
usb/api/obj*
usb/api/*.log
usb/adb_winapi_test/obj*
usb/adb_winapi_test/*.log

201
host/windows/usb/NOTICE Executable file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,19 @@
Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
In order to build adb_winapi_test.dll you will need to install Windows Driver
Kit, which can be obtained from Microsoft. Assuming that WDK is installed, you
need to set one of the WDK's build environments, "cd" back into this directory,
and execute "build -cbeEIFZ" to clean and rebuild this project, or you can
execute "build -befEIF" to do a minimal build.

View File

@@ -0,0 +1,22 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

View File

@@ -0,0 +1,46 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
TARGETNAME = adb_winapi_test
TARGETPATH = obj
TARGETTYPE = PROGRAM
UMTYPE = console
UMENTRY = main
# Use statically linked atl libraries:
USE_STATIC_ATL = 1
# Use multithreaded libraries
USE_LIBCMT = 1
TARGETLIBS=$(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\oleaut32.lib \
..\api\obj$(BUILD_ALT_DIR)\i386\AdbWinApi.lib
INCLUDES=$(DDK_INC_PATH)\;$(SDK_INC_PATH)\;$(CRT_INC_PATH)\;$(ATL_INC_PATH)\api
# Common C defines
USER_C_FLAGS = $(USER_C_FLAGS) /FD /wd4100 /nologo
# Turn on all warnings, and treat warnings as errors
MSC_WARNING_LEVEL = /W4 /Wp64 /WX
PRECOMPILED_CXX = 1
PRECOMPILED_INCLUDE = stdafx.h
PRECOMPILED_SOURCEFILE = stdafx.cpp
SOURCES = adb_winapi_test.cpp

View File

@@ -0,0 +1,426 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file contains implementation of a test application that tests
// functionality of AdbWinApi interface. In this test we will use AdbWinApi
// interface in order to enumerate USB interfaces for Android ADB class, and
// for each interface found we will test USB I/O on that interface by sending
// a simple "hand shake" message to the device connected via this interface.
#include "stdafx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Android ADB interface identifier
const GUID kAdbInterfaceId = ANDROID_USB_CLASS_ID;
// Number of interfaces detected in TestEnumInterfaces.
int interface_count = 0;
// Constants used to initialize a "handshake" message
#define MAX_PAYLOAD 4096
#define A_SYNC 0x434e5953
#define A_CNXN 0x4e584e43
#define A_OPEN 0x4e45504f
#define A_OKAY 0x59414b4f
#define A_CLSE 0x45534c43
#define A_WRTE 0x45545257
#define A_VERSION 0x01000000
// Formats message sent to USB device
struct message {
unsigned int command; /* command identifier constant */
unsigned int arg0; /* first argument */
unsigned int arg1; /* second argument */
unsigned int data_length; /* length of payload (0 is allowed) */
unsigned int data_crc32; /* crc32 of data payload */
unsigned int magic; /* command ^ 0xffffffff */
};
//
// Test routines declarations.
//
// Tests interface enumeration.
bool TestEnumInterfaces();
// Tests all interfaces detected for our device class.
bool TestInterfaces();
// Tests interface addressed by the given device name.
bool TestInterface(const wchar_t* device_name);
// Tests interface opened with ADB API.
bool TestInterfaceHandle(ADBAPIHANDLE interface_handle);
// Sends a "handshake" message to the given interface.
bool DeviceHandShake(ADBAPIHANDLE adb_interface);
int __cdecl _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) {
// Test enum interfaces.
if (!TestEnumInterfaces())
return -1;
if (0 == interface_count) {
printf("\nNo ADB interfaces found. Make sure that device is "
"connected to USB port and is powered on.");
return 1;
}
// Test each interface found in the system
if (!TestInterfaces())
return -2;
return 0;
}
bool TestEnumInterfaces() {
// Enumerate interfaces
ADBAPIHANDLE enum_handle =
AdbEnumInterfaces(kAdbInterfaceId, true, true, true);
if (NULL == enum_handle) {
printf("\nEnum interfaces failure:");
printf("\nUnable to enumerate ADB interfaces: %u", GetLastError());
return false;
}
// Unite interface info structure and buffer big enough to contain the
// largest structure.
union {
AdbInterfaceInfo interface_info;
char buf[4096];
};
unsigned long buf_size = sizeof(buf);
// Enumerate (and count) interfaces, printing information for each found
// interface.
interface_count = 0;
while (AdbNextInterface(enum_handle, &interface_info, &buf_size)) {
interface_count++;
printf("\nFound interface %ws:", interface_info.device_name);
if (interface_info.flags & SPINT_ACTIVE)
printf(" ACTIVE");
if (interface_info.flags & SPINT_DEFAULT)
printf(" DEFAULT");
if (interface_info.flags & SPINT_REMOVED)
printf(" REMOVED");
buf_size = sizeof(buf);;
};
AdbCloseHandle(enum_handle);
return true;
}
bool TestInterfaces() {
// Enumerate interfaces
ADBAPIHANDLE enum_handle =
AdbEnumInterfaces(kAdbInterfaceId, true, true, true);
if (NULL == enum_handle) {
printf("\nTest interfaces failure:");
printf("\nUnable to enumerate ADB interfaces: %u", GetLastError());
return false;
}
// Unite interface info structure and buffer big enough to contain the
// largest structure.
union {
AdbInterfaceInfo interface_info;
char buf[4096];
};
unsigned long buf_size = sizeof(buf);
// Test each found interface
while (AdbNextInterface(enum_handle, &interface_info, &buf_size)) {
TestInterface(interface_info.device_name);
buf_size = sizeof(buf);
};
AdbCloseHandle(enum_handle);
// Create interface by VID/PID/MI
ADBAPIHANDLE interface_handle =
AdbCreateInterface(kAdbInterfaceId, DEVICE_VENDOR_ID,
DEVICE_COMPOSITE_PRODUCT_ID, DEVICE_INTERFACE_ID);
if (NULL == interface_handle) {
printf("\nUnable to create interface by VID/PID: %u", GetLastError());
return false;
}
// Test it
TestInterfaceHandle(interface_handle);
AdbCloseHandle(interface_handle);
return true;
}
bool TestInterface(const wchar_t* device_name) {
printf("\n*** Test interface( %ws )", device_name);
// Get ADB handle to the interface by its name
ADBAPIHANDLE interface_handle = AdbCreateInterfaceByName(device_name);
if (NULL == interface_handle) {
printf(" FAILED:\nUnable to create interface by name: %u", GetLastError());
return false;
}
// Test it
TestInterfaceHandle(interface_handle);
AdbCloseHandle(interface_handle);
return true;
}
bool TestInterfaceHandle(ADBAPIHANDLE interface_handle) {
// Get interface name.
char intr_name[4096];
unsigned long intr_name_size = sizeof(intr_name);
if (AdbGetInterfaceName(interface_handle, intr_name, &intr_name_size, true)) {
printf("\n+++ Interface name %s", intr_name);
} else {
printf("\n--- AdbGetInterfaceName failure %u", GetLastError());
return false;
}
// Get device descriptor for the interface
USB_DEVICE_DESCRIPTOR dev_desc;
if (AdbGetUsbDeviceDescriptor(interface_handle, &dev_desc)) {
printf("\n+++ Device descriptor:");
printf("\n bLength = %u", dev_desc.bLength);
printf("\n bDescriptorType = %u", dev_desc.bDescriptorType);
printf("\n bcdUSB = %u", dev_desc.bcdUSB);
printf("\n bDeviceClass = %u", dev_desc.bDeviceClass);
printf("\n bDeviceSubClass = %u", dev_desc.bDeviceSubClass);
printf("\n bDeviceProtocol = %u", dev_desc.bDeviceProtocol);
printf("\n bMaxPacketSize0 = %u", dev_desc.bMaxPacketSize0);
printf("\n idVendor = %X", dev_desc.idVendor);
printf("\n idProduct = %X", dev_desc.idProduct);
printf("\n bcdDevice = %u", dev_desc.bcdDevice);
printf("\n iManufacturer = %u", dev_desc.iManufacturer);
printf("\n iProduct = %u", dev_desc.iProduct);
printf("\n iSerialNumber = %u", dev_desc.iSerialNumber);
printf("\n bNumConfigurations = %u", dev_desc.bDescriptorType);
} else {
printf("\n--- AdbGetUsbDeviceDescriptor failure %u", GetLastError());
return false;
}
// Get configuration descriptor for the interface
USB_CONFIGURATION_DESCRIPTOR config_desc;
if (AdbGetUsbConfigurationDescriptor(interface_handle, &config_desc)) {
printf("\n+++ Configuration descriptor:");
printf("\n bLength = %u", config_desc.bLength);
printf("\n bDescriptorType = %u", config_desc.bDescriptorType);
printf("\n wTotalLength = %u", config_desc.wTotalLength);
printf("\n bNumInterfaces = %u", config_desc.bNumInterfaces);
printf("\n bConfigurationValue = %u", config_desc.bConfigurationValue);
printf("\n iConfiguration = %u", config_desc.iConfiguration);
printf("\n bmAttributes = %u", config_desc.bmAttributes);
printf("\n MaxPower = %u", config_desc.MaxPower);
} else {
printf("\n--- AdbGetUsbConfigurationDescriptor failure %u", GetLastError());
return false;
}
// Get device serial number
char ser_num[1024];
unsigned long ser_num_size = sizeof(ser_num);
if (AdbGetSerialNumber(interface_handle, ser_num, &ser_num_size, true)) {
printf("\n+++ Serial number: %s", ser_num);
} else {
printf("\n--- AdbGetSerialNumber failure %u", GetLastError());
return false;
}
// Get interface descriptor
USB_INTERFACE_DESCRIPTOR intr_desc;
if (AdbGetUsbInterfaceDescriptor(interface_handle, &intr_desc)) {
printf("\n+++ Interface descriptor:");
printf("\n bDescriptorType = %u", intr_desc.bDescriptorType);
printf("\n bInterfaceNumber = %u", intr_desc.bInterfaceNumber);
printf("\n bAlternateSetting = %u", intr_desc.bAlternateSetting);
printf("\n bNumEndpoints = %u", intr_desc.bNumEndpoints);
printf("\n bInterfaceClass = %u", intr_desc.bInterfaceClass);
printf("\n bInterfaceSubClass = %u", intr_desc.bInterfaceSubClass);
printf("\n bInterfaceProtocol = %u", intr_desc.bInterfaceProtocol);
printf("\n iInterface = %u", intr_desc.iInterface);
} else {
printf("\n--- AdbGetUsbInterfaceDescriptor failure %u", GetLastError());
return false;
}
// Enumerate interface's endpoints
AdbEndpointInformation pipe_info;
for (UCHAR pipe = 0; pipe < intr_desc.bNumEndpoints; pipe++) {
if (AdbGetEndpointInformation(interface_handle, pipe, &pipe_info)) {
printf("\n PIPE %u info:", pipe);
printf("\n max_packet_size = %u", pipe_info.max_packet_size);
printf("\n max_transfer_size = %u", pipe_info.max_transfer_size);
printf("\n endpoint_type = %u", pipe_info.endpoint_type);
printf("\n endpoint_address = %02X", pipe_info.endpoint_address);
printf("\n polling_interval = %u", pipe_info.polling_interval);
printf("\n setting_index = %u", pipe_info.setting_index);
} else {
printf("\n--- AdbGetEndpointInformation(%u) failure %u", pipe, GetLastError());
return false;
}
}
// Get default bulk read endpoint info
if (AdbGetDefaultBulkReadEndpointInformation(interface_handle, &pipe_info)) {
printf("\n Default Bulk Read Pipe info:");
printf("\n max_packet_size = %u", pipe_info.max_packet_size);
printf("\n max_transfer_size = %u", pipe_info.max_transfer_size);
printf("\n endpoint_type = %u", pipe_info.endpoint_type);
printf("\n endpoint_address = %02X", pipe_info.endpoint_address);
printf("\n polling_interval = %u", pipe_info.polling_interval);
printf("\n setting_index = %u", pipe_info.setting_index);
} else {
printf("\n--- AdbGetDefaultBulkReadEndpointInformation failure %u", GetLastError());
return false;
}
// Get default bulk write endpoint info
if (AdbGetDefaultBulkWriteEndpointInformation(interface_handle, &pipe_info)) {
printf("\n Default Bulk Write Pipe info:");
printf("\n max_packet_size = %u", pipe_info.max_packet_size);
printf("\n max_transfer_size = %u", pipe_info.max_transfer_size);
printf("\n endpoint_type = %u", pipe_info.endpoint_type);
printf("\n endpoint_address = %02X", pipe_info.endpoint_address);
printf("\n polling_interval = %u", pipe_info.polling_interval);
printf("\n setting_index = %u", pipe_info.setting_index);
} else {
printf("\n--- AdbGetDefaultBulkWriteEndpointInformation failure %u", GetLastError());
return false;
}
// Test a handshake on that interface
DeviceHandShake(interface_handle);
return true;
}
bool DeviceHandShake(ADBAPIHANDLE adb_interface) {
// Get interface name
char interf_name[512];
unsigned long name_size = sizeof(interf_name);
if (!AdbGetInterfaceName(adb_interface, interf_name, &name_size, true)) {
printf("\nDeviceHandShake: AdbGetInterfaceName returned error %u",
GetLastError());
return false;
}
printf("\n\nDeviceHandShake on %s", interf_name);
char* ser_num = NULL;
name_size = 0;
if (!AdbGetSerialNumber(adb_interface, ser_num, &name_size, true)) {
ser_num = reinterpret_cast<char*>(malloc(name_size));
if (NULL != ser_num) {
if (!AdbGetSerialNumber(adb_interface, ser_num, &name_size, true)) {
printf("\n AdbGetSerialNumber returned error %u", GetLastError());
AdbCloseHandle(adb_interface);
return false;
}
printf("\nInterface serial number is %s", ser_num);
free(ser_num);
}
}
// Get default read endpoint
ADBAPIHANDLE adb_read = AdbOpenDefaultBulkReadEndpoint(adb_interface,
AdbOpenAccessTypeReadWrite,
AdbOpenSharingModeReadWrite);
if (NULL == adb_read) {
printf("\n AdbOpenDefaultBulkReadEndpoint returned error %u", GetLastError());
return false;
}
// Get default write endpoint
ADBAPIHANDLE adb_write = AdbOpenDefaultBulkWriteEndpoint(adb_interface,
AdbOpenAccessTypeReadWrite,
AdbOpenSharingModeReadWrite);
if (NULL == adb_write) {
printf("\n AdbOpenDefaultBulkWriteEndpoint returned error %u", GetLastError());
AdbCloseHandle(adb_read);
return false;
}
// Send connect message
message msg_send;
msg_send.command = A_CNXN;
msg_send.arg0 = A_VERSION;
msg_send.arg1 = MAX_PAYLOAD;
msg_send.data_length = 0;
msg_send.data_crc32 = 0;
msg_send.magic = msg_send.command ^ 0xffffffff;
ULONG written_bytes = 0;
bool write_res = AdbWriteEndpointSync(adb_write, &msg_send, sizeof(msg_send), &written_bytes, 500);
if (!write_res) {
printf("\n AdbWriteEndpointSync returned error %u", GetLastError());
AdbCloseHandle(adb_write);
AdbCloseHandle(adb_read);
return false;
}
// Receive handshake
message msg_rcv;
ULONG read_bytes = 0;
bool read_res = AdbReadEndpointSync(adb_read, &msg_rcv, sizeof(msg_rcv), &read_bytes, 512);
if (!read_res) {
printf("\n AdbReadEndpointSync returned error %u", GetLastError());
AdbCloseHandle(adb_write);
AdbCloseHandle(adb_read);
return false;
}
printf("\n Read handshake: %u bytes received", read_bytes);
char* cmd_ansi = reinterpret_cast<char*>(&msg_rcv.command);
printf("\n command = %08X (%c%c%c%c)", msg_rcv.command,
cmd_ansi[0], cmd_ansi[1], cmd_ansi[2], cmd_ansi[3]);
printf("\n arg0 = %08X", msg_rcv.arg0);
printf("\n arg1 = %08X", msg_rcv.arg1);
printf("\n data_length = %u", msg_rcv.data_length);
printf("\n data_crc32 = %08X", msg_rcv.data_crc32);
printf("\n magic = %08X", msg_rcv.magic);
if (0 != msg_rcv.data_length) {
char* buf = reinterpret_cast<char*>(malloc(msg_rcv.data_length));
read_res = AdbReadEndpointSync(adb_read, buf, msg_rcv.data_length, &read_bytes, 512);
if (!read_res) {
printf("\n AdbReadEndpointSync (data) returned error %u", GetLastError());
free(buf);
AdbCloseHandle(adb_write);
AdbCloseHandle(adb_read);
return false;
}
for (ULONG n = 0; n < read_bytes; n++) {
if (0 == (n % 16))
printf("\n ");
printf("%02X ", buf[n]);
}
printf("\n %s", buf);
delete buf;
}
AdbCloseHandle(adb_write);
AdbCloseHandle(adb_read);
return true;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2008 The Android Open Source Project * Copyright (C) 2009 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -15,10 +15,7 @@
*/ */
// stdafx.cpp : source file that includes just the standard includes // stdafx.cpp : source file that includes just the standard includes
// android_usb_test.pch will be the pre-compiled header // WinUSBTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information // stdafx.obj will contain the pre-compiled type information
#include "stdafx.h" #include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0500 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
#endif
#ifndef STRICT
#define STRICT
#endif
#include <stdio.h>
#include <tchar.h>
#define _ATL_STATIC_LIB_IMPL
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define _ATL_ALL_WARNINGS
#include <windows.h>
#include <atlbase.h>
#include <initguid.h>
#pragma warning(disable: 4200)
extern "C" {
#include <usbdi.h>
#include <Setupapi.h>
}
#pragma warning(default: 4200)
extern "C" {
#include "..\api\adb_api.h"
}

View File

@@ -0,0 +1,105 @@
;
; WinUsb installation File.
;
[Version]
Signature = "$Windows NT$"
Class = AndroidUsbDeviceClass
ClassGuid = {3F966BD9-FA04-4ec5-991C-D326973B5128}
Provider = %ProviderName%
DriverVer = 07/20/2009,2.0.0010.00001
CatalogFile.NTx86 = androidwinusb86.cat
CatalogFile.NTamd64 = androidwinusba64.cat
;
; This section is required even though we report our driver
; as a standard USB driver. If this section is removed the
; installer will report an error "Required section not found
; in INF file.
;
[ClassInstall32]
Addreg = AndroidWinUsbClassReg
[AndroidWinUsbClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-1
[Manufacturer]
%ProviderName% = Google,NTx86,NTamd64
[Google.NTx86]
; HTC Dream
%USB\HCT_Dream.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C01
%USB\HCT_Dream_Composite.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C02&MI_01
%USB\HCT_BootLoader.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0FFF
; HCT Magic
%USB\HCT_Magic_Composite.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C03&MI_01
[Google.NTamd64]
; HTC Dream
%USB\HCT_Dream.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C01
%USB\HCT_Dream_Composite.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C02&MI_01
%USB\HCT_BootLoader.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0FFF
; HCT Magic
%USB\HCT_Magic_Composite.DeviceDesc% = USB_Install, USB\VID_0BB4&PID_0C03&MI_01
[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT
[USB_Install.Services]
Include=winusb.inf
AddService=WinUSB,0x00000002,WinUSB_ServiceInstall
[WinUSB_ServiceInstall]
DisplayName = %WinUSB_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
[USB_Install.Wdf]
KmdfService=WINUSB, WinUSB_Install
[WinUSB_Install]
KmdfLibraryVersion=1.7
[USB_Install.HW]
AddReg=Dev_AddReg
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}"
[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01007.dll,WdfCoInstaller","WinUSBCoInstaller.dll"
[CoInstallers_CopyFiles]
WinUSBCoInstaller.dll
WdfCoInstaller01007.dll
[DestinationDirs]
CoInstallers_CopyFiles=11
[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64
[SourceDisksFiles.x86]
WinUSBCoInstaller.dll=1
WdfCoInstaller01007.dll=1
[SourceDisksFiles.amd64]
WinUSBCoInstaller.dll=2
WdfCoInstaller01007.dll=2
[Strings]
ProviderName="Google, Inc."
USB\HCT_Dream.DeviceDesc="Android ADB Interface"
USB\HCT_Dream_Composite.DeviceDesc="Android Composite ADB Interface"
USB\HCT_BootLoader.DeviceDesc="Android Bootloader Interface"
USB\HCT_Magic_Composite.DeviceDesc="Android Composite ADB Interface"
WinUSB_SvcDesc="Android USB Driver"
DISK_NAME="Android install disk"
ClassName="Android Phone"

View File

@@ -18,6 +18,12 @@
#include "stdafx.h" #include "stdafx.h"
extern "C" {
int _forceCRTManifest;
int _forceMFCManifest;
int _forceAtlDllManifest;
};
class CAdbWinApiModule : public CAtlDllModuleT< CAdbWinApiModule > { class CAdbWinApiModule : public CAtlDllModuleT< CAdbWinApiModule > {
public: public:
}; };

View File

@@ -57,8 +57,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1 FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,0,1 PRODUCTVERSION 2,0,0,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@@ -74,13 +74,13 @@ BEGIN
BLOCK "040904e4" BLOCK "040904e4"
BEGIN BEGIN
VALUE "CompanyName", "Google, inc" VALUE "CompanyName", "Google, inc"
VALUE "FileDescription", "TODO: <File description>" VALUE "FileDescription", "Android ADB API"
VALUE "FileVersion", "1.0.0.1" VALUE "FileVersion", "2.0.0.0"
VALUE "LegalCopyright", "Copyright (C) 2006 The Android Open Source Project" VALUE "LegalCopyright", "Copyright (C) 2006 The Android Open Source Project"
VALUE "InternalName", "AdbWinApi.dll" VALUE "InternalName", "AdbWinApi.dll"
VALUE "OriginalFilename", "AdbWinApi.dll" VALUE "OriginalFilename", "AdbWinApi.dll"
VALUE "ProductName", "TODO: <Product name>" VALUE "ProductName", "Android SDK"
VALUE "ProductVersion", "1.0.0.1" VALUE "ProductVersion", "2.0.0.0"
VALUE "OLESelfRegister", "" VALUE "OLESelfRegister", ""
END END
END END

View File

@@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AdbWinApi", "AdbWinApi.vcproj", "{C0A471E9-6892-4270-96DE-DB5F8D526FB1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{C0A471E9-6892-4270-96DE-DB5F8D526FB1}.Debug.ActiveCfg = Debug|Win32
{C0A471E9-6892-4270-96DE-DB5F8D526FB1}.Debug.Build.0 = Debug|Win32
{C0A471E9-6892-4270-96DE-DB5F8D526FB1}.Release.ActiveCfg = Release|Win32
{C0A471E9-6892-4270-96DE-DB5F8D526FB1}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -1,290 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="AdbWinApi"
ProjectGUID="{C0A471E9-6892-4270-96DE-DB5F8D526FB1}"
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="c:\winddk\6000\inc\api;..\common"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;ADBWIN_EXPORTS"
MinimalRebuild="FALSE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="3"
ProgramDataBaseFileName="..\build\$(OutDir)\i386\$(TargetName).pdb"
WarningLevel="4"
WarnAsError="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
DisableSpecificWarnings="4100;4200;4702"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="c:\winddk\6000\lib\wxp\i386\usbd.lib setupapi.lib"
OutputFile="..\build\$(OutDir)\i386/AdbWinApi.dll"
LinkIncremental="2"
AdditionalLibraryDirectories=""
ModuleDefinitionFile=".\AdbWinApi.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="..\build\$(OutDir)\i386/$(ProjectName).pdb"
SubSystem="2"
ImportLibrary="..\build\$(OutDir)\i386/AdbWinApi.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="FALSE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName="$(IntDir)/AdbWinApi.tlb"
HeaderFileName="AdbWinApi.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AdbWinApi_i.c"
ProxyFileName="AdbWinApi_p.c"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="2"
AdditionalIncludeDirectories="c:\winddk\6000\inc\api;..\common"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;ADBWIN_EXPORTS"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="3"
ProgramDataBaseFileName="..\build\$(OutDir)\i386\$(TargetName).pdb"
WarningLevel="4"
WarnAsError="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"
DisableSpecificWarnings="4100;4200;4702"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="c:\winddk\6000\lib\wxp\i386\usbd.lib setupapi.lib"
OutputFile="..\build\$(OutDir)\i386/AdbWinApi.dll"
LinkIncremental="1"
AdditionalLibraryDirectories=""
ModuleDefinitionFile=".\AdbWinApi.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="..\build\$(OutDir)\i386/$(ProjectName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="..\build\$(OutDir)\i386/AdbWinApi.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="FALSE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName="$(IntDir)/AdbWinApi.tlb"
HeaderFileName="AdbWinApi.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AdbWinApi_i.c"
ProxyFileName="AdbWinApi_p.c"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\adb_api.cpp">
</File>
<File
RelativePath=".\adb_endpoint_object.cpp">
</File>
<File
RelativePath=".\adb_helper_routines.cpp">
</File>
<File
RelativePath=".\adb_interface.cpp">
</File>
<File
RelativePath=".\adb_interface_enum.cpp">
</File>
<File
RelativePath=".\adb_io_completion.cpp">
</File>
<File
RelativePath=".\adb_io_object.cpp">
</File>
<File
RelativePath=".\adb_object_handle.cpp">
</File>
<File
RelativePath=".\AdbWinApi.cpp">
</File>
<File
RelativePath=".\AdbWinApi.def">
</File>
<File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\adb_api.h">
</File>
<File
RelativePath=".\adb_api_private_defines.h">
</File>
<File
RelativePath=".\adb_endpoint_object.h">
</File>
<File
RelativePath=".\adb_helper_routines.h">
</File>
<File
RelativePath=".\adb_interface.h">
</File>
<File
RelativePath=".\adb_interface_enum.h">
</File>
<File
RelativePath=".\adb_io_completion.h">
</File>
<File
RelativePath=".\adb_io_object.h">
</File>
<File
RelativePath=".\adb_object_handle.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
<Filter
Name="common"
Filter="">
<File
RelativePath=".\adb_api_extra.h">
</File>
<File
RelativePath="..\common\android_usb_common_defines.h">
</File>
</Filter>
<Filter
Name="USB"
Filter="">
<File
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb.h">
</File>
<File
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb100.h">
</File>
<File
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usb200.h">
</File>
<File
RelativePath="..\..\..\..\..\..\..\..\Winddk\6000\inc\api\usbdi.h">
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\AdbWinApi.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,19 @@
Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
In order to build AdbWinApi.dll you will need to install Windows Driver Kit,
which can be obtained from Microsoft. Assuming that WDK is installed, you
need to set one of the WDK's build environments, "cd" back into this directory,
and execute "build -cbeEIFZ" to clean and rebuild this project, or you can
execute "build -befEIF" to do a minimal build.

22
host/windows/usb/api/MAKEFILE Executable file
View File

@@ -0,0 +1,22 @@
#
# Copyright (C) 2006 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

102
host/windows/usb/api/SOURCES Executable file
View File

@@ -0,0 +1,102 @@
#
# Copyright (C) 2006 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
TARGETNAME = AdbWinApi
TARGETPATH = obj
TARGETTYPE = DYNLINK
UMTYPE = windows
DLLDEF = AdbWinApi.def
# Use statically linked atl libraries:
# - atls.lib for free build
# - atlsd.lib for checked build
USE_STATIC_ATL = 1
# Use ATL v. 7.1
ATL_VER = 71
# Use STL v. 6.0
USE_STL = 1
STL_VER = 60
# Use multithreaded libraries
USE_LIBCMT = 1
# Include directories
INCLUDES = $(DDK_INC_PATH); \
$(SDK_INC_PATH); \
$(CRT_INC_PATH); \
$(SDK_INC_PATH)\crt; \
$(CRT_INC_PATH)\atl71; \
$(SDK_INC_PATH)\crt\stl60
# Common target libraries
TARGETLIBS = $(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\Advapi32.lib \
$(SDK_LIB_PATH)\Kernel32.lib \
$(SDK_LIB_PATH)\User32.lib \
$(SDK_LIB_PATH)\oleaut32.lib \
$(SDK_LIB_PATH)\wbemuuid.lib \
$(SDK_LIB_PATH)\uuid.lib \
$(SDK_LIB_PATH)\setupapi.lib \
$(SDK_LIB_PATH)\usbd.lib \
$(SDK_LIB_PATH)\winusb.lib
!IF "$(DDKBUILDENV)" == "fre"
# Libraries for release (free) builds
TARGETLIBS = $(TARGETLIBS) $(ATL_LIB_PATH)\atls.lib
!ELSE
# Libraries for debug (checked) builds
TARGETLIBS = $(TARGETLIBS) $(ATL_LIB_PATH)\atlsd.lib
!ENDIF
# Common C defines
C_DEFINES= $(C_DEFINES) -DADBWIN_EXPORTS -D_UNICODE \
-DUNICODE -DWIN32 -D_WINDOWS -D_USRDLL -D_WINDLL
!IF "$(DDKBUILDENV)" == "fre"
# C defines for release (free) builds
C_DEFINES = $(C_DEFINES) -DNDEBUG
!ELSE
# C defines for debug (checked) builds
C_DEFINES = $(C_DEFINES) -D_DEBUG
!ENDIF
# Turn on all warnings, and treat warnings as errors
MSC_WARNING_LEVEL = /W4 /Wp64 /WX
# Common C defines
USER_C_FLAGS = $(USER_C_FLAGS) /FD /EHsc /wd4100 /wd4200 /wd4702 /nologo
# Set precompiled header information
PRECOMPILED_CXX = 1
PRECOMPILED_INCLUDE = stdafx.h
PRECOMPILED_SOURCEFILE = stdafx.cpp
# Define source files for AdbWinApi.dll
SOURCES = adb_api.cpp \
adb_endpoint_object.cpp \
adb_winusb_endpoint_object.cpp \
adb_legacy_endpoint_object.cpp \
adb_helper_routines.cpp \
adb_interface.cpp \
adb_winusb_interface.cpp \
adb_legacy_interface.cpp \
adb_interface_enum.cpp \
adb_io_completion.cpp \
adb_winusb_io_completion.cpp \
adb_legacy_io_completion.cpp \
adb_object_handle.cpp \
AdbWinApi.cpp \
AdbWinApi.rc

View File

@@ -24,11 +24,13 @@
#include "adb_object_handle.h" #include "adb_object_handle.h"
#include "adb_interface_enum.h" #include "adb_interface_enum.h"
#include "adb_interface.h" #include "adb_interface.h"
#include "adb_winusb_interface.h"
#include "adb_legacy_interface.h"
#include "adb_endpoint_object.h" #include "adb_endpoint_object.h"
#include "adb_io_completion.h" #include "adb_io_completion.h"
#include "adb_helper_routines.h" #include "adb_helper_routines.h"
ADBAPIHANDLE AdbEnumInterfaces(GUID class_id, ADBAPIHANDLE __cdecl AdbEnumInterfaces(GUID class_id,
bool exclude_not_present, bool exclude_not_present,
bool exclude_removed, bool exclude_removed,
bool active_only) { bool active_only) {
@@ -56,7 +58,7 @@ ADBAPIHANDLE AdbEnumInterfaces(GUID class_id,
return ret; return ret;
} }
bool AdbNextInterface(ADBAPIHANDLE adb_handle, bool __cdecl AdbNextInterface(ADBAPIHANDLE adb_handle,
AdbInterfaceInfo* info, AdbInterfaceInfo* info,
unsigned long* size) { unsigned long* size) {
if (NULL == size) { if (NULL == size) {
@@ -78,7 +80,7 @@ bool AdbNextInterface(ADBAPIHANDLE adb_handle,
return ret; return ret;
} }
bool AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle) { bool __cdecl AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle) {
// Lookup AdbInterfaceEnumObject object for the handle // Lookup AdbInterfaceEnumObject object for the handle
AdbInterfaceEnumObject* adb_ienum_object = AdbInterfaceEnumObject* adb_ienum_object =
LookupObject<AdbInterfaceEnumObject>(adb_handle); LookupObject<AdbInterfaceEnumObject>(adb_handle);
@@ -93,14 +95,18 @@ bool AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle) {
return ret; return ret;
} }
ADBWIN_API ADBAPIHANDLE AdbCreateInterfaceByName( ADBAPIHANDLE __cdecl AdbCreateInterfaceByName(
const wchar_t* interface_name) { const wchar_t* interface_name) {
AdbInterfaceObject* obj = NULL; AdbInterfaceObject* obj = NULL;
ADBAPIHANDLE ret = NULL; ADBAPIHANDLE ret = NULL;
try { try {
// Instantiate object // Instantiate object
obj = new AdbInterfaceObject(interface_name); if (IsLegacyInterface(interface_name)) {
obj = new AdbLegacyInterfaceObject(interface_name);
} else {
obj = new AdbWinUsbInterfaceObject(interface_name);
}
// Create handle for it // Create handle for it
ret = obj->CreateHandle(); ret = obj->CreateHandle();
@@ -114,7 +120,7 @@ ADBWIN_API ADBAPIHANDLE AdbCreateInterfaceByName(
return ret; return ret;
} }
ADBAPIHANDLE AdbCreateInterface(GUID class_id, ADBAPIHANDLE __cdecl AdbCreateInterface(GUID class_id,
unsigned short vendor_id, unsigned short vendor_id,
unsigned short product_id, unsigned short product_id,
unsigned char interface_id) { unsigned char interface_id) {
@@ -159,7 +165,7 @@ ADBAPIHANDLE AdbCreateInterface(GUID class_id,
for (AdbEnumInterfaceArray::iterator it = interfaces.begin(); for (AdbEnumInterfaceArray::iterator it = interfaces.begin();
it != interfaces.end(); it++) { it != interfaces.end(); it++) {
const AdbInstanceEnumEntry& next_interface = *it; const AdbInstanceEnumEntry& next_interface = *it;
if (0 == wcsnicmp(match_name, if (0 == _wcsnicmp(match_name,
next_interface.device_name().c_str(), next_interface.device_name().c_str(),
match_len)) { match_len)) {
// Found requested interface among active interfaces. // Found requested interface among active interfaces.
@@ -171,7 +177,7 @@ ADBAPIHANDLE AdbCreateInterface(GUID class_id,
return NULL; return NULL;
} }
bool AdbGetInterfaceName(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetInterfaceName(ADBAPIHANDLE adb_interface,
void* buffer, void* buffer,
unsigned long* buffer_char_size, unsigned long* buffer_char_size,
bool ansi) { bool ansi) {
@@ -190,7 +196,7 @@ bool AdbGetInterfaceName(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetSerialNumber(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetSerialNumber(ADBAPIHANDLE adb_interface,
void* buffer, void* buffer,
unsigned long* buffer_char_size, unsigned long* buffer_char_size,
bool ansi) { bool ansi) {
@@ -209,7 +215,7 @@ bool AdbGetSerialNumber(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface,
USB_DEVICE_DESCRIPTOR* desc) { USB_DEVICE_DESCRIPTOR* desc) {
// Lookup interface object for the handle // Lookup interface object for the handle
AdbInterfaceObject* adb_object = AdbInterfaceObject* adb_object =
@@ -226,7 +232,7 @@ bool AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetUsbConfigurationDescriptor(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetUsbConfigurationDescriptor(ADBAPIHANDLE adb_interface,
USB_CONFIGURATION_DESCRIPTOR* desc) { USB_CONFIGURATION_DESCRIPTOR* desc) {
// Lookup interface object for the handle // Lookup interface object for the handle
AdbInterfaceObject* adb_object = AdbInterfaceObject* adb_object =
@@ -243,7 +249,7 @@ bool AdbGetUsbConfigurationDescriptor(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface,
USB_INTERFACE_DESCRIPTOR* desc) { USB_INTERFACE_DESCRIPTOR* desc) {
// Lookup interface object for the handle // Lookup interface object for the handle
AdbInterfaceObject* adb_object = AdbInterfaceObject* adb_object =
@@ -260,7 +266,7 @@ bool AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetEndpointInformation(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetEndpointInformation(ADBAPIHANDLE adb_interface,
UCHAR endpoint_index, UCHAR endpoint_index,
AdbEndpointInformation* info) { AdbEndpointInformation* info) {
// Lookup interface object for the handle // Lookup interface object for the handle
@@ -278,21 +284,21 @@ bool AdbGetEndpointInformation(ADBAPIHANDLE adb_interface,
} }
} }
bool AdbGetDefaultBulkReadEndpointInformation(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetDefaultBulkReadEndpointInformation(ADBAPIHANDLE adb_interface,
AdbEndpointInformation* info) { AdbEndpointInformation* info) {
return AdbGetEndpointInformation(adb_interface, return AdbGetEndpointInformation(adb_interface,
ADB_QUERY_BULK_READ_ENDPOINT_INDEX, ADB_QUERY_BULK_READ_ENDPOINT_INDEX,
info); info);
} }
bool AdbGetDefaultBulkWriteEndpointInformation(ADBAPIHANDLE adb_interface, bool __cdecl AdbGetDefaultBulkWriteEndpointInformation(ADBAPIHANDLE adb_interface,
AdbEndpointInformation* info) { AdbEndpointInformation* info) {
return AdbGetEndpointInformation(adb_interface, return AdbGetEndpointInformation(adb_interface,
ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX, ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX,
info); info);
} }
ADBAPIHANDLE AdbOpenEndpoint(ADBAPIHANDLE adb_interface, ADBAPIHANDLE __cdecl AdbOpenEndpoint(ADBAPIHANDLE adb_interface,
unsigned char endpoint_index, unsigned char endpoint_index,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode) { AdbOpenSharingMode sharing_mode) {
@@ -312,7 +318,7 @@ ADBAPIHANDLE AdbOpenEndpoint(ADBAPIHANDLE adb_interface,
} }
} }
ADBAPIHANDLE AdbOpenDefaultBulkReadEndpoint(ADBAPIHANDLE adb_interface, ADBAPIHANDLE __cdecl AdbOpenDefaultBulkReadEndpoint(ADBAPIHANDLE adb_interface,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode) { AdbOpenSharingMode sharing_mode) {
return AdbOpenEndpoint(adb_interface, return AdbOpenEndpoint(adb_interface,
@@ -321,7 +327,7 @@ ADBAPIHANDLE AdbOpenDefaultBulkReadEndpoint(ADBAPIHANDLE adb_interface,
sharing_mode); sharing_mode);
} }
ADBAPIHANDLE AdbOpenDefaultBulkWriteEndpoint(ADBAPIHANDLE adb_interface, ADBAPIHANDLE __cdecl AdbOpenDefaultBulkWriteEndpoint(ADBAPIHANDLE adb_interface,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode) { AdbOpenSharingMode sharing_mode) {
return AdbOpenEndpoint(adb_interface, return AdbOpenEndpoint(adb_interface,
@@ -330,7 +336,7 @@ ADBAPIHANDLE AdbOpenDefaultBulkWriteEndpoint(ADBAPIHANDLE adb_interface,
sharing_mode); sharing_mode);
} }
ADBAPIHANDLE AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint) { ADBAPIHANDLE __cdecl AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint) {
// Lookup endpoint object for the handle // Lookup endpoint object for the handle
AdbEndpointObject* adb_object = AdbEndpointObject* adb_object =
LookupObject<AdbEndpointObject>(adb_endpoint); LookupObject<AdbEndpointObject>(adb_endpoint);
@@ -346,7 +352,7 @@ ADBAPIHANDLE AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint) {
} }
} }
bool AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint, bool __cdecl AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint,
AdbEndpointInformation* info) { AdbEndpointInformation* info) {
// Lookup endpoint object for the handle // Lookup endpoint object for the handle
AdbEndpointObject* adb_object = AdbEndpointObject* adb_object =
@@ -363,7 +369,7 @@ bool AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint,
} }
} }
ADBAPIHANDLE AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint, ADBAPIHANDLE __cdecl AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_read, unsigned long bytes_to_read,
unsigned long* bytes_read, unsigned long* bytes_read,
@@ -388,7 +394,7 @@ ADBAPIHANDLE AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint,
} }
} }
ADBAPIHANDLE AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint, ADBAPIHANDLE __cdecl AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_write, unsigned long bytes_to_write,
unsigned long* bytes_written, unsigned long* bytes_written,
@@ -413,7 +419,7 @@ ADBAPIHANDLE AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint,
} }
} }
bool AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint, bool __cdecl AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_read, unsigned long bytes_to_read,
unsigned long* bytes_read, unsigned long* bytes_read,
@@ -434,7 +440,7 @@ bool AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint,
} }
} }
bool AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint, bool __cdecl AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_write, unsigned long bytes_to_write,
unsigned long* bytes_written, unsigned long* bytes_written,
@@ -455,7 +461,7 @@ bool AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint,
} }
} }
bool AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion, bool __cdecl AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion,
LPOVERLAPPED overlapped, LPOVERLAPPED overlapped,
unsigned long* bytes_transferred, unsigned long* bytes_transferred,
bool wait) { bool wait) {
@@ -475,7 +481,7 @@ bool AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion,
} }
} }
bool AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion) { bool __cdecl AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion) {
// Lookup endpoint object for the handle // Lookup endpoint object for the handle
AdbIOCompletion* adb_object = AdbIOCompletion* adb_object =
LookupObject<AdbIOCompletion>(adb_io_completion); LookupObject<AdbIOCompletion>(adb_io_completion);
@@ -492,7 +498,7 @@ bool AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion) {
} }
} }
bool AdbCloseHandle(ADBAPIHANDLE adb_handle) { bool __cdecl AdbCloseHandle(ADBAPIHANDLE adb_handle) {
// Lookup object for the handle // Lookup object for the handle
AdbObjectHandle* adb_object = AdbObjectHandle::Lookup(adb_handle); AdbObjectHandle* adb_object = AdbObjectHandle::Lookup(adb_handle);

View File

@@ -16,15 +16,12 @@
#ifndef ANDROID_USB_API_ADBWINAPI_H__ #ifndef ANDROID_USB_API_ADBWINAPI_H__
#define ANDROID_USB_API_ADBWINAPI_H__ #define ANDROID_USB_API_ADBWINAPI_H__
/** \file /** \file
This file consists of declarations of routines exported by the API as well This file consists of declarations of routines exported by the API as well
as types, structures, and constants definitions used in the API. as types, structures, and constants definitions used in the API.
Declarations in this file, combined with definitions found in adb_api_extra.h
comprise ADB API for windows.
*/ */
#include "adb_api_extra.h"
// Enables compillation for "straight" C // Enables compillation for "straight" C
#ifdef __cplusplus #ifdef __cplusplus
#define EXTERN_C extern "C" #define EXTERN_C extern "C"
@@ -35,6 +32,84 @@
#define false 0 #define false 0
#endif #endif
/** \brief Enumerates ADB endpoint types.
This enum is taken from WDF_USB_PIPE_TYPE enum found in WDK.
*/
typedef enum _AdbEndpointType {
/// Unknown (invalid, or not initialized) endpoint type.
AdbEndpointTypeInvalid = 0,
/// Endpoint is device control pipe.
AdbEndpointTypeControl,
/// Endpoint is isochronous r/w pipe.
AdbEndpointTypeIsochronous,
/// Endpoint is a bulk r/w pipe.
AdbEndpointTypeBulk,
/// Endpoint is an interrupt r/w pipe.
AdbEndpointTypeInterrupt,
} AdbEndpointType;
/** \brief Endpoint desriptor.
This structure is based on WDF_USB_PIPE_INFORMATION structure found in WDK.
*/
typedef struct _AdbEndpointInformation {
/// Maximum packet size this endpoint is capable of.
unsigned long max_packet_size;
/// Maximum size of one transfer which should be sent to the host controller.
unsigned long max_transfer_size;
/// ADB endpoint type.
AdbEndpointType endpoint_type;
/// Raw endpoint address on the device as described by its descriptor.
unsigned char endpoint_address;
/// Polling interval.
unsigned char polling_interval;
/// Which alternate setting this structure is relevant for.
unsigned char setting_index;
} AdbEndpointInformation;
/// Shortcut to default write bulk endpoint in zero-based endpoint index API.
#define ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX 0xFC
/// Shortcut to default read bulk endpoint in zero-based endpoint index API.
#define ADB_QUERY_BULK_READ_ENDPOINT_INDEX 0xFE
// {F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
/// Our USB class id that driver uses to register our device.
#define ANDROID_USB_CLASS_ID \
{0xf72fe0d4, 0xcbcb, 0x407d, {0x88, 0x14, 0x9e, 0xd6, 0x73, 0xd0, 0xdd, 0x6b}};
/// Defines vendor ID for HCT devices.
#define DEVICE_VENDOR_ID 0x0BB4
/// Defines product ID for the device with single interface.
#define DEVICE_SINGLE_PRODUCT_ID 0x0C01
/// Defines product ID for the Dream composite device.
#define DEVICE_COMPOSITE_PRODUCT_ID 0x0C02
/// Defines product ID for the Magic composite device.
#define DEVICE_MAGIC_COMPOSITE_PRODUCT_ID 0x0C03
/// Defines interface ID for the device.
#define DEVICE_INTERFACE_ID 0x01
/// Defines vendor ID for the device
#define DEVICE_EMULATOR_VENDOR_ID 0x18D1
/// Defines product ID for a SoftUSB device simulator that is used to test
/// the driver in isolation from hardware.
#define DEVICE_EMULATOR_PROD_ID 0xDDDD
// The following ifdef block is the standard way of creating macros which make // The following ifdef block is the standard way of creating macros which make
// exporting from a DLL simpler. All files within this DLL are compiled with // exporting from a DLL simpler. All files within this DLL are compiled with
// the ADBWIN_EXPORTS symbol defined on the command line. this symbol should // the ADBWIN_EXPORTS symbol defined on the command line. this symbol should
@@ -48,7 +123,7 @@
#define ADBWIN_API EXTERN_C __declspec(dllimport) #define ADBWIN_API EXTERN_C __declspec(dllimport)
#endif #endif
/** Handle to an API object /** \brief Handle to an API object.
To access USB interface and its components clients must first obtain a To access USB interface and its components clients must first obtain a
handle to the required object. API Objects that are represented by a handle to the required object. API Objects that are represented by a
@@ -83,41 +158,41 @@
*/ */
typedef void* ADBAPIHANDLE; typedef void* ADBAPIHANDLE;
/** Enumeration AdbOpenAccessType defines access type with which /** \brief Defines access type with which an I/O object (endpoint)
an I/O object (endpoint) should be opened. should be opened.
*/ */
typedef enum _AdbOpenAccessType { typedef enum _AdbOpenAccessType {
/// Opens for read and write access /// Opens for read and write access.
AdbOpenAccessTypeReadWrite, AdbOpenAccessTypeReadWrite,
/// Opens for read only access /// Opens for read only access.
AdbOpenAccessTypeRead, AdbOpenAccessTypeRead,
/// Opens for write only access /// Opens for write only access.
AdbOpenAccessTypeWrite, AdbOpenAccessTypeWrite,
/// Opens for querying information /// Opens for querying information.
AdbOpenAccessTypeQueryInfo, AdbOpenAccessTypeQueryInfo,
} AdbOpenAccessType; } AdbOpenAccessType;
/** Enumeration AdbOpenSharingMode defines sharing mode with which /** \brief Defines sharing mode with which an I/O object (endpoint)
an I/O object (endpoint) should be opened. should be opened.
*/ */
typedef enum _AdbOpenSharingMode { typedef enum _AdbOpenSharingMode {
/// Shares read and write /// Shares read and write.
AdbOpenSharingModeReadWrite, AdbOpenSharingModeReadWrite,
/// Shares only read /// Shares only read.
AdbOpenSharingModeRead, AdbOpenSharingModeRead,
/// Shares only write /// Shares only write.
AdbOpenSharingModeWrite, AdbOpenSharingModeWrite,
/// Opens exclusive /// Opens exclusive.
AdbOpenSharingModeExclusive, AdbOpenSharingModeExclusive,
} AdbOpenSharingMode; } AdbOpenSharingMode;
/** Structure AdbInterfaceInfo provides information about an interface /** \brief Provides information about an interface.
*/ */
typedef struct _AdbInterfaceInfo { typedef struct _AdbInterfaceInfo {
/// Inteface's class id (see SP_DEVICE_INTERFACE_DATA for details) /// Inteface's class id (see SP_DEVICE_INTERFACE_DATA for details)
@@ -137,30 +212,30 @@ typedef struct _AdbInterfaceInfo {
This routine uses SetupDiGetClassDevs SDK routine to enumerate devices that This routine uses SetupDiGetClassDevs SDK routine to enumerate devices that
match class ID and then SetupDiEnumDeviceInterfaces SDK routine is called match class ID and then SetupDiEnumDeviceInterfaces SDK routine is called
to enumerate interfaces on the devices. to enumerate interfaces on the devices.
@param class_id[in] Device class ID, assigned by the driver. @param[in] class_id Device class ID, assigned by the driver.
@param exclude_not_present[in] If 'true' enumation will include only those @param[in] exclude_not_present If true enumation will include only those
devices that are currently present. devices that are currently present.
@param exclude_removed[in] If 'true' interfaces with SPINT_REMOVED flag set @param[in] exclude_removed If true interfaces with SPINT_REMOVED flag set
will be not included in the enumeration. will be not included in the enumeration.
@param active_only[in] If 'true' only active interfaces (with flag @param[in] active_only If true only active interfaces (with flag
SPINT_ACTIVE set) will be included in the enumeration. SPINT_ACTIVE set) will be included in the enumeration.
@return Handle to the enumerator object or NULL on failure. If NULL is @return Handle to the enumerator object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbEnumInterfaces(GUID class_id, ADBWIN_API ADBAPIHANDLE __cdecl AdbEnumInterfaces(GUID class_id,
bool exclude_not_present, bool exclude_not_present,
bool exclude_removed, bool exclude_removed,
bool active_only); bool active_only);
/** \brief Gets next interface information /** \brief Gets next interface information
@param adb_handle[in] Handle to interface enumerator object obtained via @param[in] adb_handle Handle to interface enumerator object obtained via
AdbEnumInterfaces call. AdbEnumInterfaces call.
@param info[out] Upon successful completion will receive interface @param[out] info Upon successful completion will receive interface
information. Can be NULL. If it is NULL, upon return from this information. Can be NULL. If it is NULL, upon return from this
routine size parameter will contain memory size required for the routine size parameter will contain memory size required for the
next entry. next entry.
@param size[in,out]. On the way in provides size of the memory buffer @param[in,out] size On the way in provides size of the memory buffer
addressed by info parameter. On the way out (only if buffer was not addressed by info parameter. On the way out (only if buffer was not
big enough) will provide memory size required for the next entry. big enough) will provide memory size required for the next entry.
@return true on success, false on error. If false is returned @return true on success, false on error. If false is returned
@@ -170,86 +245,86 @@ ADBWIN_API ADBAPIHANDLE AdbEnumInterfaces(GUID class_id,
required for the next entry. ERROR_NO_MORE_ITEMS indicates that required for the next entry. ERROR_NO_MORE_ITEMS indicates that
enumeration is over and there are no more entries to return. enumeration is over and there are no more entries to return.
*/ */
ADBWIN_API bool AdbNextInterface(ADBAPIHANDLE adb_handle, ADBWIN_API bool __cdecl AdbNextInterface(ADBAPIHANDLE adb_handle,
AdbInterfaceInfo* info, AdbInterfaceInfo* info,
unsigned long* size); unsigned long* size);
/** \brief Resets enumerator so next call to AdbNextInterface will start /** \brief Resets enumerator so next call to AdbNextInterface will start
from the beginning. from the beginning.
@param adb_handle[in] Handle to interface enumerator object obtained via @param[in] adb_handle Handle to interface enumerator object obtained via
AdbEnumInterfaces call. AdbEnumInterfaces call.
@return true on success, false on error. If false is returned GetLastError() @return true on success, false on error. If false is returned GetLastError()
provides extended error information. provides extended error information.
*/ */
ADBWIN_API bool AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle); ADBWIN_API bool __cdecl AdbResetInterfaceEnum(ADBAPIHANDLE adb_handle);
/** \brief Creates USB interface object /** \brief Creates USB interface object
This routine creates an object that represents a USB interface. This routine creates an object that represents a USB interface.
@param interface_name[in] Name of the interface. @param[in] interface_name Name of the interface.
@return Handle to the interface object or NULL on failure. If NULL is @return Handle to the interface object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbCreateInterfaceByName(const wchar_t* interface_name); ADBWIN_API ADBAPIHANDLE __cdecl AdbCreateInterfaceByName(const wchar_t* interface_name);
/** \brief /** \brief Creates USB interface object based on vendor, product and
Creates USB interface object based on vendor, product and interface IDs. interface IDs.
This routine creates and object that represents a USB interface on our This routine creates and object that represents a USB interface on our
device. It uses AdbCreateInterfaceByName to actually do the create. device. It uses AdbCreateInterfaceByName to actually do the create.
@param class_id[in] Device class ID, assigned by the driver. @param[in] class_id Device class ID, assigned by the driver.
@param vendor_id[in] Device vendor ID @param[in] vendor_id Device vendor ID
@param product_id[in] Device product ID @param[in] product_id Device product ID
@param interface_id[in] Device interface ID. This parameter is optional. @param[in] interface_id Device interface ID. This parameter is optional.
Value 0xFF indicates that interface should be addressed by vendor Value 0xFF indicates that interface should be addressed by vendor
and product IDs only. and product IDs only.
@return Handle to the interface object or NULL on failure. If NULL is @return Handle to the interface object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbCreateInterface(GUID class_id, ADBWIN_API ADBAPIHANDLE __cdecl AdbCreateInterface(GUID class_id,
unsigned short vendor_id, unsigned short vendor_id,
unsigned short product_id, unsigned short product_id,
unsigned char interface_id); unsigned char interface_id);
/** \brief Gets interface name. /** \brief Gets interface name.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param buffer[out] Buffer for the name. Can be NULL in which case @param[out] buffer Buffer for the name. Can be NULL in which case
buffer_char_size will contain number of characters required for buffer_char_size will contain number of characters required for
the name. the name.
@param buffer_char_size[in/out] On the way in supplies size (in characters) @param[in,out] buffer_char_size On the way in supplies size (in characters)
of the buffer. On the way out, if method failed and GetLastError of the buffer. On the way out, if method failed and GetLastError
reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters
required for the name. required for the name.
@param ansi[in] If 'true' the name will be returned as single character @param[in] ansi If true the name will be returned as single character
string. Otherwise name will be returned as wide character string. string. Otherwise name will be returned as wide character string.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetInterfaceName(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetInterfaceName(ADBAPIHANDLE adb_interface,
void* buffer, void* buffer,
unsigned long* buffer_char_size, unsigned long* buffer_char_size,
bool ansi); bool ansi);
/** \brief Gets serial number for interface's device. /** \brief Gets serial number for interface's device.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param buffer[out] Buffer for the serail number string. Can be NULL in which @param[out] buffer Buffer for the serail number string. Can be NULL in which
case buffer_char_size will contain number of characters required for case buffer_char_size will contain number of characters required for
the string. the string.
@param buffer_char_size[in/out] On the way in supplies size (in characters) @param[in,out] buffer_char_size On the way in supplies size (in characters)
of the buffer. On the way out, if method failed and GetLastError of the buffer. On the way out, if method failed and GetLastError
reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters reports ERROR_INSUFFICIENT_BUFFER, will contain number of characters
required for the name. required for the name.
@param ansi[in] If 'true' the name will be returned as single character @param[in] ansi If true the name will be returned as single character
string. Otherwise name will be returned as wide character string. string. Otherwise name will be returned as wide character string.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetSerialNumber(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetSerialNumber(ADBAPIHANDLE adb_interface,
void* buffer, void* buffer,
unsigned long* buffer_char_size, unsigned long* buffer_char_size,
bool ansi); bool ansi);
@@ -257,99 +332,102 @@ ADBWIN_API bool AdbGetSerialNumber(ADBAPIHANDLE adb_interface,
/** \brief Gets device descriptor for the USB device associated with /** \brief Gets device descriptor for the USB device associated with
the given interface. the given interface.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param desc[out] Upon successful completion will have usb device @param[out] desc Upon successful completion will have usb device
descriptor. descriptor.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetUsbDeviceDescriptor(ADBAPIHANDLE adb_interface,
USB_DEVICE_DESCRIPTOR* desc); USB_DEVICE_DESCRIPTOR* desc);
/** \brief Gets descriptor for the selected USB device configuration. /** \brief Gets descriptor for the selected USB device configuration.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param desc[out] Upon successful completion will have usb device @param[out] desc Upon successful completion will have usb device
configuration descriptor. configuration descriptor.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetUsbConfigurationDescriptor(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetUsbConfigurationDescriptor(
ADBAPIHANDLE adb_interface,
USB_CONFIGURATION_DESCRIPTOR* desc); USB_CONFIGURATION_DESCRIPTOR* desc);
/** \brief Gets descriptor for the given interface. /** \brief Gets descriptor for the given interface.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param desc[out] Upon successful completion will have usb device @param[out] desc Upon successful completion will have usb device
configuration descriptor. configuration descriptor.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetUsbInterfaceDescriptor(ADBAPIHANDLE adb_interface,
USB_INTERFACE_DESCRIPTOR* desc); USB_INTERFACE_DESCRIPTOR* desc);
/** \brief Gets information about an endpoint on the given interface. /** \brief Gets information about an endpoint on the given interface.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param endpoint_index[in] Zero-based endpoint index. There are two @param[in] endpoint_index Zero-based endpoint index. There are two
shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX
and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information
about bulk write and bulk read endpoints respectively. about bulk write and bulk read endpoints respectively.
@param info[out] Upon successful completion will have endpoint information. @param[out] info Upon successful completion will have endpoint information.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetEndpointInformation(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetEndpointInformation(ADBAPIHANDLE adb_interface,
unsigned char endpoint_index, unsigned char endpoint_index,
AdbEndpointInformation* info); AdbEndpointInformation* info);
/** \brief /** \brief Gets information about default bulk read endpoint on the given
Gets information about default bulk read endpoint on the given interface. interface.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param info[out] Upon successful completion will have endpoint information. @param[out] info Upon successful completion will have endpoint information.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetDefaultBulkReadEndpointInformation(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetDefaultBulkReadEndpointInformation(
ADBAPIHANDLE adb_interface,
AdbEndpointInformation* info); AdbEndpointInformation* info);
/** \brief /** \brief Gets information about default bulk write endpoint on the given
Gets information about default bulk write endpoint on the given interface. interface.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param info[out] Upon successful completion will have endpoint information. @param[out] info Upon successful completion will have endpoint information.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbGetDefaultBulkWriteEndpointInformation(ADBAPIHANDLE adb_interface, ADBWIN_API bool __cdecl AdbGetDefaultBulkWriteEndpointInformation(
ADBAPIHANDLE adb_interface,
AdbEndpointInformation* info); AdbEndpointInformation* info);
/** \brief Opens an endpoint on the given interface. /** \brief Opens an endpoint on the given interface.
Endpoints are always opened for overlapped I/O. Endpoints are always opened for overlapped I/O.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param endpoint_index[in] Zero-based endpoint index. There are two @param[in] endpoint_index Zero-based endpoint index. There are two
shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX shortcuts for this parameter: ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX
and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information and ADB_QUERY_BULK_READ_ENDPOINT_INDEX that provide information
about bulk write and bulk read endpoints respectively. about bulk write and bulk read endpoints respectively.
@param access_type[in] Desired access type. In the current implementation @param[in] access_type Desired access type. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always read / write access. always read / write access.
@param sharing_mode[in] Desired share mode. In the current implementation @param[in] sharing_mode Desired share mode. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always shared for read / write. always shared for read / write.
@return Handle to the opened endpoint object or NULL on failure. If NULL is @return Handle to the opened endpoint object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbOpenEndpoint(ADBAPIHANDLE adb_interface, ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenEndpoint(ADBAPIHANDLE adb_interface,
unsigned char endpoint_index, unsigned char endpoint_index,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode); AdbOpenSharingMode sharing_mode);
@@ -357,76 +435,78 @@ ADBWIN_API ADBAPIHANDLE AdbOpenEndpoint(ADBAPIHANDLE adb_interface,
/** \brief Opens default bulk read endpoint on the given interface. /** \brief Opens default bulk read endpoint on the given interface.
Endpoints are always opened for overlapped I/O. Endpoints are always opened for overlapped I/O.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param access_type[in] Desired access type. In the current implementation @param[in] access_type Desired access type. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always read / write access. always read / write access.
@param sharing_mode[in] Desired share mode. In the current implementation @param[in] sharing_mode Desired share mode. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always shared for read / write. always shared for read / write.
@return Handle to the opened endpoint object or NULL on failure. If NULL is @return Handle to the opened endpoint object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbOpenDefaultBulkReadEndpoint(ADBAPIHANDLE adb_interface, ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenDefaultBulkReadEndpoint(
ADBAPIHANDLE adb_interface,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode); AdbOpenSharingMode sharing_mode);
/** \brief Opens default bulk write endpoint on the given interface. /** \brief Opens default bulk write endpoint on the given interface.
Endpoints are always opened for overlapped I/O. Endpoints are always opened for overlapped I/O.
@param adb_interface[in] A handle to interface object created with @param[in] adb_interface A handle to interface object created with
AdbCreateInterface call. AdbCreateInterface call.
@param access_type[in] Desired access type. In the current implementation @param[in] access_type Desired access type. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always read / write access. always read / write access.
@param sharing_mode[in] Desired share mode. In the current implementation @param[in] sharing_mode Desired share mode. In the current implementation
this parameter has no effect on the way endpoint is opened. It's this parameter has no effect on the way endpoint is opened. It's
always shared for read / write. always shared for read / write.
@return Handle to the opened endpoint object or NULL on failure. If NULL is @return Handle to the opened endpoint object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbOpenDefaultBulkWriteEndpoint(ADBAPIHANDLE adb_interface, ADBWIN_API ADBAPIHANDLE __cdecl AdbOpenDefaultBulkWriteEndpoint(
ADBAPIHANDLE adb_interface,
AdbOpenAccessType access_type, AdbOpenAccessType access_type,
AdbOpenSharingMode sharing_mode); AdbOpenSharingMode sharing_mode);
/** \brief Gets handle to interface object for the given endpoint /** \brief Gets handle to interface object for the given endpoint
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@return Handle to the interface for this endpoint or NULL on failure. If NULL @return Handle to the interface for this endpoint or NULL on failure. If NULL
is returned GetLastError() provides extended error information. is returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint); ADBWIN_API ADBAPIHANDLE __cdecl AdbGetEndpointInterface(ADBAPIHANDLE adb_endpoint);
/** \brief Gets information about the given endpoint. /** \brief Gets information about the given endpoint.
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@param info[out] Upon successful completion will have endpoint information. @param[out] info Upon successful completion will have endpoint information.
@return 'true' on success, 'false' on failure. If 'false' is returned @return true on success, false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint, ADBWIN_API bool __cdecl AdbQueryInformationEndpoint(ADBAPIHANDLE adb_endpoint,
AdbEndpointInformation* info); AdbEndpointInformation* info);
/** \brief Asynchronously reads from the given endpoint. /** \brief Asynchronously reads from the given endpoint.
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@param buffer[out] Pointer to the buffer that receives the data. @param[out] buffer Pointer to the buffer that receives the data.
@param bytes_to_read[in] Number of bytes to be read. @param[in] bytes_to_read Number of bytes to be read.
@param bytes_read[out] Number of bytes read. Can be NULL. @param[out] bytes_read Number of bytes read. Can be NULL.
@param event_handle[in] Event handle that should be signaled when async I/O @param[in] event_handle Event handle that should be signaled when async I/O
completes. Can be NULL. If it's not NULL this handle will be used to completes. Can be NULL. If it's not NULL this handle will be used to
initialize OVERLAPPED structure for this I/O. initialize OVERLAPPED structure for this I/O.
@param time_out[in] A timeout (in milliseconds) required for this I/O to @param[in] time_out A timeout (in milliseconds) required for this I/O to
complete. Zero value for this parameter means that there is no complete. Zero value for this parameter means that there is no
timeout for this I/O. timeout for this I/O.
@return A handle to IO completion object or NULL on failure. If NULL is @return A handle to IO completion object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint, ADBWIN_API ADBAPIHANDLE __cdecl AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_read, unsigned long bytes_to_read,
unsigned long* bytes_read, unsigned long* bytes_read,
@@ -435,21 +515,21 @@ ADBWIN_API ADBAPIHANDLE AdbReadEndpointAsync(ADBAPIHANDLE adb_endpoint,
/** \brief Asynchronously writes to the given endpoint. /** \brief Asynchronously writes to the given endpoint.
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@param buffer[in] Pointer to the buffer containing the data to be written. @param[in] buffer Pointer to the buffer containing the data to be written.
@param bytes_to_write[in] Number of bytes to be written. @param[in] bytes_to_write Number of bytes to be written.
@param bytes_written[out] Number of bytes written. Can be NULL. @param[out] bytes_written Number of bytes written. Can be NULL.
@param event_handle[in] Event handle that should be signaled when async I/O @param[in] event_handle Event handle that should be signaled when async I/O
completes. Can be NULL. If it's not NULL this handle will be used to completes. Can be NULL. If it's not NULL this handle will be used to
initialize OVERLAPPED structure for this I/O. initialize OVERLAPPED structure for this I/O.
@param time_out[in] A timeout (in milliseconds) required for this I/O to @param[in] time_out A timeout (in milliseconds) required for this I/O to
complete. Zero value for this parameter means that there is no complete. Zero value for this parameter means that there is no
timeout for this I/O. timeout for this I/O.
@return A handle to IO completion object or NULL on failure. If NULL is @return A handle to IO completion object or NULL on failure. If NULL is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API ADBAPIHANDLE AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint, ADBWIN_API ADBAPIHANDLE __cdecl AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_write, unsigned long bytes_to_write,
unsigned long* bytes_written, unsigned long* bytes_written,
@@ -458,18 +538,18 @@ ADBWIN_API ADBAPIHANDLE AdbWriteEndpointAsync(ADBAPIHANDLE adb_endpoint,
/** \brief Synchronously reads from the given endpoint. /** \brief Synchronously reads from the given endpoint.
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@param buffer[out] Pointer to the buffer that receives the data. @param[out] buffer Pointer to the buffer that receives the data.
@param bytes_to_read[in] Number of bytes to be read. @param[in] bytes_to_read Number of bytes to be read.
@param bytes_read[out] Number of bytes read. Can be NULL. @param[out] bytes_read Number of bytes read. Can be NULL.
@param time_out[in] A timeout (in milliseconds) required for this I/O to @param[in] time_out A timeout (in milliseconds) required for this I/O to
complete. Zero value for this parameter means that there is no complete. Zero value for this parameter means that there is no
timeout for this I/O. timeout for this I/O.
@return 'true' on success and 'false' on failure. If 'false' is @return true on success and false on failure. If false is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint, ADBWIN_API bool __cdecl AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_read, unsigned long bytes_to_read,
unsigned long* bytes_read, unsigned long* bytes_read,
@@ -477,65 +557,64 @@ ADBWIN_API bool AdbReadEndpointSync(ADBAPIHANDLE adb_endpoint,
/** \brief Synchronously writes to the given endpoint. /** \brief Synchronously writes to the given endpoint.
@param adb_endpoint[in] A handle to opened endpoint object, obtained via one @param[in] adb_endpoint A handle to opened endpoint object, obtained via one
of the AdbOpenXxxEndpoint calls. of the AdbOpenXxxEndpoint calls.
@param buffer[in] Pointer to the buffer containing the data to be written. @param[in] buffer Pointer to the buffer containing the data to be written.
@param bytes_to_write[in] Number of bytes to be written. @param[in] bytes_to_write Number of bytes to be written.
@param bytes_written[out] Number of bytes written. Can be NULL. @param[out] bytes_written Number of bytes written. Can be NULL.
@param time_out[in] A timeout (in milliseconds) required for this I/O to @param[in] time_out A timeout (in milliseconds) required for this I/O to
complete. Zero value for this parameter means that there is no complete. Zero value for this parameter means that there is no
timeout for this I/O. timeout for this I/O.
@return 'true' on success and 'false' on failure. If 'false' is @return true on success and false on failure. If false is
returned GetLastError() provides extended error information. returned GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint, ADBWIN_API bool __cdecl AdbWriteEndpointSync(ADBAPIHANDLE adb_endpoint,
void* buffer, void* buffer,
unsigned long bytes_to_write, unsigned long bytes_to_write,
unsigned long* bytes_written, unsigned long* bytes_written,
unsigned long time_out); unsigned long time_out);
/** \brief Gets overlapped I/O result for async I/O performed on the /** \brief Gets overlapped I/O result for async I/O performed on the
given endpoint given endpoint.
@param adb_io_completion[in] A handle to an I/O completion object returned @param[in] adb_io_completion A handle to an I/O completion object returned
from AdbRead/WriteAsync routines. from AdbRead/WriteAsync routines.
@param ovl_data[out] Buffer for the copy of this object's OVERLAPPED @param[out] ovl_data Buffer for the copy of this object's OVERLAPPED
structure. Can be NULL. structure. Can be NULL.
@param bytes_transferred[out] Pointer to a variable that receives the @param[out] bytes_transferred Pointer to a variable that receives the
number of bytes that were actually transferred by a read or write number of bytes that were actually transferred by a read or write
operation. See SDK doc on GetOvelappedResult for more information. operation. See SDK doc on GetOvelappedResult for more information.
Unlike regular GetOvelappedResult call this parameter can be NULL. Unlike regular GetOvelappedResult call this parameter can be NULL.
@param wait[in] If this parameter is 'true', the method does not return @param[in] wait If this parameter is true, the method does not return
until the operation has been completed. If this parameter is 'false' until the operation has been completed. If this parameter is false
and the operation is still pending, the method returns 'false' and and the operation is still pending, the method returns false and
the GetLastError function returns ERROR_IO_INCOMPLETE. the GetLastError function returns ERROR_IO_INCOMPLETE.
@return 'true' if I/O has been completed or 'false' on failure or if request @return true if I/O has been completed or false on failure or if request
is not yet completed. If 'false' is returned GetLastError() provides is not yet completed. If false is returned GetLastError() provides
extended error information. If GetLastError returns extended error information. If GetLastError returns
ERROR_IO_INCOMPLETE it means that I/O is not yet completed. ERROR_IO_INCOMPLETE it means that I/O is not yet completed.
*/ */
ADBWIN_API bool AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion, ADBWIN_API bool __cdecl AdbGetOvelappedIoResult(ADBAPIHANDLE adb_io_completion,
LPOVERLAPPED overlapped, LPOVERLAPPED overlapped,
unsigned long* bytes_transferred, unsigned long* bytes_transferred,
bool wait); bool wait);
/** \brief Checks if overlapped I/O has been completed. /** \brief Checks if overlapped I/O has been completed.
@param adb_io_completion[in] A handle to an I/O completion object returned @param[in] adb_io_completion A handle to an I/O completion object returned
from AdbRead/WriteAsync routines. from AdbRead/WriteAsync routines.
@return 'true' if I/O has been completed or 'false' if it's still @return true if I/O has been completed or false if it's still
incomplete. Regardless of the returned value, caller should incomplete. Regardless of the returned value, caller should
check GetLastError to validate that handle was OK. check GetLastError to validate that handle was OK.
*/ */
ADBWIN_API bool AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion); ADBWIN_API bool __cdecl AdbHasOvelappedIoComplated(ADBAPIHANDLE adb_io_completion);
/** \brief Closes handle previously opened with one of the API calls /** \brief Closes handle previously opened with one of the API calls
@param adb_handle[in] ADB handle previously opened with one of the API calls @param[in] adb_handle ADB handle previously opened with one of the API calls
@return 'true' on success or 'false' on failure. If 'false' is returned @return true on success or false on failure. If false is returned
GetLastError() provides extended error information. GetLastError() provides extended error information.
*/ */
ADBWIN_API bool AdbCloseHandle(ADBAPIHANDLE adb_handle); ADBWIN_API bool __cdecl AdbCloseHandle(ADBAPIHANDLE adb_handle);
#endif // ANDROID_USB_API_ADBWINAPI_H__ #endif // ANDROID_USB_API_ADBWINAPI_H__

View File

@@ -1,88 +0,0 @@
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_USB_API_ADB_API_EXTRA_H__
#define ANDROID_USB_API_ADB_API_EXTRA_H__
/** \file
This file consists of public API declarations that are also used by the
driver and as such cannot be declared in adb_api.h
*/
/** AdbEndpointType enumerates endpoint types. It enum is taken from
WDF_USB_PIPE_TYPE enum found in WDK.
*/
typedef enum _AdbEndpointType {
AdbEndpointTypeInvalid = 0,
AdbEndpointTypeControl,
AdbEndpointTypeIsochronous,
AdbEndpointTypeBulk,
AdbEndpointTypeInterrupt,
} AdbEndpointType;
/** Structure AdbEndpointInformation describes an endpoint. It is
based on WDF_USB_PIPE_INFORMATION structure found in WDK.
*/
typedef struct _AdbEndpointInformation {
/// Maximum packet size this endpoint is capable of
unsigned long max_packet_size;
// Maximum size of one transfer which should be sent to the host controller
unsigned long max_transfer_size;
// The type of the endpoint
AdbEndpointType endpoint_type;
/// Raw endpoint address of the device as described by its descriptor
unsigned char endpoint_address;
/// Polling interval
unsigned char polling_interval;
/// Which alternate setting this structure is relevant for
unsigned char setting_index;
} AdbEndpointInformation;
/// Shortcut to default write bulk endpoint in zero-based endpoint index API
#define ADB_QUERY_BULK_WRITE_ENDPOINT_INDEX 0xFC
/// Shortcut to default read bulk endpoint in zero-based endpoint index API
#define ADB_QUERY_BULK_READ_ENDPOINT_INDEX 0xFE
// {F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}
/// Our USB class id that driver uses to register our device
#define ANDROID_USB_CLASS_ID \
{0xf72fe0d4, 0xcbcb, 0x407d, {0x88, 0x14, 0x9e, 0xd6, 0x73, 0xd0, 0xdd, 0x6b}};
/// Defines vendor ID for the device
#define DEVICE_VENDOR_ID 0x0BB4
/// Defines product ID for the device with single interface.
#define DEVICE_SINGLE_PRODUCT_ID 0x0C01
/// Defines product ID for the composite device.
#define DEVICE_COMPOSITE_PRODUCT_ID 0x0C02
/// Defines interface ID for the device.
#define DEVICE_INTERFACE_ID 0x01
/// Defines vendor ID for the device
#define DEVICE_EMULATOR_VENDOR_ID 0x18D1
/// Defines product ID for a SoftUSB device simulator that is used to test
/// the driver in isolation from hardware.
#define DEVICE_EMULATOR_PROD_ID 0xDDDD
#endif // ANDROID_USB_API_ADB_API_EXTRA_H__

Some files were not shown because too many files have changed in this diff Show More