Created
September 24, 2015 18:25
-
-
Save satoruhiga/25591296f4f481a103bf to your computer and use it in GitHub Desktop.
tellmeUSBSerialDevice.h
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
#pragma once | |
#include "ofMain.h" | |
inline void tellmeUSBSerialDevice() | |
{ | |
ofDirectory dir; | |
int n = dir.listDir("/dev"); | |
vector<string> arr; | |
for (int i = 0; i < n; i++) | |
{ | |
ofFile f = dir.getFile(i); | |
if (ofIsStringInString(f.getFileName(), "usbserial") | |
&& ofIsStringInString(f.getFileName(), "tty")) | |
{ | |
arr.push_back(f.path()); | |
} | |
} | |
if (arr.size()) | |
{ | |
stringstream ss; | |
for (int i = 0; i < arr.size(); i++) | |
ss << arr[i] << endl; | |
ofSystemAlertDialog(ss.str()); | |
} | |
else | |
{ | |
ofSystemAlertDialog("usbserial device not found"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment