Jump to content
2,189 posts in this topic

Recommended Posts

On 20.04.2018 at 4:44 PM, vector sigma said:

Ok, give me a whistle when (if) you decide to do it

I did this!

 

 

And now the new error 

Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1: /Volumes/MacHD/Users/sergey/Documents/Projects/hwsensors3/trunk/hwmonitor2/HWMonitorSMC/Framenworks/SystemKit.framework/Modules/SystemKit.swiftmodule/x86_64.swiftmodule

Снимок экрана 2018-04-22 в 12.43.48.png

Link to comment
Share on other sites

51 minutes ago, Slice said:

See my changes to the project to compile without warnings and the application works fine.

 

myDiff.txt

Works if I change back to latest sdk (now I realized that I no longer have the 10.11 sdk in Xcode 9.3), but why not releasing the memory? you should do it otherwise is like calling malloc() whitout calling free(). example:

hostInfo.deallocate(capacity: 1)

should now be:

hostInfo.deallocate()

..and so on for the other..

test this one please: System.swift.zip

 

EDIT

if deallocate() doesn't work with 10.11sdk is best to leave like before (deallocate(capacity:1)) and see the warning, imho.

 

Edited by vector sigma
Link to comment
Share on other sites

19 minutes ago, Slice said:

I am using SDK10.13 for SystemKit and HWMonitor and SDK10.11 for kexts.

deallocate() is deprecated as swift 4.1 automatically frees memory.

 

Where did you reade this? As far as I know it has automatic reference counting for objects that track this, but here we are calling "unsafe" pointer as per definitions is unsafe just because is not managed:

struct UnsafeMutablePointer<Pointee> : _Pointer
Description	
A pointer for accessing and manipulating data of a specific type.
You use instances of the UnsafeMutablePointer type to access data of a specific type in memory. The type of data that a pointer can access is the pointer’s Pointee type. UnsafeMutablePointer provides no automated memory management or alignment guarantees. You are responsible for handling the life cycle of any memory you work with through unsafe pointers to avoid leaks or undefined behavior.
Memory that you manually manage can be either untyped or bound to a specific type. You use the UnsafeMutablePointer type to access and manage memory that has been bound to a specific type.
SDK	Xcode 6.0.1+
Declared In	Swift Standard Library
More	Structure Reference

and when you allocate:

static func allocate(capacity count: Int) -> UnsafeMutablePointer<Pointee>
Description	
Allocates uninitialized memory for the specified number of instances of type Pointee.
The resulting pointer references a region of memory that is bound to Pointee and is count * MemoryLayout<Pointee>.stride bytes in size.
The following example allocates enough new memory to store four Int instances and then initializes that memory with the elements of a range.
Listing 1
let intPointer = UnsafeMutablePointer<Int>.allocate(capacity: 4)
intPointer.initialize(from: 1...4)
print(intPointer.pointee)
// Prints "1"
When you allocate memory, always remember to deallocate once you’re finished.
Listing 2
intPointer.deallocate()
Parameters	
count
The amount of memory to allocate, counted in instances of Pointee.
SDK	Xcode 8.0+
Declared In	Swift Standard Library
More	Type Method Reference

deallocate() is deprecated as swift 4.1 automatically frees memory.

'func deallocate(capacity _: Int)' is deprecated, but now you should use: 'func deallocate()'

...please deallocate the memory because is not managed.

Edited by vector sigma
Link to comment
Share on other sites

@Slice, I have an easy solution, take a look: hwmonitor2.zip

SystemKit is no longer an external framenwork, also I fixed the uname() function so that now it prints missing informations:

    Sys name: Darwin
    Node name: FrancescoRs-MBP.station
    Release: 17.6.0
    Version: Darwin Kernel Version 17.6.0: Fri Apr 13 19:57:44 PDT 2018; root:xnu-4570.60.17.0.1~3/RELEASE_X86_64
    Machine: x86_64

 

Edited by vector sigma
added new output
Link to comment
Share on other sites

Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1: /Volumes/MacHD/Users/sergey/Documents/Projects/hwsensors3/trunk/hwmonitor2/HWMonitorSMC/Framenworks/SystemKit.framework/Modules/SystemKit.swiftmodule/x86_64.swiftmodule

Link to comment
Share on other sites

2 minutes ago, Slice said:

Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1: /Volumes/MacHD/Users/sergey/Documents/Projects/hwsensors3/trunk/hwmonitor2/HWMonitorSMC/Framenworks/SystemKit.framework/Modules/SystemKit.swiftmodule/x86_64.swiftmodule

Ha ha, wrong archive, sorry. this is the right: hwmonitor2.zip

Link to comment
Share on other sites

2 hours ago, Slice said:

More information about CPU?

Check this one: hwmonitor2.zip, there is much more information about the CPU

MACHINE STATUS:

   CPU:
	Name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
	Vendor: GenuineIntel
	Physical cores: 2
	Logical cores: 4
	Family: 6
	Model: 58
	Ext Model: 3
	Ext Family: 0
	Stepping: 9
	Signature: 198313
	Brand: 0
	Features:  FPU VME DE PSE TSC MSR PAE MCE
	                CX8 APIC SEP MTRR PGE MCA CMOV PAT
	                PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2
	                SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON
	                DSCPL VMX EST TM2 SSSE3 CX16 TPR PDCM
	                SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE
	                TSCTMR AVX1.0 RDRAND F16C
	Ext Features:  SYSCALL XD EM64T LAHF RDTSCP TSCI
	Microcode version: 31
	Thermal sensors: 1
	Thermal invariant APIC timer: 1

	System: 1%
	User: 3%
	Idle: 95%
	Nice: 0%

   MEMORY:
	Physical size: 8.0GB
	Free: 48MB
	Wired: 1.99GB
	Active: 2.39GB
	Inactive: 2.36GB
	Compressed: 1.22GB

   SYSTEM:
	Model: MacBookPro10,1
	Sys name: Darwin
	Node name: FrancescoRs-MBP.station
	Release: 17.6.0
	Version: Darwin Kernel Version 17.6.0: Fri Apr 13 19:57:44 PDT 2018; root:xnu-4570.60.17.0.1~3/RELEASE_X86_64
	Machine: x86_64
	Uptime: 2d 8h 40m 15s
	Processes: 350
	Threads: 1264
	Load Average: [1.74, 1.49, 1.44]
	Mach Factor: [2.8799999999999999, 2.4100000000000001, 2.2010000000000001]

   POWER:
	CPU Speed limit: 100.0%
	CPUs available: 8
	Scheduler limit: 100.0%
	Thermal level: Not Published

   BATTERY:
	AC Powered: false
	Charged: false
	Charging: false
	Charge: 37.0%
	Capacity: 3248 mAh
	Max capacity: 8719 mAh
	Design capacity: 8719 mAh
	Cycles: 487
	Max cycles: 1000
	Temperature: 22.0°C
	Time remaining: 1:56

 

Edited by vector sigma
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

10 hours ago, vector sigma said:

Check this one: hwmonitor2.zip, there is much more information about the CPU


MACHINE STATUS:

   CPU:
	Name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
	Vendor: GenuineIntel
	Physical cores: 2
	Logical cores: 4
	Family: 6
	Model: 58
	Ext Model: 3
	Ext Family: 0
	Stepping: 9
	Signature: 198313
	Brand: 0
	Features:  FPU VME DE PSE TSC MSR PAE MCE
	                CX8 APIC SEP MTRR PGE MCA CMOV PAT
	                PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2
	                SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON
	                DSCPL VMX EST TM2 SSSE3 CX16 TPR PDCM
	                SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE
	                TSCTMR AVX1.0 RDRAND F16C
	Ext Features:  SYSCALL XD EM64T LAHF RDTSCP TSCI
	Microcode version: 31
	Thermal sensors: 1
	Thermal invariant APIC timer: 1

	System: 1%
	User: 3%
	Idle: 95%
	Nice: 0%

   MEMORY:
	Physical size: 8.0GB
	Free: 48MB
	Wired: 1.99GB
	Active: 2.39GB
	Inactive: 2.36GB
	Compressed: 1.22GB

   SYSTEM:
	Model: MacBookPro10,1
	Sys name: Darwin
	Node name: FrancescoRs-MBP.station
	Release: 17.6.0
	Version: Darwin Kernel Version 17.6.0: Fri Apr 13 19:57:44 PDT 2018; root:xnu-4570.60.17.0.1~3/RELEASE_X86_64
	Machine: x86_64
	Uptime: 2d 8h 40m 15s
	Processes: 350
	Threads: 1264
	Load Average: [1.74, 1.49, 1.44]
	Mach Factor: [2.8799999999999999, 2.4100000000000001, 2.2010000000000001]

   POWER:
	CPU Speed limit: 100.0%
	CPUs available: 8
	Scheduler limit: 100.0%
	Thermal level: Not Published

   BATTERY:
	AC Powered: false
	Charged: false
	Charging: false
	Charge: 37.0%
	Capacity: 3248 mAh
	Max capacity: 8719 mAh
	Design capacity: 8719 mAh
	Cycles: 487
	Max cycles: 1000
	Temperature: 22.0°C
	Time remaining: 1:56

 

Commit, please! It will be better for me to see changes.

Link to comment
Share on other sites

Hi @vector sigma,

See a solution to print CPU model and signature as Hex numbers

    statusString += String(format: "\tModel: 0x%X\n", System.sysctlbynameInt("machdep.cpu.model"))
    statusString += "\tExt Model: \(System.sysctlbynameInt("machdep.cpu.extmodel"))\n"
    statusString += "\tExt Family: \(System.sysctlbynameInt("machdep.cpu.extfamily"))\n"
    statusString += "\tStepping: \(System.sysctlbynameInt("machdep.cpu.stepping"))\n"
    statusString += String(format: "\tSignature: 0x%X\n", System.sysctlbynameInt("machdep.cpu.signature"))

 

Снимок экрана 2018-04-23 в 10.30.22.png

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Extreme™ said:

Hello!

In my signature system the program does not show the life of the hard drives but only that of the ssd.

 

High Sierra 10.13.4

screenshot_04.png

Normal, rotational hard drives doesn't have attributes for life... (not even all ssds have it).

  • Like 1
Link to comment
Share on other sites

Well this is what I got:

Displays:
	Framebuffer: 0x2BC4E780
	Size: 1600x900
	Depth bits Per Pixel: 24
	Depth bits Per Sample: 8
	Depth is Planar: false
	Frame: (0.0, 0.0, 1600.0, 900.0)
	Visible Frame: (37.0, 0.0, 1563.0, 877.0)
	Depth backing Scale Factor: 1.0
	Name: Display
	Vendor Id: 0x6AF (1711)
	Product Id: 0x139E (5022)
	Year Of Manufacture: 2013
	Week of Manufacture: 17
	Blue Point X: 0.150390625
	Blue Point Y: 0.0595703125
	Green Point Y: 0.3251953125
	Green Point Y: 0.5703125
	Red Point X: 0.6201171875
	Red Point Y: 0.33984375
	White Point X: 0.3134765625
	White Point Y: 0.3291015625
	White Gamma: 2.20000004768372
	Brightness Affects Gamma: true
	Horizontal Image Size: 380
	Vertical Image Size: 210
	Has Back light: true
	Is Digital: true
	Is HDMI Sink: false

	EDID data:
	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 
	0x06, 0xAF, 0x9E, 0x13, 0x00, 0x00, 0x00, 0x00, 
	0x01, 0x13, 0x01, 0x03, 0x80, 0x26, 0x15, 0x78, 
	0x0A, 0xC4, 0x95, 0x9E, 0x57, 0x53, 0x92, 0x26, 
	0x0F, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01, 
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1C, 0x2A, 
	0x40, 0x6E, 0x61, 0x84, 0x0C, 0x30, 0x30, 0x20, 
	0x36, 0x00, 0x7E, 0xD6, 0x10, 0x00, 0x00, 0x18, 
	0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x20, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x41, 
	0x55, 0x4F, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 
	0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFE, 
	0x00, 0x42, 0x31, 0x37, 0x33, 0x52, 0x57, 0x30, 
	0x31, 0x20, 0x56, 0x33, 0x20, 0x0A, 0x00, 0x24

next step is to integrate relative code in the app

  • Thanks 1
Link to comment
Share on other sites

On 23.04.2018 at 6:50 PM, vector sigma said:

@Slice what's te correct russian translation for "copy to clip board"?

ctcb.png.26b7f4cc5f00ba4909f5c04a61032c8a.png

 

.. I need also a translation for "log copied to clip board!"

"copy to clip board" - "скопировать"

"log copied to clip board!" - "журнал скопированного"

 

12 hours ago, vector sigma said:

@Slice is better to show EDID data like the following :


00ffffff ffffff00 06af9e13 00000000
....

or this way:


0x00, 0xFF, 0xFF, 0xFF, .....
....

?

First one is better.

 

9 hours ago, vector sigma said:

Well this is what I got:


Displays:
	Framebuffer: 0x2BC4E780
	Size: 1600x900
	Depth bits Per Pixel: 24
	Depth bits Per Sample: 8
	Depth is Planar: false
	Frame: (0.0, 0.0, 1600.0, 900.0)
	Visible Frame: (37.0, 0.0, 1563.0, 877.0)
	Depth backing Scale Factor: 1.0
	Name: Display
	Vendor Id: 0x6AF (1711)
	Product Id: 0x139E (5022)
	Year Of Manufacture: 2013
	Week of Manufacture: 17
	Blue Point X: 0.150390625
	Blue Point Y: 0.0595703125
	Green Point Y: 0.3251953125
	Green Point Y: 0.5703125
	Red Point X: 0.6201171875
	Red Point Y: 0.33984375
	White Point X: 0.3134765625
	White Point Y: 0.3291015625
	White Gamma: 2.20000004768372
	Brightness Affects Gamma: true
	Horizontal Image Size: 380
	Vertical Image Size: 210
	Has Back light: true
	Is Digital: true
	Is HDMI Sink: false

	EDID data:
	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 
	0x06, 0xAF, 0x9E, 0x13, 0x00, 0x00, 0x00, 0x00, 
	0x01, 0x13, 0x01, 0x03, 0x80, 0x26, 0x15, 0x78, 
	0x0A, 0xC4, 0x95, 0x9E, 0x57, 0x53, 0x92, 0x26, 
	0x0F, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01, 
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1C, 0x2A, 
	0x40, 0x6E, 0x61, 0x84, 0x0C, 0x30, 0x30, 0x20, 
	0x36, 0x00, 0x7E, 0xD6, 0x10, 0x00, 0x00, 0x18, 
	0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x20, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x41, 
	0x55, 0x4F, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 
	0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFE, 
	0x00, 0x42, 0x31, 0x37, 0x33, 0x52, 0x57, 0x30, 
	0x31, 0x20, 0x56, 0x33, 0x20, 0x0A, 0x00, 0x24

next step is to integrate relative code in the app

Good! I think to reduce EDID as talking above. 

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

×
×
  • Create New...