RxUsbRegisterChangeNotification
Appearance
Description
Registers semaphores for generic attach/detach notification of USB devices.
Syntax
rc = RxUsbRegisterChangeNotification(NotifyID,hDevAdd,hDevRem)
Parameters
- NotifyID
- the name of the variable to receive the Notification Identifier.
- hDevAdd
- the handle of the event semaphore to be posted on device attach.
- hDevRem
- the handle of the event semaphore to be posted on device detach.
Return Code
Errors
Remarks
Example Code
/* add SysCreateEventSem */ rc = RxFuncAdd('SysCreateEventSem','RexxUtil','SysCreateEventSem') say '+SysCreateEventSem(),RC=0x'd2x(rc) /* invoke SysCreateEventSem() */ hSemAttach = SysCreateEventSem() say '*SysCreateEventSem(),RC=0x'd2x(rc) hSemDetach = SysCreateEventSem() say '*SysCreateEventSem(),RC=0x'd2x(rc) /* drop SysCreateEventSem */ rc = RxFuncDrop('SysCreateEventSem') say '-SysCreateEventSem(),RC=0x'd2x(rc) /* add RxUsbRegisterChangeNotification */ rc = RxFuncAdd('RxUsbRegisterChangeNotification','usbcalls','RxUsbRegisterChangeNotification') say '+RxUsbRegisterChangeNotification(),RC=0x'd2x(rc) /* invoke RxUsbRegisterChangeNotification */ hDevAdd = hSemAttach; /* attach semaphore handle */ hDevRem = hSemDetach; /* detach semaphore handle */ drop NotifyID /* to receive the notification identifier */ rc = RxUsbRegisterChangeNotification(NotifyID,hDevAdd,hDevRem) say '*RxUsbRegisterChangeNotification(),RC=0x'd2x(rc) /* drop RxUsbRegisterChangeNotification */ rc = RxFuncDrop('RxUsbRegisterChangeNotification') say '-RxUsbRegisterChangeNotification(),RC=0x'd2x(rc) /* add SysWaitEventSem */ rc = RxFuncAdd('SysWaitEventSem','RexxUtil','SysWaitEventSem') say '+SysWaitEventSem(),RC=0x'd2x(rc) /* invoke SysWaitEventSem() */ timeout = 8000; /* await 8 seconds */ rc = SysWaitEventSem(hSemAttach,timeout) say '*SysWaitEventSem(),RC=0x'd2x(rc) if (rc=0) then say 'obtained Attach Notification' rc = SysWaitEventSem(hSemDetach,timeout) say '*SysWaitEventSem(),RC=0x'd2x(rc) if (rc=0) then say 'obtained Detach Notification' /* drop SysWaitEventSem */ rc = RxFuncDrop('SysWaitEventSem') say '-SysWaitEventSem(),RC=0x'd2x(rc)