Skip to content

Commit

Permalink
Merge pull request #1606 from peternewman/0.10-c11-compat
Browse files Browse the repository at this point in the history
New E1.37-7 NACK Reasons and some other minor improvements
  • Loading branch information
peternewman committed Jan 26, 2020
2 parents cea3b67 + 2c5db3a commit 7bcba60
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 8 deletions.
6 changes: 5 additions & 1 deletion common/rdm/RDMHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ string NackReasonToString(uint16_t reason) {
case NR_ACTION_NOT_SUPPORTED:
return "Action not supported";
case NR_ENDPOINT_NUMBER_INVALID:
return "Invalid endpoint";
return "Endpoint number invalid";
case NR_INVALID_ENDPOINT_MODE:
return "Invalid endpoint mode";
case NR_UNKNOWN_UID:
return "Unknown UID";
default:
ostringstream str;
str << "Unknown, was " << reason;
Expand Down
3 changes: 3 additions & 0 deletions common/utils/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,16 @@ void CapitalizeLabel(string *s) {
}

void CustomCapitalizeLabel(string *s) {
// Remember to update the Doxygen in include/ola/StringUtils.h too
static const char* const transforms[] = {
"dhcp",
"dmx",
"dns",
"ip",
"ipv4", // Should really be IPv4 probably, but better than nothing
"ipv6", // Should really be IPv6 probably, but better than nothing
"led",
"mdmx", // City Theatrical, should really be mDMX, but better than nothing
"rdm",
"uid",
NULL
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ fi
AC_SUBST(PLUGIN_LIBS)
AC_SUBST(OLA_SERVER_LIBS)

# html & data directories
# HTML & data directories
ola_datadir=$datadir/olad
www_datadir=$ola_datadir/www
piddatadir=$datadir/ola/pids
Expand Down Expand Up @@ -1005,5 +1005,5 @@ Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build everything
check - run the tests
doxygen-doc - generate the html documentation
doxygen-doc - generate the HTML documentation
-------------------------------------------------------"
10 changes: 9 additions & 1 deletion include/ola/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,16 @@ void CapitalizeLabel(std::string *s);
*
* @param s a string to transform.
* The following are capitalized:
* - ip
* - dhcp
* - dmx
* - dns
* - ip
* - ipv4
* - ipv6
* - led
* - mdmx
* - rdm
* - uid
*/
void CustomCapitalizeLabel(std::string *s);

Expand Down
9 changes: 8 additions & 1 deletion include/ola/rdm/RDMEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ typedef enum {
} rdm_data_type;


// Remember to update the other places when adding new NACK codes:
// common/rdm/RDMHelper.cpp
// plugins/usbpro/DmxTriWidget.cpp
// plugins/usbpro/DmxTriWidget.h
// python/ola/OlaClient.py
typedef enum {
NR_UNKNOWN_PID = 0x0000,
NR_FORMAT_ERROR = 0x0001,
Expand All @@ -339,7 +344,9 @@ typedef enum {
NR_SUB_DEVICE_OUT_OF_RANGE = 0x0009,
NR_PROXY_BUFFER_FULL = 0x000A,
NR_ACTION_NOT_SUPPORTED = 0x000B,
NR_ENDPOINT_NUMBER_INVALID = 0x0011
NR_ENDPOINT_NUMBER_INVALID = 0x000C,
NR_INVALID_ENDPOINT_MODE = 0x000D,
NR_UNKNOWN_UID = 0x000E
} rdm_nack_reason;


Expand Down
2 changes: 1 addition & 1 deletion include/ola/web/JsonSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace web {
* This is the base item class. Items are composed into sections.
* Each item has the following:
* - A text description
* - A type, which controls how the item is renders
* - A type, which controls how the item is rendered
* - The value.
* - Optional id. A non-empty id makes this item editable
* - Optional button text. Non-empty means this item gets it own button.
Expand Down
2 changes: 1 addition & 1 deletion libs/usb/LibUsbAdaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class LibUsbAdaptor {
* output (depending on direction bits within bmRequestType)
* @param wLength the length field for the setup packet. The data buffer
* should be at least this size.
* @param timeout timeout (in millseconds) that this function should wait
* @param timeout timeout (in milliseconds) that this function should wait
* before giving up due to no response being received. For an unlimited
* timeout, use value 0.
* @returns on success, the number of bytes actually transferred
Expand Down
2 changes: 1 addition & 1 deletion man/generate-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for man_file in *.1; do
output_file=$output_dir/man1/$man_file.html;
man2html -r $man_file -M ../index.html | sed 1,2d > $output_file;
chmod a+r $output_file;
echo "<li><a href='./man1/$man_file.html'>$man_file</a></li>" >> $index_file
echo "<li><a href='./man1/$man_file.html'>$man_file</a> - `grep "\.SH NAME" $man_file -A 1 | tail -n 1 | sed -e 's/\\\-/-/g'`</li>" >> $index_file
done

cat << 'EOF' >> $index_file
Expand Down
12 changes: 12 additions & 0 deletions plugins/usbpro/DmxTriWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,18 @@ bool DmxTriWidgetImpl::ReturnCodeToNackReason(
case EC_PROXY_BUFFER_FULL:
*reason = ola::rdm::NR_PROXY_BUFFER_FULL;
break;
case EC_ACTION_NOT_SUPPORTED:
*reason = ola::rdm::NR_ACTION_NOT_SUPPORTED;
break;
case EC_ENDPOINT_NUMBER_INVALID:
*reason = ola::rdm::NR_ENDPOINT_NUMBER_INVALID;
break;
case EC_INVALID_ENDPOINT_MODE:
*reason = ola::rdm::NR_INVALID_ENDPOINT_MODE;
break;
case EC_UNKNOWN_UID:
*reason = ola::rdm::NR_UNKNOWN_UID;
break;
default:
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/usbpro/DmxTriWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ class DmxTriWidgetImpl: public BaseUsbProWidget,
EC_FRAME_OVERFLOW = 0x28,
EC_SUBDEVICE_UNKNOWN = 0x29,
EC_PROXY_BUFFER_FULL = 0x2a, // this isn't included in the docs
EC_ACTION_NOT_SUPPORTED = 0x2b, // this is a guess
EC_ENDPOINT_NUMBER_INVALID = 0x2c, // this is a guess
EC_INVALID_ENDPOINT_MODE = 0x2d, // this is a guess
EC_UNKNOWN_UID = 0x2e, // this is a guess
} dmx_tri_error_codes;
// TODO(Peter): try and test the guessed values

static const unsigned int DATA_OFFSET = 2; // first two bytes are CI & RC
static const uint8_t EXTENDED_COMMAND_LABEL = 88; // 'X'
Expand Down
4 changes: 4 additions & 0 deletions python/ola/OlaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ class RDMNack(object):
'NR_PACKET_SIZE_UNSUPPORTED': (8, 'Packet size unsupported'),
'NR_SUB_DEVICE_OUT_OF_RANGE': (9, 'Sub device out of range'),
'NR_PROXY_BUFFER_FULL': (10, 'Proxy buffer full'),
'NR_ACTION_NOT_SUPPORTED': (11, 'Action not supported'),
'NR_ENDPOINT_NUMBER_INVALID': (12, 'Endpoint number invalid'),
'NR_INVALID_ENDPOINT_MODE': (13, 'Invalid endpoint mode'),
'NR_UNKNOWN_UID': (14, 'Unknown UID'),
}

# this is populated below
Expand Down

0 comments on commit 7bcba60

Please sign in to comment.