2 classvar <>all,<folder;
4 var <map, <device, <info;
7 folder = (Platform.userAppSupportDir +/+ "GeneralHIDSpecs").standardizePath;
8 if ( this.checkSaveFolder ){ this.loadSavedInfo; };
9 all = all ? IdentityDictionary.new;
14 filename = (folder+/+"allspecs.info");
15 if ( File.exists(filename) ){
21 ^File.exists( folder );
25 var testfile, testname = "zzz_generalhid_test_delete_me.txt";
26 folder = (Platform.userAppSupportDir +/+ "GeneralHIDSpecs").standardizePath;
27 testfile = File(folder +/+ testname, "w");
29 if (testfile.isOpen.not)
31 { testfile.close; unixCmd("rm" + folder.escapeChar($ ) +/+ testname) }
40 map = IdentityDictionary.new;
41 info = IdentityDictionary.new;
42 info.put( \vendor, device.info.vendor );
43 info.put( \name, device.info.name );
44 info.put( \product, device.info.product );
45 info.put( \version, device.info.version );
46 info.put( \scheme, GeneralHID.scheme );
50 ^all.select{ |thisspec,key|
51 ( thisspec[\vendor] == device.info.vendor ) and:
52 ( thisspec[\name] == device.info.name ) and:
53 ( thisspec[\product] == device.info.product ) and:
54 ( thisspec[\version] == device.info.version ) and:
55 ( thisspec[\scheme] == GeneralHID.current )
61 this.at( key ).key = key;
69 ^device.slots[id1][id2];
95 createBus{ |name,server|
96 this.at( name ).createBus( server );
100 this.at( name ).freeBus;
103 /* setAllActions{ |action|
105 device.slots.at( it[0] ).at( it[1] ).action_( action );
109 createAllBuses{ |server|
111 device.slots.at( it[0] ).at( it[1] ).createBus( server );
117 device.slots.at( it[0] ).at( it[1] ).freeBus;
122 var file, res = false;
124 all.put( name.asSymbol, info );
125 if ( GeneralHIDSpec.checkSaveFolder.not ) { GeneralHIDSpec.makeSaveFolder };
126 filename = folder +/+ name ++ ".spec";
127 file = File(filename, "w");
129 res = file.write(map.asCompileString);
137 var file, res = false;
139 if ( GeneralHIDSpec.checkSaveFolder.not ) { GeneralHIDSpec.makeSaveFolder };
140 filename = folder +/+ "allspecs.info";
141 file = File(filename, "w");
143 res = file.write(all.asCompileString);
150 if ( GeneralHIDSpec.checkSaveFolder.not ) { GeneralHIDSpec.makeSaveFolder };
151 map = (folder +/+ name++".spec").load;
152 map.keysValuesDo{ |key,it|
153 this.at( key ).key = key;