Skip to content

Commit

Permalink
Enabled updating PCI IDs from the app itself, updated audio codecs
Browse files Browse the repository at this point in the history
  • Loading branch information
MuntashirAkon committed Apr 5, 2019
1 parent 1e56599 commit 95b1ab1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
17 changes: 6 additions & 11 deletions DPCIManager.xcodeproj/project.pbxproj
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
8716DE1F21285D0D00C47DE6 /* JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 8716DE1C2128553200C47DE6 /* JSON.m */; };
8726C0E9212ABAB5000177BF /* DataTypeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 8726C0E8212ABAB5000177BF /* DataTypeHandler.m */; };
876B527321288815003E6A82 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 876B527221288815003E6A82 /* README.md */; };
876B52812129F464003E6A82 /* dd_getopt_long-fbsd.m in Sources */ = {isa = PBXBuildFile; fileRef = 876B52782129F463003E6A82 /* dd_getopt_long-fbsd.m */; };
876B52822129F464003E6A82 /* DDCliApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 876B52792129F463003E6A82 /* DDCliApplication.m */; };
876B52832129F464003E6A82 /* DDCliParseException.m in Sources */ = {isa = PBXBuildFile; fileRef = 876B527B2129F464003E6A82 /* DDCliParseException.m */; };
Expand Down Expand Up @@ -292,6 +291,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = B02571301601496300B0E1EB;
Expand All @@ -311,7 +311,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
876B527321288815003E6A82 /* README.md in Resources */,
B02571561601496400B0E1EB /* MainMenu.xib in Resources */,
B025716A16018D0600B0E1EB /* DPCIManager.icns in Resources */,
B025716C16018D9600B0E1EB /* pci.ids in Resources */,
Expand All @@ -333,7 +332,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "CPV=$[ CURRENT_PROJECT_VERSION+1 ]\nsed -i '' \"s/CURRENT_PROJECT_VERSION = $CURRENT_PROJECT_VERSION/CURRENT_PROJECT_VERSION = $CPV/\" $PROJECT_NAME.xcodeproj/project.pbxproj";
shellScript = "CPV=$[ CURRENT_PROJECT_VERSION+1 ]\nsed -i '' \"s/CURRENT_PROJECT_VERSION = $CURRENT_PROJECT_VERSION/CURRENT_PROJECT_VERSION = $CPV/\" $PROJECT_NAME.xcodeproj/project.pbxproj\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -407,8 +406,8 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_MARKETING_VERSION = 1.9;
CURRENT_PROJECT_VERSION = 291;
CURRENT_MARKETING_VERSION = 2.0;
CURRENT_PROJECT_VERSION = 311;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -457,8 +456,8 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_MARKETING_VERSION = 1.9;
CURRENT_PROJECT_VERSION = 291;
CURRENT_MARKETING_VERSION = 2.0;
CURRENT_PROJECT_VERSION = 311;
DEBUG_INFORMATION_FORMAT = dwarf;
DEPLOYMENT_POSTPROCESSING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -480,7 +479,6 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
CURRENT_MARKETING_VERSION = 1.9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DPCIManager/DPCIManager-Prefix.pch";
INFOPLIST_FILE = "DPCIManager/DPCIManager-Info.plist";
Expand All @@ -494,7 +492,6 @@
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
CURRENT_MARKETING_VERSION = 1.9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DPCIManager/DPCIManager-Prefix.pch";
INFOPLIST_FILE = "DPCIManager/DPCIManager-Info.plist";
Expand Down Expand Up @@ -540,7 +537,6 @@
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
CURRENT_MARKETING_VERSION = 1.9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DPCIManager/DPCIManager-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/DPCIManager/DPCIManager-Info.plist";
Expand All @@ -561,7 +557,6 @@
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
CURRENT_MARKETING_VERSION = 1.9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DPCIManager/DPCIManager-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/DPCIManager/DPCIManager-Info.plist";
Expand Down
8 changes: 7 additions & 1 deletion DPCIManager/AppDelegate.m
Expand Up @@ -32,6 +32,12 @@ @implementation AppDelegate
#pragma mark ApplicationDelegate
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification{
// Insert code here to initialize your application
NSString *pciIDsCachePath = pciIDsPath;
NSString *pciIDsBundlePath = [NSBundle.mainBundle pathForResource:@"pci" ofType:@"ids"];
if(![NSFileManager.defaultManager fileExistsAtPath:pciIDsCachePath]){
[NSFileManager.defaultManager copyItemAtPath:pciIDsBundlePath toPath:pciIDsCachePath error:nil];
[NSFileManager.defaultManager setAttributes:@{NSFileModificationDate: [[NSFileManager.defaultManager attributesOfItemAtPath:pciIDsBundlePath error:nil] fileModificationDate]} ofItemAtPath:pciIDsCachePath error:nil];
}
self.patch = @"0x00000000";
self.bdmesg = [AppDelegate bdmesg];
self.pcis = [pciDevice readIDs];
Expand Down Expand Up @@ -86,7 +92,7 @@ -(IBAction)copy:(id)sender{
}
-(IBAction)updateIDs:(id)sender{
[sender setEnabled:false];
if ([URLTask conditionalGet:[NSURL URLWithString:@"https://pci-ids.ucw.cz/pci.ids"] toFile:[NSBundle.mainBundle pathForResource:@"pci" ofType:@"ids"]]) {
if ([URLTask conditionalGet:[NSURL URLWithString:@"https://pci-ids.ucw.cz/pci.ids"] toFile:pciIDsPath]) {
[sender setLabel:@"Found"];
self.pcis = [pciDevice readIDs];
}
Expand Down
1 change: 1 addition & 0 deletions DPCIManager/DPCIManager-Prefix.pch
Expand Up @@ -11,6 +11,7 @@
#define assignWithNotice(x,y,z) [x willChangeValueForKey:@""#y];y=z;[x didChangeValueForKey:@""#y];
#define muteWithNotice(x,y,z) [x willChangeValueForKey:@""#y];z;[x didChangeValueForKey:@""#y];
#define strHexDec(x) strtol([x UTF8String], NULL, 16)
#define pciIDsPath [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"pci.ids"]
NS_INLINE NSError* ModalError(NSError *error){
if (error)
[[NSAlert alertWithError:error] runModal];
Expand Down
2 changes: 1 addition & 1 deletion DPCIManager/PCI.m
Expand Up @@ -151,7 +151,7 @@ -(short)bdf {
return -1;
}
+(NSArray *)readIDs{
FILE *handle = fopen([[NSBundle.mainBundle pathForResource:@"pci" ofType:@"ids"] fileSystemRepresentation], "rb");
FILE *handle = fopen([pciIDsPath fileSystemRepresentation], "rb");
NSMutableDictionary *classes = [NSMutableDictionary dictionary];
NSMutableDictionary *vendors = [NSMutableDictionary dictionary];
NSNumber *currentClass;
Expand Down
10 changes: 8 additions & 2 deletions DPCIManager/Tables.h
Expand Up @@ -62,16 +62,17 @@
#define HDA_CODEC_ALC294 HDA_CODEC_CONSTRUCT(REALTEK, 0x0294)
#define HDA_CODEC_ALC295 HDA_CODEC_CONSTRUCT(REALTEK, 0x0295)
#define HDA_CODEC_ALC298 HDA_CODEC_CONSTRUCT(REALTEK, 0x0298)
#define HDA_CODEC_ALC299 HDA_CODEC_CONSTRUCT(REALTEK, 0x0299)
#define HDA_CODEC_ALC660 HDA_CODEC_CONSTRUCT(REALTEK, 0x0660)
#define HDA_CODEC_ALC861 HDA_CODEC_CONSTRUCT(REALTEK, 0x0861)
#define HDA_CODEC_ALC662 HDA_CODEC_CONSTRUCT(REALTEK, 0x0662)
#define HDA_CODEC_ALC861VD HDA_CODEC_CONSTRUCT(REALTEK, 0x0862)
#define HDA_CODEC_ALC663 HDA_CODEC_CONSTRUCT(REALTEK, 0x0663)
#define HDA_CODEC_ALC665 HDA_CODEC_CONSTRUCT(REALTEK, 0x0665)
#define HDA_CODEC_ALC668 HDA_CODEC_CONSTRUCT(REALTEK, 0x0668)
#define HDA_CODEC_ALC670 HDA_CODEC_CONSTRUCT(REALTEK, 0x0670)
#define HDA_CODEC_ALC671 HDA_CODEC_CONSTRUCT(REALTEK, 0x0671)
#define HDA_CODEC_ALC680 HDA_CODEC_CONSTRUCT(REALTEK, 0x0680)
#define HDA_CODEC_ALC861 HDA_CODEC_CONSTRUCT(REALTEK, 0x0861)
#define HDA_CODEC_ALC861VD HDA_CODEC_CONSTRUCT(REALTEK, 0x0862)
#define HDA_CODEC_ALC880 HDA_CODEC_CONSTRUCT(REALTEK, 0x0880)
#define HDA_CODEC_ALC882 HDA_CODEC_CONSTRUCT(REALTEK, 0x0882)
#define HDA_CODEC_ALC883 HDA_CODEC_CONSTRUCT(REALTEK, 0x0883)
Expand All @@ -84,6 +85,7 @@
#define HDA_CODEC_ALC898 HDA_CODEC_CONSTRUCT(REALTEK, 0x0898)
#define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899)
#define HDA_CODEC_ALC1150 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900)
#define HDA_CODEC_ALCS1200A HDA_CODEC_CONSTRUCT(REALTEK, 0x0B00) // A = Asus
#define HDA_CODEC_ALCS1220A HDA_CODEC_CONSTRUCT(REALTEK, 0x1168) // A = Asus
#define HDA_CODEC_ALC1220 HDA_CODEC_CONSTRUCT(REALTEK, 0x1220)
#define HDA_CODEC_ALCXXXX HDA_CODEC_CONSTRUCT(REALTEK, 0xffff)
Expand Down Expand Up @@ -250,6 +252,7 @@
#define HDA_CODEC_CX8050 HDA_CODEC_CONSTRUCT(CONEXANT, 0x1f72)
#define HDA_CODEC_CX8150 HDA_CODEC_CONSTRUCT(CONEXANT, 0x1fd6)
#define HDA_CODEC_CX8200 HDA_CODEC_CONSTRUCT(CONEXANT, 0x2008)
#define HDA_CODEC_CX8400 HDA_CODEC_CONSTRUCT(CONEXANT, 0x20d0)
#define HDA_CODEC_CX20549 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5045)
#define HDA_CODEC_CX20551 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5047)
#define HDA_CODEC_CX20561 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051)
Expand Down Expand Up @@ -435,6 +438,7 @@ static const struct {UInt32 id; UInt16 rev; char *name;} gCodecList[] = {
{ HDA_CODEC_ALC294, 0x0000, "Realtek ALC294" },
{ HDA_CODEC_ALC295, 0x0000, "Realtek ALC295" },
{ HDA_CODEC_ALC298, 0x0000, "Realtek ALC298" }, // rev 0x100101, 0x100103
{ HDA_CODEC_ALC299, 0x0000, "Realtek ALC299" }, // rev 0x100002
{ HDA_CODEC_ALC660, 0x0000, "Realtek ALC660" },
{ HDA_CODEC_ALC662, 0x0000, "Realtek ALC662" }, // rev 0x100101, 0x100300
{ HDA_CODEC_ALC662, 0x0002, "Realtek ALC662v2" },
Expand Down Expand Up @@ -468,6 +472,7 @@ static const struct {UInt32 id; UInt16 rev; char *name;} gCodecList[] = {
{ HDA_CODEC_ALC899, 0x0000, "Realtek ALC899" },
{ HDA_CODEC_ALC1150, 0x0000, "Realtek ALC1150" }, // rev 0x100001
{ HDA_CODEC_ALC1220, 0x0000, "Realtek ALC1220" }, // rev 0x100101, 0x100003
{ HDA_CODEC_ALCS1200A, 0x0000, "Realtek ALCS1200A" }, // rev 0x100001
{ HDA_CODEC_ALCS1220A, 0x0000, "Realtek ALCS1220A" },
{ HDA_CODEC_AD1882, 0x0000, "Analog Devices AD1882" },
{ HDA_CODEC_AD1882A, 0x0000, "Analog Devices AD1882A" },
Expand Down Expand Up @@ -592,6 +597,7 @@ static const struct {UInt32 id; UInt16 rev; char *name;} gCodecList[] = {
{ HDA_CODEC_CX8050, 0x0000, "Conexant CX8050" },
{ HDA_CODEC_CX8150, 0x0000, "Conexant CX8150" },
{ HDA_CODEC_CX8200, 0x0000, "Conexant CX8200" },
{ HDA_CODEC_CX8400, 0x0000, "Conexant CX8400" },
{ HDA_CODEC_CX20549, 0x0000, "Conexant CX20549 (Venice)" },
{ HDA_CODEC_CX20551, 0x0000, "Conexant CX20551 (Waikiki)" },
{ HDA_CODEC_CX20561, 0x0000, "Conexant CX20561 (Hermosa)" }, // rev 0x100000
Expand Down

0 comments on commit 95b1ab1

Please sign in to comment.