X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJDevice.m;h=bf3925132189f868949e018599ecfe190f8db043;hp=e4c6b3d27c0f735376eeb60f8cb87c332ca86c89;hb=e7c0b2d96e9e3209b5ba80cc1fdc8e7213cb5302;hpb=561fa1774ce33b5a4a8112ba5802cc33a2ca819d diff --git a/Classes/NJDevice.m b/Classes/NJDevice.m index e4c6b3d..bf39251 100644 --- a/Classes/NJDevice.m +++ b/Classes/NJDevice.m @@ -72,16 +72,23 @@ static NSArray *InputsForElement(IOHIDDeviceRef device, id parent) { _vendorId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVendorIDKey)) intValue]; _productId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductIDKey)) intValue]; self.children = InputsForElement(dev, self); + self.index = 1; } return self; } +- (BOOL)isEqual:(id)object { + return [object isKindOfClass:NJDevice.class] + && [[(NJDevice *)object productName] isEqualToString:self.productName] + && [(NJDevice *)object index] == self.index; +} + - (NSString *)name { return [NSString stringWithFormat:@"%@ #%d", _productName, _index]; } - (NSString *)uid { - return [NSString stringWithFormat: @"%d:%d:%d", _vendorId, _productId, _index]; + return [NSString stringWithFormat:@"%d:%d:%d", _vendorId, _productId, _index]; } - (NJInput *)findInputByCookie:(IOHIDElementCookie)cookie {