Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel Firmware
serial
Commits
3a9e6be8
Commit
3a9e6be8
authored
9 years ago
by
William Woodall
Browse files
Options
Download
Email Patches
Plain Diff
[style] whitespace
parent
42aa78ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
src/impl/list_ports/list_ports_osx.cc
src/impl/list_ports/list_ports_osx.cc
+28
-28
No files found.
src/impl/list_ports/list_ports_osx.cc
View file @
3a9e6be8
...
...
@@ -36,9 +36,9 @@ cfstring_to_string( CFStringRef cfstring )
if
(
cfstring
)
{
Boolean
success
=
CFStringGetCString
(
cfstring
,
cstring
,
sizeof
(
cstring
),
Boolean
success
=
CFStringGetCString
(
cfstring
,
cstring
,
sizeof
(
cstring
),
kCFStringEncodingASCII
);
if
(
success
)
...
...
@@ -106,7 +106,7 @@ get_parent_iousb_device( io_object_t& serial_port )
result
=
0
;
break
;
}
device
=
parent
;
name
=
get_class_name
(
device
);
...
...
@@ -125,15 +125,15 @@ get_string_property( io_object_t& device, const char* property )
if
(
device
)
{
CFStringRef
property_as_cfstring
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
property
,
CFStringRef
property_as_cfstring
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
property
,
kCFStringEncodingASCII
);
CFTypeRef
name_as_cfstring
=
IORegistryEntryCreateCFProperty
(
CFTypeRef
name_as_cfstring
=
IORegistryEntryCreateCFProperty
(
device
,
property_as_cfstring
,
kCFAllocatorDefault
,
property_as_cfstring
,
kCFAllocatorDefault
,
0
);
if
(
name_as_cfstring
)
...
...
@@ -142,12 +142,12 @@ get_string_property( io_object_t& device, const char* property )
property_name
=
cfstring_to_string
(
static_cast
<
CFStringRef
>
(
name_as_cfstring
)
);
CFRelease
(
name_as_cfstring
);
}
}
if
(
property_as_cfstring
)
CFRelease
(
property_as_cfstring
);
}
return
property_name
;
}
...
...
@@ -158,14 +158,14 @@ get_int_property( io_object_t& device, const char* property )
if
(
device
)
{
CFStringRef
property_as_cfstring
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
property
,
CFStringRef
property_as_cfstring
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
property
,
kCFStringEncodingASCII
);
CFTypeRef
number
=
IORegistryEntryCreateCFProperty
(
device
,
property_as_cfstring
,
kCFAllocatorDefault
,
CFTypeRef
number
=
IORegistryEntryCreateCFProperty
(
device
,
property_as_cfstring
,
kCFAllocatorDefault
,
0
);
if
(
property_as_cfstring
)
...
...
@@ -175,8 +175,8 @@ get_int_property( io_object_t& device, const char* property )
{
if
(
CFGetTypeID
(
number
)
==
CFNumberGetTypeID
()
)
{
bool
success
=
CFNumberGetValue
(
static_cast
<
CFNumberRef
>
(
number
),
kCFNumberSInt16Type
,
bool
success
=
CFNumberGetValue
(
static_cast
<
CFNumberRef
>
(
number
),
kCFNumberSInt16Type
,
&
result
);
if
(
!
success
)
...
...
@@ -187,7 +187,7 @@ get_int_property( io_object_t& device, const char* property )
}
}
return
result
;
}
...
...
@@ -198,7 +198,7 @@ string rtrim(const string& str)
string
whitespace
=
"
\t\f\v\n\r
"
;
std
::
size_t
found
=
result
.
find_last_not_of
(
whitespace
);
if
(
found
!=
std
::
string
::
npos
)
result
.
erase
(
found
+
1
);
else
...
...
@@ -244,7 +244,7 @@ serial::list_ports(void)
if
(
device_path
.
empty
()
)
continue
;
PortInfo
port_info
;
port_info
.
port
=
device_path
;
port_info
.
description
=
"n/a"
;
...
...
@@ -267,18 +267,18 @@ serial::list_ports(void)
if
(
serial_number
.
empty
())
serial_number
=
"None"
;
int
ret
=
snprintf
(
cstring
,
HARDWARE_ID_STRING_LENGTH
,
"USB VID:PID=%04x:%04x SNR=%s"
,
vendor_id
,
product_id
,
int
ret
=
snprintf
(
cstring
,
HARDWARE_ID_STRING_LENGTH
,
"USB VID:PID=%04x:%04x SNR=%s"
,
vendor_id
,
product_id
,
serial_number
.
c_str
()
);
if
(
(
ret
>=
0
)
&&
(
ret
<
HARDWARE_ID_STRING_LENGTH
)
)
port_info
.
hardware_id
=
cstring
;
}
}
devices_found
.
push_back
(
port_info
);
}
IOObjectRelase
(
serial_port_iterator
);
return
devices_found
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment