X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJDevice.m;h=c6cc201a119b27bd672437038d4d15ec20d85a74;hp=bf3925132189f868949e018599ecfe190f8db043;hb=281e575060f936fd9483d1cf6416851b3783fe42;hpb=794a6e8c99be447b2ebc2b5510f7bf8ddeb4d75d diff --git a/Classes/NJDevice.m b/Classes/NJDevice.m index bf39251..c6cc201 100644 --- a/Classes/NJDevice.m +++ b/Classes/NJDevice.m @@ -66,9 +66,9 @@ static NSArray *InputsForElement(IOHIDDeviceRef device, id parent) { } - (id)initWithDevice:(IOHIDDeviceRef)dev { - if ((self = [super initWithName:nil eid:nil parent:nil])) { + NSString *name = (__bridge NSString *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductKey)); + if ((self = [super initWithName:name eid:nil parent:nil])) { self.device = dev; - self.productName = (__bridge NSString *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductKey)); _vendorId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVendorIDKey)) intValue]; _productId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductIDKey)) intValue]; self.children = InputsForElement(dev, self); @@ -79,12 +79,11 @@ static NSArray *InputsForElement(IOHIDDeviceRef device, id parent) { - (BOOL)isEqual:(id)object { return [object isKindOfClass:NJDevice.class] - && [[(NJDevice *)object productName] isEqualToString:self.productName] - && [(NJDevice *)object index] == self.index; + && [[(NJDevice *)object name] isEqualToString:self.name]; } - (NSString *)name { - return [NSString stringWithFormat:@"%@ #%d", _productName, _index]; + return [NSString stringWithFormat:@"%@ #%d", super.name, _index]; } - (NSString *)uid {