[Libphidget-cvs-commits] CVS: libphidget/src/libphidget phidget.c,1.7,1.8 phidget.h,1.4,1.5
Status: Alpha
Brought to you by:
jstrohm
From: Jack S. <js...@us...> - 2002-09-16 06:41:00
|
Update of /cvsroot/libphidget/libphidget/src/libphidget In directory usw-pr-cvs1:/tmp/cvs-serv30676 Modified Files: phidget.c phidget.h Log Message: A very large set of changes to get events working again. Index: phidget.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** phidget.c 14 Sep 2002 01:24:39 -0000 1.7 --- phidget.c 16 Sep 2002 06:40:57 -0000 1.8 *************** *** 15,34 **** /** ! * We only support 128 USB devices */ #define MAX_USB_DEVICES 128 //#define DBG(a) printf("*** DEBUG *** : %s\n",a) #define DBG(a) ! int _libPhidgetInitialized = 0; ! ! /**< Private variable to determine if the libphidget is initialized */ ! int _typeCount = 0; ! ! /**< count of known phidget types */ ! struct phidget_type *_typeList = NULL; ! ! /**< Array that will hold all the type structures */ int _phidgetDeviceCount = 0; //*< Count of known phidgets */ struct phidget *_usbDeviceList[MAX_USB_DEVICES]; //*< Array that will hold all of the phidget structures */ --- 15,29 ---- /** ! * We only support 128 USB devices (because USB only supports 128 devices) */ #define MAX_USB_DEVICES 128 + // TODO - change this //#define DBG(a) printf("*** DEBUG *** : %s\n",a) #define DBG(a) ! int _libPhidgetInitialized = 0; /**< Private variable to determine if the libphidget is initialized */ ! int _typeCount = 0; /**< count of known phidget types */ ! struct phidget_type *_typeList = NULL; /**< Array that will hold all the type structures */ int _phidgetDeviceCount = 0; //*< Count of known phidgets */ struct phidget *_usbDeviceList[MAX_USB_DEVICES]; //*< Array that will hold all of the phidget structures */ *************** *** 72,92 **** struct phidget { ! const struct phidget_type *type; /**< Type of phidget that this currently opened phidget is */ ! struct usb_dev_handle *handle; /**< libusb handle to the phidget, try not to use this if at all possible. If this is NULL, the device isn't opened. */ ! struct usb_device *device; /**< libusb device to the phidget, try not to use this if at all possible */ ! int serial; /**< The serial number of the phidget for unique identificatoin */ ! int attached; /**< Is this phidget currently attached */ ! enum ! { ! WAS_OPENED, /**< The Device has been opened */ ! WAS_CLOSED, /**< The device has been closed */ ! WAS_ERROR /**< The device is in an unknown state */ ! } ! openedState; /**< Virtual state of the device, this keeps the state of the device even when it is detached. */ ! int defaultDataSize; /**< Size of default data */ ! void *defaultData; /**< Used to store default information for when the phidget is closed, different for each phidget */ }; /** * Private method to set the last phidget error value --- 67,127 ---- struct phidget { ! /** Type of phidget that this currently opened phidget is */ ! const struct phidget_type *type; ! /** libusb handle to the phidget, try not to use this if at all possible. ! * If this is NULL, the device isn't opened. */ ! struct usb_dev_handle *handle; ! ! /** libusb device to the phidget, try not to use this if at all possible */ ! struct usb_device *device; ! ! /** The serial number of the phidget for unique identificatoin */ ! int serial; ! ! /** Is this phidget currently attached */ ! int attached; ! ! /** Previous state of attached */ ! int wasAttached; ! ! /** Size of default data */ ! int defaultDataSize; ! ! /** Used to store default information for when the phidget is closed, different for each phidget */ ! void *defaultData; ! ! /** Virtual state of the device, this keeps the state of the device even when it is detached. */ ! enum ! { ! WAS_OPENED, /**< The Device has been opened */ ! WAS_CLOSED, /**< The device has been closed */ ! WAS_ERROR /**< The device is in an unknown state */ ! } openedState; }; + + int _stateAttached( struct phidget *device) + { + DBG("_stateAttached"); + device->wasAttached=device->attached; + device->attached=1; + + if (device->wasAttached!=device->attached) + return(1); + return(0); + } + + int _stateDetached( struct phidget *device) + { + DBG("_stateDetached"); + device->wasAttached=device->attached; + device->attached=0; + + if (device->wasAttached!=device->attached) + return(1); + return(0); + } + /** * Private method to set the last phidget error value *************** *** 100,104 **** /** ! * Returns the value of the last error, this is used when a function returns a pointer, if the pointer is NULL just check here for the last error */ enum ELPError --- 135,140 ---- /** ! * Returns the value of the last error, this is used when a function returns a pointer, ! * if the pointer is NULL just check here for the last error */ enum ELPError *************** *** 110,114 **** /** ! * Returns a pointer to a phidget_type structure, used for determining information about a specific phidget */ const struct phidget_type * --- 146,151 ---- /** ! * Returns a pointer to a phidget_type structure, used for determining information about a ! * specific phidget */ const struct phidget_type * *************** *** 145,148 **** --- 182,197 ---- /** + * Returns 1 if a phidget is was previously attached, 0 if it wasn't attached + * wasAttached becomes attached after each call to phidgetEvents + */ + int + phidgetWasAttached(const struct phidget *device) + { + if (device == NULL) + return (_error(LPE_INVALID_PHIDGET)); + return (device->wasAttached); + } + + /** * Returns the human readable name of the phidget type */ *************** *** 245,250 **** /** ! * Pfi zgd vun gion to Find a device type by vendor ID and product ID. Can't call \a registerDeviceType any more ! * after this function is called. */ struct phidget_type * --- 294,299 ---- /** ! * Private function to Find a device type by vendor ID and product ID. ! * Can't call \a registerDeviceType any more after this function is called. */ struct phidget_type * *************** *** 293,316 **** } /** * Private function to add a new device that we have found. There are 2 ways devices are added. * The first way is at the beginning, when we initialize and look for all connected devices. * The second is on attach. ! * Now when a device is detached it don't be removed from this list. Just marched as detached. * When it is reatached we will search this list to see if it matches this device. */ enum ELPError ! _addDevice(struct usb_device *device, struct phidget_type *ptd) { enum ELPError err; struct phidget *temp = malloc(sizeof(struct phidget)); ! DBG("addDevice"); temp->type = ptd; temp->handle = NULL; temp->device = device; ! temp->serial = -1; ! temp->attached = 1; temp->openedState = WAS_CLOSED; temp->defaultData = NULL; --- 342,435 ---- } + int _getSerial(struct usb_device *device, struct phidget_type *ptd) + { + int i = 0, j = 0, ret=0; + unsigned char buffer[128] = { 0 }; + unsigned char serial[256] = { 0 }; + + DBG("_getSerial"); + + struct usb_dev_handle *handle= usb_open(device); + + if (handle==NULL) + { + _error(LPE_NO_SERIAL_RETURNED); + return(-1); + } + + // TODO - figure out why this is needed + // it seems that sometimes when I set the configuration it doesn't work, so I have to try again + // this seems to work though. Could cause a hangup. + while (usb_set_configuration(handle, 1)<0); + /* + ret = usb_set_configuration(handle, 1); + if (ret < 0) + { + usb_close(handle); + _error(LPE_SET_CONFIGURATION_FAILED); + return(-1); + } + */ + + ret = usb_claim_interface(handle, 0); + if (ret < 0) + { + usb_close(handle); + _error(LPE_CLAIM_INTERFACE_FAILED); + return(-1); + } + + ret = usb_set_altinterface(handle, 0); + if (ret < 0) + { + usb_release_interface(handle, 0); + usb_close(handle); + _error(LPE_SET_ALT_INTERFACE_FAILED); + return(-1); + } + + i=usb_control_msg(handle, 0x80, 0x06, 0x0303, 0, buffer, sizeof(buffer), 5000); + + if (i!=buffer[0] || i<0) + { + _error(LPE_NO_SERIAL_RETURNED); + return (-1); + } + + j=0; + for (i=2;i<buffer[0];i+=2) + { + serial[j]=buffer[i]; + j++; + } + serial[j] = (int) NULL; + j++; + + usb_release_interface(handle, 0); + usb_close(handle); + return(atoi(serial)); + } + /** * Private function to add a new device that we have found. There are 2 ways devices are added. * The first way is at the beginning, when we initialize and look for all connected devices. * The second is on attach. ! * Now when a device is detached it won't be removed from this list. Just marked as detached. * When it is reatached we will search this list to see if it matches this device. */ enum ELPError ! _addDevice(struct usb_device *device, struct phidget_type *ptd, int _serial) { enum ELPError err; struct phidget *temp = malloc(sizeof(struct phidget)); ! DBG("_addDevice"); temp->type = ptd; temp->handle = NULL; temp->device = device; ! temp->serial = _serial; ! temp->wasAttached = 0; ! temp->attached = 0; temp->openedState = WAS_CLOSED; temp->defaultData = NULL; *************** *** 321,325 **** * then we close it. Serial must first be -1 */ ! if (phidgetOpen(temp)==NULL) return(_error(phidgetLastError())); --- 440,449 ---- * then we close it. Serial must first be -1 */ ! if (temp->serial<0) ! { ! return(_error(phidgetLastError())); ! } ! ! /* if (phidgetOpen(temp)==NULL) return(_error(phidgetLastError())); *************** *** 328,331 **** --- 452,456 ---- if (err!=LPE_NONE) return(_error(err)); + */ _usbDeviceList[_phidgetDeviceCount] = temp; *************** *** 336,482 **** } ! /** ! * Private function to looks at all USB devices and finds the ones that are phidgets. This should ! * only be called once during initialization. */ ! enum ELPError ! _findPhidgets() { ! struct usb_bus *bus; ! struct usb_device *dev; ! ! DBG("findPhidgets"); ! ! usb_init(); ! ! usb_find_busses(); ! usb_find_devices(); ! _clearDevices(); ! for (bus = usb_busses; bus; bus = bus->next) { ! for (dev = bus->devices; dev; dev = dev->next) { ! struct phidget_type *pdt = _findDevice(dev->descriptor.idVendor, ! dev->descriptor.idProduct); ! if (pdt != NULL) ! { ! enum ELPError err; - err=_addDevice(dev, pdt); ! if (err!=LPE_NONE) return(_error(err)); ! } ! } ! } ! return(LPE_NONE); ! } - /** - * Check for any changes in the USB bus that would affect the phidget library, returns 1 if a change has occured. - */ - int - phidgetEvents() - { - int change = 0; - int found[MAX_USB_DEVICES]; - struct usb_bus *bus; - struct usb_device *dev; - int t; - DBG("phidgetEvents"); - if (_libPhidgetInitialized == 0) - return (LPE_NOT_INITIALIZED); ! for (t = 0; t < MAX_USB_DEVICES; t++) { ! found[t] = 0; ! } ! usb_find_busses(); ! usb_find_devices(); ! for (bus = usb_busses; bus; bus = bus->next) { ! for (dev = bus->devices; dev; dev = dev->next) { ! struct phidget_type *pdt = _findDevice(dev->descriptor.idVendor, ! dev->descriptor.idProduct); ! if (pdt != NULL) { ! // Does this device already exists? ! for (t = 0; t < _phidgetDeviceCount; t++) { ! if (_usbDeviceList[t]->device == dev) { ! // We found this device ! found[t] = 1; ! break; ! } ! } ! // Not found yet, mark it and load it ! // We really need to check to see if any of the detached devices have it. ! // If they do we delete this one and set the previous one to attached ! if (found[t] == 0) { ! found[t] = 2; ! _addDevice(dev, pdt); ! change = 1; ! for (t = 0; t < _phidgetDeviceCount - 1; t++) { ! if (_usbDeviceList[t]->attached == 0) ! if (_usbDeviceList[_phidgetDeviceCount - 1]->serial == _usbDeviceList[t]->serial) { ! DBG("Found a previously attached phidget"); ! // We found a match ! _usbDeviceList[t]->handle = NULL; ! _usbDeviceList[t]->device = dev; ! _usbDeviceList[t]->attached = 1; ! if (_usbDeviceList[t]->openedState == WAS_OPENED) { ! _usbDeviceList[t]->openedState = WAS_CLOSED; ! phidgetOpen(_usbDeviceList[t]); } ! // Now delete that last item ! free(_usbDeviceList[_phidgetDeviceCount - 1]); ! _usbDeviceList[_phidgetDeviceCount - 1] = NULL; ! _phidgetDeviceCount = _phidgetDeviceCount - 1; ! found[t] = 1; ! change = 1; break; ! } ! } } - } } - } ! // Mark all detached phidgets ! for (t = 0; t < MAX_USB_DEVICES; t++) { ! if (found[t] == 0) // We didn't find this device ! if (_usbDeviceList[t] != NULL) // we have a pointer to one ! if (_usbDeviceList[t]->attached == 1) // It says it should be attached, so it isn't { ! DBG("Phidget was detached\n"); ! // This device is detached ! // If this device is open then close it. ! if (_usbDeviceList[t]->openedState == WAS_OPENED) { ! usb_release_interface(_usbDeviceList[t]->handle, 0); ! usb_close(_usbDeviceList[t]->handle); ! _usbDeviceList[t]->openedState = WAS_OPENED; ! } ! _usbDeviceList[t]->handle = NULL; ! _usbDeviceList[t]->device = NULL; ! _usbDeviceList[t]->attached = 0; ! change = 1; ! } ! } ! return (change); } --- 461,741 ---- } ! /** ! * Check for any changes in the USB bus that would affect the phidget library, ! * returns 1 if a change has occured. ! * ! * USB only supports 128 devices, because this library automatically remembers ! * disconnected devices there could be problems if you plugged in 128 phidgets, ! * disconnected one of them, and then plugged in 1 new phidgets (requiring 129 ! * total phidgets). In that case an error will occur because we are out of ! * static memory. I really don't think this is an issue, if someone has that ! * many phidgets I will be glad to modify the code to handle it. */ ! int phidgetEvents() { ! int change = 0; ! enum ! { ! NOT_FOUND, ! FOUND_WAS_NEW, ! FOUND_WAS_OLD ! } found[MAX_USB_DEVICES]; ! struct usb_bus *bus; ! struct usb_device *dev; ! int t; ! DBG("phidgetEvents"); ! // must call phidgetInit before using any phidgetLibrary function ! if (_libPhidgetInitialized == 0) ! return (LPE_NOT_INITIALIZED); ! // We need to detect: ! // USB attaches ! // if we have seen it before, handle properly ! // if we haven't add a new phidget device ! // USB detaches ! // only one way to handle this ! ! // Initilize the "found it" array to NOT_FOUND ! for (t = 0; t < _phidgetDeviceCount; t++) ! found[t] = NOT_FOUND; + // Lib USB calls + usb_find_busses(); + usb_find_devices(); ! // Go thru all USB busses ! for (bus = usb_busses; bus; bus = bus->next) ! { ! // Step thru each device on that bus ! for (dev = bus->devices; dev; dev = dev->next) ! { ! // See if it is a phidget, and if it is get the phidget_type ! struct phidget_type *pdt = _findDevice(dev->descriptor.idVendor, dev->descriptor.idProduct); ! // It is a phidget ! if (pdt!=NULL) ! { ! int serial=-1; ! int wasFound=0; ! // Is this an already attached and used phidget? ! for (t=0;t<_phidgetDeviceCount;t++) ! { ! if ( _usbDeviceList[t]->device == dev) ! { ! // We found this device ! found[t] = FOUND_WAS_OLD; ! wasFound=1; + // Device found - Go to the next USB device + break; + } + } ! if (wasFound==0) ! { ! serial=_getSerial(dev,pdt); ! // have we seen this phidget before ! for (t=0;t<_phidgetDeviceCount;t++) ! { ! if ( _usbDeviceList[t]->serial==serial) ! { ! _usbDeviceList[t]->device=dev; // It has changed ! // We found this device ! found[t] = FOUND_WAS_OLD; ! wasFound=1; ! // Device found - Go to the next USB device ! break; ! } ! } ! } ! // Was the device found ! if (wasFound==0) ! { ! // No this is a new device we need to add it. ! found[_phidgetDeviceCount]=FOUND_WAS_NEW; ! _addDevice(dev, pdt,serial); ! change=1; ! // on to the next device ! continue; } ! } ! } ! } ! for (t=0;t<_phidgetDeviceCount;t++) ! { ! switch(found[t]) ! { ! case NOT_FOUND: ! if (_stateDetached(_usbDeviceList[t])==1) ! { ! // This device is detached ! // If this device is open then close it. ! if (_usbDeviceList[t]->openedState == WAS_OPENED) ! { ! usb_release_interface(_usbDeviceList[t]->handle, 0); ! usb_close(_usbDeviceList[t]->handle); ! _usbDeviceList[t]->openedState = WAS_OPENED; ! } ! // State changed ! change=1; ! } ! break; ! case FOUND_WAS_OLD: ! case FOUND_WAS_NEW: ! if (_stateAttached(_usbDeviceList[t])==1) ! { ! if (_usbDeviceList[t]->openedState == WAS_OPENED) ! { ! _usbDeviceList[t]->openedState = WAS_CLOSED; ! _usbDeviceList[t]->handle = NULL; ! phidgetOpen(_usbDeviceList[t]); ! } + // State changed + change=1; + } break; ! default: ! printf("This can't occur\n"); ! exit(-1); } } ! ! return(change); ! ! ! ! ! ! /* ! ! ! ! ! ! ! ! ! // ------------------------------------------------------------------------------- ! ! // Initilize the found it array to 0 ! for (t = 0; t < MAX_USB_DEVICES; t++) ! found[t] = 0; ! ! // Lib USB calls ! usb_find_busses(); ! usb_find_devices(); ! ! ! // Go thru all USB busses ! for (bus = usb_busses; bus; bus = bus->next) ! { ! // Step thru each device on that bus ! for (dev = bus->devices; dev; dev = dev->next) { ! // See if it is a phidget, and if it is get the phidget_type ! struct phidget_type *pdt = _findDevice(dev->descriptor.idVendor, dev->descriptor.idProduct); ! // This USB device is a phidget ! if (pdt != NULL) ! { ! // Check all known devices and see if we have seen this device ! for (t = 0; t < _phidgetDeviceCount; t++) ! { ! if (_usbDeviceList[t]->device == dev) ! { ! // We found this device ! // This means that it wasn't detached ! found[t] = 1; ! // Go to the next USB device ! continue; ! } ! } ! // Not found yet, mark it and load it ! // We really need to check to see if any of the detached ! // devices have it. If they do we delete this one and set ! // the previous one to attached ! if (found[t] == 0) ! { ! found[t] = 2; ! _addDevice(dev, pdt); ! change = 1; ! for (t = 0; t < _phidgetDeviceCount - 1; t++) { ! if (_usbDeviceList[t]->attached == 0) ! if (_usbDeviceList[_phidgetDeviceCount - 1]->serial == _usbDeviceList[t]->serial) { ! DBG("Found a previously attached phidget"); ! ! // We found a match ! ! _usbDeviceList[t]->handle = NULL; ! _usbDeviceList[t]->device = dev; ! _usbDeviceList[t]->attached = 1; ! ! if (_usbDeviceList[t]->openedState == WAS_OPENED) { ! _usbDeviceList[t]->openedState = WAS_CLOSED; ! phidgetOpen(_usbDeviceList[t]); ! } ! // Now delete that last item ! free(_usbDeviceList[_phidgetDeviceCount - 1]); ! _usbDeviceList[_phidgetDeviceCount - 1] = NULL; ! _phidgetDeviceCount = _phidgetDeviceCount - 1; ! ! found[t] = 1; ! ! change = 1; ! ! break; ! } ! } ! } ! } ! } ! } ! ! // Mark all detached phidgets ! for (t = 0; t < MAX_USB_DEVICES; t++) { ! if (found[t] == 0) // We didn't find this device ! if (_usbDeviceList[t] != NULL) // we have a pointer to one ! if (_usbDeviceList[t]->attached == 1) // It says it should be attached, so it isn't ! { ! DBG("Phidget was detached\n"); ! ! // This device is detached ! // If this device is open then close it. ! if (_usbDeviceList[t]->openedState == WAS_OPENED) { ! usb_release_interface(_usbDeviceList[t]->handle, 0); ! usb_close(_usbDeviceList[t]->handle); ! _usbDeviceList[t]->openedState = WAS_OPENED; ! } ! ! _usbDeviceList[t]->handle = NULL; ! _usbDeviceList[t]->device = NULL; ! _usbDeviceList[t]->attached = 0; ! ! change = 1; ! } ! } ! */ ! ! return (change); } *************** *** 489,492 **** --- 748,753 ---- DBG("phidgetInit"); + usb_init(); + _catchSignals = 0; *************** *** 510,516 **** --- 771,779 ---- _libPhidgetInitialized = 1; + /* err=_findPhidgets(); if (err!=LPE_NONE) return(_error(err)); + */ *************** *** 536,541 **** } ! return (_error(LPE_NONE)); } --- 799,805 ---- } + phidgetEvents(); ! return (phidgetLastError()); } *************** *** 632,635 **** --- 896,900 ---- ret = usb_set_configuration(phidgetDevice->handle, 1); if (ret < 0) { + printf("Can't set configuration:%d\n",ret); usb_close(phidgetDevice->handle); phidgetDevice->handle = NULL; *************** *** 663,667 **** int i = 0, j = 0; ! if (usb_control_msg(phidgetDevice->handle, 0x80, 0x06, 0x0303, 0, buffer, sizeof(buffer), 5000) == -1) { _error(LPE_NO_SERIAL_RETURNED); return (NULL); --- 928,936 ---- int i = 0, j = 0; ! i=usb_control_msg(phidgetDevice->handle, 0x80, 0x06, 0x0303, 0, buffer, sizeof(buffer), 5000); ! ! if (i!=buffer[0] || i<0) ! { ! printf("%d [%d]\n",i,buffer[0]); _error(LPE_NO_SERIAL_RETURNED); return (NULL); *************** *** 722,735 **** char buffer[6] = { 0, 0, 0, 0, 0, 0 }; ! enum ELPError err=phidgetWrite(phidgetDevice, buffer, 6); ! if (err!=LPE_NONE) ! return(_error(err)); } else { enum ELPError err; ! err=phidgetWrite(phidgetDevice, phidgetDevice->defaultData, phidgetDevice->defaultDataSize); ! if (err!=LPE_NONE) ! return(_error(err)); } } --- 991,1000 ---- char buffer[6] = { 0, 0, 0, 0, 0, 0 }; ! phidgetWrite(phidgetDevice, buffer, 6); } else { enum ELPError err; ! phidgetWrite(phidgetDevice, phidgetDevice->defaultData, phidgetDevice->defaultDataSize); } } *************** *** 751,767 **** phidgetWrite(struct phidget *phidgetDevice, char *buffer, int size) { ! DBG("phidgetWrite"); ! if (_libPhidgetInitialized == 0) ! return (_error(LPE_NOT_INITIALIZED)); ! if (phidgetDevice == NULL) ! return (_error(LPE_INVALID_PHIDGET)); ! if (phidgetDevice->attached == 0) ! return (_error(LPE_PHIDGET_NOT_ATTACHED)); ! if (phidgetDevice->handle == NULL) ! return (_error(LPE_PHIDGET_NOT_OPENED)); ! if (usb_control_msg(phidgetDevice->handle, 0x21, 0x09, 0x200, 0, buffer, size, 5000)!=size) ! return (_error(LPE_CONTROL_MSG_ERROR)); ! return (_error(LPE_NONE)); } --- 1016,1035 ---- phidgetWrite(struct phidget *phidgetDevice, char *buffer, int size) { ! int ret; ! DBG("phidgetWrite"); ! if (_libPhidgetInitialized == 0) ! return (_error(LPE_NOT_INITIALIZED)); ! if (phidgetDevice == NULL) ! return (_error(LPE_INVALID_PHIDGET)); ! if (phidgetDevice->attached == 0) ! return (_error(LPE_PHIDGET_NOT_ATTACHED)); ! if (phidgetDevice->handle == NULL) ! return (_error(LPE_PHIDGET_NOT_OPENED)); ! ret=usb_control_msg(phidgetDevice->handle, 0x21, 0x09, 0x200, 0, buffer, size, 5000); ! if (ret!=size) ! return (_error(LPE_CONTROL_MSG_ERROR)); ! ! return (_error(LPE_NONE)); } Index: phidget.h =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** phidget.h 12 Sep 2002 00:24:29 -0000 1.4 --- phidget.h 16 Sep 2002 06:40:57 -0000 1.5 *************** *** 257,260 **** --- 257,263 ---- int phidgetAttached(const struct phidget *device); + int phidgetWasAttached(const struct phidget *device); + + /** * Returns the last error that occured. No defined error can occur during this call. |