You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							45 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							45 lines
						
					
					
						
							1.2 KiB
						
					
					
				| --- a/glcddrivers/framebuffer.c | |
| +++ b/glcddrivers/framebuffer.c | |
| @@ -24,6 +24,18 @@ | |
|  #include "config.h" | |
|  #include "framebuffer.h" | |
|   | |
| +int proc_put(const char *path, const char *value, const int len) | |
| +{ | |
| +	int ret, ret2; | |
| +	int pfd = open(path, O_WRONLY); | |
| +	if (pfd < 0) | |
| +		return pfd; | |
| +	ret = write(pfd, value, len); | |
| +	ret2 = close(pfd); | |
| +	if (ret2 < 0) | |
| +		return ret2; | |
| +	return ret; | |
| +} | |
|   | |
|  namespace GLCD | |
|  { | |
| @@ -443,4 +455,13 @@ | |
|      bbox[3] = 0; | |
|  } | |
|   | |
| +void cDriverFramebuffer::SetBrightness(unsigned int dimm) | |
| +{ | |
| +	std::string value = std::to_string((int)(255*dimm*10/100)); | |
| +	if (access("/proc/stb/lcd/oled_brightness", F_OK) == 0) | |
| +		proc_put("/proc/stb/lcd/oled_brightness", value.c_str(), value.length()); | |
| +	else if (access("/proc/stb/fp/oled_brightness", F_OK) == 0) | |
| +		proc_put("/proc/stb/fp/oled_brightness", value.c_str(), value.length()); | |
| +} | |
| + | |
|  } // end of namespace | |
| --- a/glcddrivers/framebuffer.h | |
| +++ b/glcddrivers/framebuffer.h | |
| @@ -53,6 +53,7 @@ | |
|      virtual void SetPixel(int x, int y, uint32_t data); | |
|      //virtual void Set8Pixels(int x, int y, unsigned char data); | |
|      virtual void Refresh(bool refreshAll = false); | |
| +    virtual void SetBrightness(unsigned int); | |
|  }; | |
|   | |
|  } // end of namespace
 | |
| 
 |