Skip to content

Commit

Permalink
[closes #18] prepends Win32 device namespace to port names
Browse files Browse the repository at this point in the history
  • Loading branch information
dcuddeback committed May 13, 2016
1 parent 5ca6756 commit 2911ed6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/windows/com.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ impl COMPort {
/// * `InvalidInput` if `port` is not a valid device name.
/// * `Io` for any other I/O error while opening or initializing the device.
pub fn open<T: AsRef<OsStr> + ?Sized>(port: &T) -> ::Result<Self> {
let mut name: Vec<u16> = port.as_ref().encode_wide().collect();
let mut name = Vec::<u16>::new();

name.extend(OsStr::new("\\\\.\\").encode_wide());
name.extend(port.as_ref().encode_wide());
name.push(0);

let handle = unsafe {
Expand Down

0 comments on commit 2911ed6

Please sign in to comment.