Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Powershell script to which serial ports are for which function #133

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

henrygab
Copy link
Collaborator

@henrygab henrygab commented Nov 7, 2024

Usage

  1. Open a Windows Powershell command prompt
  2. Change to the directory containing the powershell script
  3. Review the contents of the script (for malicious content)
  4. If necessary, permit the loading of the # execute as follows:
  5. If satisfied with content, permit the loading of the script:
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
  6. Load the script into your current Powershell process
    . .\show_port_info.ps1
  7. Run the main function that the script defined
    Get-BusPirateDetails

Example output

The following is an example, with a single BusPirate5 device connected:

PS C:\Users\ian> Get-BusPirateDetails
InstanceId          : USB\VID_1209&PID_7331\FEDCBA9876543210
Serial              : FEDCBA9876543210
Location            : Port_#0003.Hub_#0007
InstanceID_Terminal : USB\VID_1209&PID_7331&MI_00\8&32E00187&0&0000
Port_Terminal       : COM55
InstanceID_Binary   : USB\VID_1209&PID_7331&MI_02\8&32E00187&0&0002
Port_Binary         : COM56
InstanceId_Storage  : USB\VID_1209&PID_7331&MI_04\8&32E00187&0&0004

In the above example output, the terminal is available on COM55, while
the binary serial port is available on COM56. The serial number of each
device is also shown.

Problems

If not getting the expected results, execute the script with more verbose output,
and copy/paste that output when reporting the issue:

Get-BusPirateDetails -Verbose -Debug

@henrygab henrygab merged commit a593770 into DangerousPrototypes:main Nov 8, 2024
2 checks passed
@henrygab henrygab deleted the diagnostic_powershell branch November 8, 2024 06:29
@grymoire
Copy link
Contributor

I did the Set-ExecutionPolicy command in powershell. On Windows 10, I'm getting an error that it's not digitally signed. It then says

+ . .\show_port_info.ps1
+   ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

@detonation
Copy link

I got the same error. Go to the folder the file is in, right click properties, click the check mark "Unblock" next to "This file came from another computer and may be blocked to help protect this computer". Click apply/ok, then run the script, it will work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants