* Only set the select hook on the device module if we actually got a select

hook from the legacy driver.
* Add note explaining why it is set to an arbitrary invalid value (~0) and why
  it still works by redirecting in the virtual Select() of LegacyDevice.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26079 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-06-22 13:30:56 +00:00
parent d1b297a928
commit a47ceb2aec
@@ -1229,7 +1229,16 @@ LegacyDevice::SetHooks(device_hooks* hooks)
// According to Be newsletter, vol II, issue 36, // According to Be newsletter, vol II, issue 36,
// version 2 added readv/writev, which we don't support, but also // version 2 added readv/writev, which we don't support, but also
// select/deselect. // select/deselect.
fDeviceModule->select = (status_t (*)(void*, uint8, selectsync*))~0; if (hooks->select != NULL) {
// Note we set the module's select to a non-null value to indicate
// that we have select. HasSelect() will therefore return the
// correct answer. As Select() is virtual our compatibility
// version below is going to be called though, that redirects to
// the proper select hook, so it is ok to set it to an invalid
// address here.
fDeviceModule->select = (status_t (*)(void*, uint8, selectsync*))~0;
}
fDeviceModule->deselect = hooks->deselect; fDeviceModule->deselect = hooks->deselect;
} }
} }