Skip to content

Commit

Permalink
#31: [agent] Start a thread for each device
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdope committed Jul 14, 2024
1 parent d2af4a4 commit 256c630
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/pamusb-agent
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,19 @@ def userDeviceThread(user):

logger.info('Setting up HotPlugDevices for configured %d user devices...' % (len(to_watch)))
hpDevs = []
threads = []
for watch_this in to_watch:
logger.info('Creating hpDev for device "%s" with serial "%s"...' % (watch_this.get('name'), watch_this.get('serial')))

hpDev = HotPlugDevice(watch_this.get('serial'), watch_this.get('name'))
hpDev.addCallback(authChangeCallback)

logger.info('Watching device "%s" for user "%s"' % (watch_this.get('name'), userName))
hpDev.run() # @todo: asap as run() is called the loop doesnt continue anymore

thread = threading.Thread(target=hpDev.run)
thread.start()

threads.append(thread)
hpDevs.append(hpDev)

logger.info('All HotPlugDevices created.')
Expand Down

0 comments on commit 256c630

Please sign in to comment.