RxUsbRegisterDeviceNotification
Appearance
Description
Registers semaphores for attach/detach notification of specific USB devices.
Registers semaphores for attach/detach notification of even more specific USB devices.
Syntax
rc = RxUsbRegisterDeviceNotification(NotifyID,hDevAdd,hDevRem,idVendor,idProduct)
rc = RxUsbRegisterDeviceNotification(NotifyID,hDevAdd,hDevRem,idVendor,idProduct,bcdDevice)
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.
- idVendor
- the Vendor Identifier (VendorID) from the device descriptor.
- idProduct
- the Product Identifier (ProductID) from the device descriptor.
- bcdDevice
- the Device Release Number from the device descriptor.
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 RxUsbRegisterDeviceNotification */ rc = RxFuncAdd('RxUsbRegisterDeviceNotification','usbcalls','RxUsbRegisterDeviceNotification') say '+RxUsbRegisterDeviceNotification(),RC=0x'd2x(rc) /* invoke RxUsbRegisterDeviceNotification */ idVendor=x2d(046D) /* vendor identifier */ idProduct=x2d(0804) /* product identifier */ bcdDevice=x2d(0009) /* device release number */ hDevAdd = hSemAttach; /* attach semaphore handle */ hDevRem = hSemDetach; /* detach semaphore handle */ drop NotifyID /* to receive the notification identifier */ rc = RxUsbRegisterDeviceNotification(NotifyID,hDevAdd,hDevRem,idVendor,idProduct,bcdDevice) say '*RxUsbRegisterDeviceNotification(),RC=0x'd2x(rc) /* drop RxUsbRegisterDeviceNotification */ rc = RxFuncDrop('RxUsbRegisterDeviceNotification') say '-RxUsbRegisterDeviceNotification(),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)