Skip to content

Commit

Permalink
Fixed problem with GUID assignment for drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Jun 3, 2020
1 parent 2d90bc4 commit beb0b79
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 25 deletions.
4 changes: 2 additions & 2 deletions VERSION.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
m4_define([release_debian], [1])
m4_define([major_version], [14])
m4_define([minor_version], [0])
m4_define([release_version], [3])
m4_define([build_version], [5])
m4_define([release_version], [4])
m4_define([build_version], [1])
m4_define([package_version],['major_version.minor_version.release_version'])
m4_define([full_version],['major_version.minor_version.release_version.build_version'])
26 changes: 13 additions & 13 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for vscp '14.0.3'.
# Generated by GNU Autoconf 2.69 for vscp '14.0.4'.
#
# Report bugs to <akhe@vscp.org>.
#
Expand Down Expand Up @@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='vscp'
PACKAGE_TARNAME='vscp'
PACKAGE_VERSION=''14.0.3''
PACKAGE_STRING='vscp '14.0.3''
PACKAGE_VERSION=''14.0.4''
PACKAGE_STRING='vscp '14.0.4''
PACKAGE_BUGREPORT='akhe@vscp.org'
PACKAGE_URL=''

Expand Down Expand Up @@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures vscp '14.0.3' to adapt to many kinds of systems.
\`configure' configures vscp '14.0.4' to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1331,7 +1331,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of vscp '14.0.3':";;
short | recursive ) echo "Configuration of vscp '14.0.4':";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1432,7 +1432,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
vscp configure '14.0.3'
vscp configure '14.0.4'
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2076,7 +2076,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by vscp $as_me '14.0.3', which was
It was created by vscp $as_me '14.0.4', which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -6725,9 +6725,9 @@ fi

MAJOR_VERSION=14
MINOR_VERSION=0
RELEASE_VERSION=3
BUILD_VERSION=5
RELEASE_DEBIAN=5
RELEASE_VERSION=4
BUILD_VERSION=1
RELEASE_DEBIAN=1


ac_config_files="$ac_config_files Makefile m4/Makefile src/vscp/daemon/linux/Makefile src/vscp/vscp-mkpasswd/Makefile src/vscp/vscpcmd/Makefile tests/helperlib/Makefile"
Expand Down Expand Up @@ -7241,7 +7241,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by vscp $as_me '14.0.3', which was
This file was extended by vscp $as_me '14.0.4', which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -7303,7 +7303,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
vscp config.status '14.0.3'
vscp config.status '14.0.4'
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down Expand Up @@ -8024,7 +8024,7 @@ fi
echo
echo " VSCP configuration"
echo "--------------------------------------------"
echo "VSCP version : ${PACKAGE_VERSION} (14.0.3.build_versio
echo "VSCP version : ${PACKAGE_VERSION} (14.0.4.build_versio
n)"
echo "System : `uname -a` "
echo "Architecture : $(arch)"
Expand Down
31 changes: 28 additions & 3 deletions src/vscp/common/clientlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,10 @@ CClientList::findFreeId(uint16_t* pid)
bool
CClientList::addClient(CClientItem* pClientItem, uint32_t id)
{
std::deque<CClientItem*>::iterator it;

// Check pointer
if (NULL == pClientItem)
if (NULL == pClientItem) {
return false;
}

pClientItem->m_clientID = id ? id : 1;

Expand All @@ -286,6 +285,7 @@ CClientList::addClient(CClientItem* pClientItem, uint32_t id)
}

// We try to assign requested id
std::deque<CClientItem*>::iterator it;
for (it = m_itemList.begin(); it != m_itemList.end(); ++it) {

CClientItem* pItem = *it;
Expand All @@ -302,6 +302,31 @@ CClientList::addClient(CClientItem* pClientItem, uint32_t id)
return true;
}

///////////////////////////////////////////////////////////////////////////////
// addClient
//

bool
CClientList::addClient(CClientItem* pClientItem, cguid& guid)
{
// Check pointer
if (NULL == pClientItem) {
return false;
}

if ( !addClient(pClientItem) ) {
return false;
}

// Set the guid
pClientItem->m_guid = guid;

// Make sure nickname id is zero
pClientItem->m_guid.setNicknameID(0);

return true;
}

///////////////////////////////////////////////////////////////////////////////
// removeClient
//
Expand Down
9 changes: 9 additions & 0 deletions src/vscp/common/clientlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ class CClientList
*/
bool addClient(CClientItem *pClientItem, uint32_t id = 0);

/*!
Add a client to the list using set GUID
@param pClientItem Client to add
@param guid The guid that is used for the client. Two least
significant bytes will be set to zero.
@return true om success.
*/
bool addClient(CClientItem* pClientItem, cguid& guid);

/*!
Remove a client from the list
@param pClientItem Pointer to client item
Expand Down
25 changes: 25 additions & 0 deletions src/vscp/common/controlobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,11 @@ CControlObject::sendEvent(CClientItem* pClientItem, vscpEventEx* pex)
bool
CControlObject::addClient(CClientItem* pClientItem, uint32_t id)
{
// Check pointer
if ( NULL == pClientItem ) {
return false;
}

// Add client to client list
if (!m_clientList.addClient(pClientItem, id)) {
return false;
Expand All @@ -1500,6 +1505,26 @@ CControlObject::addClient(CClientItem* pClientItem, uint32_t id)
return true;
}

//////////////////////////////////////////////////////////////////////////////
// addClient - GUID (for drivers with set GUID)
//

bool
CControlObject::addClient(CClientItem* pClientItem, cguid& guid)
{
// Check pointer
if ( NULL == pClientItem ) {
return false;
}

// Add client to client list
if (!m_clientList.addClient(pClientItem, guid)) {
return false;
}

return true;
}

//////////////////////////////////////////////////////////////////////////////
// removeClient
//
Expand Down
17 changes: 15 additions & 2 deletions src/vscp/common/controlobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,28 @@ class CControlObject {
bool stopClientMsgWorkerThread(void);

/*!
Add a new client to the clinet list
Add a new client to the client list
@param Pointer to client that should be added.
@param Normally not used but can be used to set a special
client id.
@return True on success.
*/
*/
bool addClient(CClientItem* pClientItem, uint32_t id = 0);

/*!
Add a new client to the client list using GUID.
This add client method is for drivers that specify a
full GUID (two lsb nilled).
@param Pointer to client that should be added.
@param guid The guid that is used for the client. Two least
significant bytes will be set to zero.
@return True on success.
*/
bool addClient(CClientItem* pClientItem, cguid& guid);

/*!
Add a known node
@param guid Real GUID for node
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/devicethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ deviceThread(void* pData)
// Add the client to the Client List
pthread_mutex_lock(&pObj->m_clientList.m_mutexItemList);
if (!pObj->addClient(pClientItem,
pDevItem->m_interface_guid.getClientID())) {
pDevItem->m_interface_guid) ) {
// Failed to add client
delete pDevItem->m_pClientItem;
pDevItem->m_pClientItem = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/vscp/common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
// 35/36/37/38/40/42/43 I M P O T A N T ! ! !
#define VSCPD_MAJOR_VERSION 14
#define VSCPD_MINOR_VERSION 0
#define VSCPD_RELEASE_VERSION 3
#define VSCPD_BUILD_VERSION 5
#define VSCPD_RELEASE_VERSION 4
#define VSCPD_BUILD_VERSION 1

#define VSCPD_DISPLAY_VERSION "14.0.3-5 Silicon"
#define VSCPD_DISPLAY_VERSION "14.0.4-1 Silicon"

#define VSCPD_COPYRIGHT \
"Copyright © 2000-2020 Ake Hedman, Grodans Paradis AB, " \
Expand Down
2 changes: 1 addition & 1 deletion tests/helperlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MAJOR_VERSION=@MAJOR_VERSION@
MINOR_VERSION=@MINOR_VERSION@
RELEASE_VERSION=@RELEASE_VERSION@
BUILD_VERSION=@BUILD_VERSION@
PACKAGE_VERSION=14.0.3
PACKAGE_VERSION=14.0.4

# STATIC = yes if a static build is requested.
STATIC=no
Expand Down

0 comments on commit beb0b79

Please sign in to comment.