forked from microsoft/busiotools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Microsoft/busiotools
- Loading branch information
Showing
25 changed files
with
2,513 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# How to collect bluetooth logs | ||
|
||
## More info | ||
wpr.exe is available on all version of windows. More details can be found [here.](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh448229%28v%3dwin.10%29) | ||
|
||
wpr.exe /? will also give you more information. | ||
|
||
## Collecting logs | ||
|
||
From an administrator command prompt: | ||
1. Run as admin: "wpr.exe -start BluetoothStack.wprp" | ||
2. Toggle the Bluetooth radio off-on via the quick action menu or force a power cycle of the remote device (we want the connection information). | ||
3. Reproduce the issue. | ||
4. Run as admin: "wpr.exe -stop bth_tracing.etl" | ||
|
||
*Note: This will not continue tracing after a reboot* | ||
|
||
## Collecting logs across reboots | ||
From an administrator command prompt: | ||
1. Run as admin: "wpr.exe -boottrace -addboot BluetoothStack.wprp" | ||
2. Reboot machine | ||
* Trace is not running until you reboot the machine | ||
3. Reproduce the issue - log will keep running across reboots until you stop it manually | ||
4. Run as admin: "wpr.exe -boottrace -stopboot bth_tracing.etl" | ||
|
||
## Collecting logs for driver or setup issues | ||
* Attach c:\windows\inf\setupapi.*.log and c:\Windows\Panther\setupact.log and c:\windows\logs\windowsupdate\* to the bug. | ||
* Attach Microsoft-Windows-Kernel-PnP%4Configuration.evtx (In event viewer as Microsoft-Windows-Kernel-PnP\Configuration). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Building the code: | ||
|
||
1) Clone the code for the ConnectionExerciser project. | ||
2) Clone the following projects into the libraries directory: | ||
|
||
https://github.com/PFroese/ArduinoSerialCommand | ||
https://github.com/mattnichols/Timer | ||
https://github.com/adafruit/Adafruit_TCS34725 | ||
https://github.com/todbot/ServoEaser | ||
|
||
3) Make the following minor modification to the ArduinoSerialCommand library: | ||
- Open SerialCommand.h | ||
- Locate the #define for MAXSERIALCOMMANDS | ||
- Change the value from 16 to 32 | ||
4) Install the Arduino IDE. | ||
5) Under "File | Preferences" change the "Sketchbook location" to the path to the ConnectionExerciser project. | ||
6) Select "File | Sketchbook | Shield" to open the project. | ||
7) Select "Tools | Board | Mega 2560" | ||
8) Select "Sketch | Compile" to build the device image, and "Sketch | Upload" to deploy it to an attached Connection Exerciser device. | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
/* Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the MIT License. */ | ||
|
||
#include <SoftwareSerial.h> | ||
#include <SerialCommand.h> | ||
#include <LiquidCrystal.h> | ||
#include <Event.h> | ||
#include <Timer.h> | ||
#include <Wire.h> | ||
#include <DualRoleConnectionExerciser.h> | ||
#include <USBCExerciser.h> | ||
#include <HMDExerciser.h> | ||
#include <HDMIExerciser.h> | ||
#include <DTMF.h> | ||
#include <ServoShield.h> | ||
#include <Model_3201.h> | ||
|
||
#define DBGPRINT(A) if (dbg) {Serial.print(A);} | ||
#define DBGPRINTLN(A) if (dbg) {Serial.println(A);} | ||
|
||
byte VERSION = 1; | ||
byte shield = 0; | ||
bool hmdShield = false; | ||
|
||
void AddSerCommand(const char* cmd, void (*function)(SerialCommand*)); | ||
void AddSerDefaultHandler(void (*function)(SerialCommand*)); | ||
|
||
SerialCommand sCmd(Serial); | ||
SerialCommand s1Cmd(Serial1); | ||
Timer timer; | ||
LiquidCrystal *lcd; | ||
bool dbg = false; | ||
uint8_t Data[10]; | ||
uint32_t cmdDelay = 0; // Seconds | ||
uint32_t disconnectTimeout = 0; // miliseconds | ||
float (*ReadVoltage)() = NULL; | ||
float (*ReadCurrent)() = NULL; | ||
void (*SetPort)(byte) = NULL; | ||
char (*GetPort)() = NULL; | ||
void (*ShieldLoop)() = NULL; | ||
void (*SuperSpeed)(bool) = NULL; | ||
extern bool gHmdPresenceTrigger; | ||
|
||
void setup() { | ||
Serial1.begin(115200); | ||
|
||
// | ||
// PORTL[7:4] and PORTB[6] are used to identify the shield. | ||
// Pull-ups are enable to detect the case where | ||
// no shield is attached. | ||
// | ||
|
||
// HMD Shield and DTMF share the same pins and shouldn't be used together | ||
// Check if HMD Shield is present and run the appropriate setup | ||
|
||
// Enable pullups on PORTB[6] and PORTL[7:4] | ||
PORTB = 0x40; | ||
PORTL = 0xF0; | ||
|
||
// | ||
// Look for stacked shields -- but not on the 3201 | ||
// | ||
if ( (PINL >> 4) != MODEL_3201 ) | ||
{ | ||
Serial.begin(9600); | ||
shield = (PINB >> 6) & 1; | ||
|
||
DBGPRINT( F("// Shield type: ") ); | ||
DBGPRINTLN( shield ); | ||
if(!shield) | ||
{ | ||
HMD_setup(); | ||
hmdShield = true; | ||
} | ||
else | ||
{ | ||
DTMF_setup(); | ||
} | ||
} | ||
else | ||
{ | ||
// | ||
// The 3201 communicates at 115200 to handle programming the | ||
// FPGA image into flash. | ||
// | ||
Serial.begin(115200); | ||
} | ||
|
||
shield = PINL >> 4; | ||
|
||
DBGPRINT( F("// Shield type: ") ); | ||
DBGPRINTLN( shield ); | ||
switch (shield) | ||
{ | ||
case DRCE_SHIELD: | ||
DRCE_setup(); | ||
break; | ||
case USBC_SHIELD: | ||
USBC_setup(); | ||
HDMI_setup(); | ||
break; | ||
case MODEL_3201: | ||
DTMF_setup(); | ||
USBC_setup(); | ||
Model_3201_setup(); | ||
break; | ||
} | ||
|
||
AddSerCommand("debug", SetDebugCB); | ||
AddSerCommand("version", GetVersionCB); | ||
AddSerCommand("put", PutDataCB); | ||
AddSerCommand("get", GetDataCB); | ||
AddSerDefaultHandler(Usage); | ||
} | ||
|
||
void AddSerCommand( const char* cmd, void (*function)(SerialCommand*)) | ||
{ | ||
sCmd.addCommand(cmd, function); | ||
s1Cmd.addCommand(cmd, function); | ||
} | ||
|
||
void AddSerDefaultHandler(void (*function)(SerialCommand*)) | ||
{ | ||
sCmd.addDefaultHandler(function); | ||
s1Cmd.addDefaultHandler(function); | ||
} | ||
|
||
void loop() { | ||
sCmd.readSerial(); | ||
s1Cmd.readSerial(); | ||
timer.update(); | ||
if ( ShieldLoop ) | ||
{ | ||
ShieldLoop(); | ||
} | ||
if(gHmdPresenceTrigger) | ||
{ | ||
HMD_PulseLed(); | ||
delay(20); | ||
gHmdPresenceTrigger = false; | ||
} | ||
if(hmdShield) | ||
{ | ||
SERVO_Loop(); | ||
} | ||
} | ||
|
||
void Usage(SerialCommand*) | ||
{ | ||
DBGPRINTLN(F("debug [options]")); | ||
DBGPRINTLN(F(" on, enable debug output")); | ||
DBGPRINTLN(F(" off (or other), disable debug output")); | ||
DBGPRINTLN(F("version")); | ||
DBGPRINTLN(F(" ABTT:<firmare version>:<shield type>")); | ||
if(USBC_SHIELD) | ||
{ | ||
USBC_Usage(); | ||
HDMI_Usage(); | ||
HMD_Usage(); | ||
} | ||
if(DRCE_SHIELD) | ||
{ | ||
DRCE_Usage(); | ||
} | ||
} | ||
|
||
void PutDataCB(SerialCommand* cmd) | ||
{ | ||
uint8_t index; | ||
char *arg = cmd->next(); | ||
|
||
if ( arg ) | ||
{ | ||
index = atoi(arg); | ||
arg = cmd->next(); | ||
if ( index <= 9 && arg ) | ||
{ | ||
Data[index] = atoi(arg); | ||
cmd->GetHardwareSerial()->print( F("put ") ); | ||
cmd->GetHardwareSerial()->print( index ); | ||
cmd->GetHardwareSerial()->print( F(" ") ); | ||
cmd->GetHardwareSerial()->println( arg ); | ||
} | ||
} | ||
} | ||
|
||
void GetDataCB(SerialCommand* cmd) | ||
{ | ||
char Buffer[3]; | ||
uint8_t index; | ||
char *arg = cmd->next(); | ||
|
||
if ( arg ) | ||
{ | ||
index = atoi(arg); | ||
if ( index <= 9 ) | ||
{ | ||
Buffer[0] = (Data[index] / 10) + '0'; | ||
Buffer[1] = (Data[index] % 10) + '0'; | ||
Buffer[2] = '\0'; | ||
cmd->GetHardwareSerial()->println(Buffer); | ||
} | ||
} | ||
} | ||
|
||
void GetVersionCB(SerialCommand* cmd) | ||
{ | ||
char Buffer[8]; | ||
|
||
sprintf_P( Buffer, PSTR("%02d%02d"), VERSION, shield ); | ||
cmd->GetHardwareSerial()->println( Buffer ); | ||
} | ||
|
||
void SetDebugCB(SerialCommand* cmd) | ||
{ | ||
char *arg = cmd->next(); | ||
|
||
if (arg != NULL) { | ||
if ( strcmp(arg, "on" ) == 0) { | ||
dbg = true; | ||
DBGPRINTLN(F("Turn on debug")); | ||
} | ||
if ( strcmp(arg, "off" ) == 0) { | ||
DBGPRINTLN(F("Turn off debug")); | ||
dbg = false; | ||
} | ||
} | ||
} |
Oops, something went wrong.