mirror of https://github.com/nirenjan/libx52.git
				
				
				
			Add check for X52 vs X52 Pro
This doesn't do anything at the moment, but this should make it easier to distinguish between the Pro and non-pro models. Issue: #11feature/alt_lookup_engine
							parent
							
								
									0f7b5e5668
								
							
						
					
					
						commit
						793cd519a2
					
				| 
						 | 
					@ -38,6 +38,7 @@ struct libx52_device {
 | 
				
			||||||
    libusb_device_handle *hdl;
 | 
					    libusb_device_handle *hdl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint32_t update_mask;
 | 
					    uint32_t update_mask;
 | 
				
			||||||
 | 
					    uint32_t flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint32_t led_mask;
 | 
					    uint32_t led_mask;
 | 
				
			||||||
    uint16_t mfd_brightness;
 | 
					    uint16_t mfd_brightness;
 | 
				
			||||||
| 
						 | 
					@ -55,6 +56,9 @@ struct libx52_device {
 | 
				
			||||||
    libx52_clock_format time_format[X52_MFD_CLOCKS];
 | 
					    libx52_clock_format time_format[X52_MFD_CLOCKS];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Flag bits */
 | 
				
			||||||
 | 
					#define X52_FLAG_IS_PRO         0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Indicator bits for update mask */
 | 
					/** Indicator bits for update mask */
 | 
				
			||||||
#define X52_BIT_SHIFT           0
 | 
					#define X52_BIT_SHIFT           0
 | 
				
			||||||
#define X52_BIT_LED_FIRE        1
 | 
					#define X52_BIT_LED_FIRE        1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,12 @@ static int libx52_check_product(uint16_t idVendor, uint16_t idProduct)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Check if the attached device is an X52 Pro */
 | 
				
			||||||
 | 
					static int libx52_device_is_x52pro(uint16_t idProduct)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return (idProduct == X52_PROD_X52PRO);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libx52_device* libx52_init(void)
 | 
					libx52_device* libx52_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int rc;
 | 
					    int rc;
 | 
				
			||||||
| 
						 | 
					@ -75,6 +81,10 @@ libx52_device* libx52_init(void)
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                x52_dev->hdl = hdl;
 | 
					                x52_dev->hdl = hdl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (libx52_device_is_x52pro(desc.idProduct)) {
 | 
				
			||||||
 | 
					                    set_bit(&(x52_dev->flags), X52_FLAG_IS_PRO);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue