diff --git a/regexes.yaml b/regexes.yaml index 14c71a57..7f8116b8 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1145,6 +1145,29 @@ os_parsers: # Special case for new ArcGIS Mobile products - regex: 'ArcGISRuntime-(?:Android|iOS)\/\d+\.\d+(?:\.\d+|) \((Android|iOS) (\d+)(?:\.(\d+)(?:\.(\d+)|)|);' + ########## + # Chromecast + ########## + # Ex: Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV + # These are the newer Android-based "Google TV" Chromecast devices. + # Google stopped updating the Chromecast firmware version in these, so they always say CrKey/1.56.500000. Therefore we extract the more useful Android version instead. + - regex: '(Android) (\d+)(?:\.(\d+)).*CrKey' + os_replacement: 'Chromecast Android' + + # Ex: Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000 + # These are some intermediate "Nest Hub" Chromecast devices running Fuchsia. + - regex: 'Fuchsia.*(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+)|)|)' + os_replacement: 'Chromecast Fuchsia' + + # Ex: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker + - regex: 'Linux.*(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+)|)|).*DeviceType/SmartSpeaker' + os_replacement: 'Chromecast SmartSpeaker' + + # Ex: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast + # These are the oldest Chromecast devices that ran Linux. + - regex: 'Linux.*(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+)|)|)' + os_replacement: 'Chromecast Linux' + ########## # Android # can actually detect rooted android os. do we care? @@ -1826,12 +1849,6 @@ os_parsers: - regex: '(WebTV)/(\d+).(\d+)' - ########## - # Chromecast - ########## - - regex: '(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+)|)|)' - os_replacement: 'Chromecast' - ########## # Misc mobile ########## @@ -2465,6 +2482,39 @@ device_parsers: brand_replacement: 'ChangJia' model_replacement: '$1' + ########## + # Chromecast + # @ref: https://en.wikipedia.org/wiki/Chromecast#Hardware_and_design + ########## + # Ex: Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV + # Ex: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker + # Ex: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast + # These are the newer Chromecast devices, such as smart speakers, Google TVs, etc. that have an explicit device type. + - regex: 'CrKey.*DeviceType/([^/]*)' + brand_replacement: 'Google' + device_replacement: 'Chromecast' + model_replacement: '$1' + + # Ex: Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000 + # These are some intermediate "Nest Hub" Chromecast devices running Fuchsia. + - regex: 'Fuchsia.*CrKey' + brand_replacement: 'Google' + device_replacement: 'Chromecast' + model_replacement: 'Nest Hub' + + # Ex: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.47 Safari/537.36 CrKey/1.36.159268 + # These are the first generation of Chromecast devices that ran Linux. They don't specify a device type. + - regex: 'Linux.*CrKey/1.36' + brand_replacement: 'Google' + device_replacement: 'Chromecast' + model_replacement: 'First Generation' + + # We have no data on the user agent strings of other models, except that they all report CrKey/ + - regex: 'CrKey/' + brand_replacement: 'Google' + device_replacement: 'Chromecast' + model_replacement: null + ######### # Cloudfone # @ref: http://www.cloudfonemobile.com/ diff --git a/tests/test_device.yaml b/tests/test_device.yaml index 6e058b30..659df843 100644 --- a/tests/test_device.yaml +++ b/tests/test_device.yaml @@ -7735,6 +7735,36 @@ test_cases: brand: 'ChangJia' model: 'TPC97113' + - user_agent_string: 'Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV' + family: 'Chromecast' + brand: 'Google' + model: 'AndroidTV' + + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker' + family: 'Chromecast' + brand: 'Google' + model: 'SmartSpeaker' + + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast' + family: 'Chromecast' + brand: 'Google' + model: 'Chromecast' + + - user_agent_string: 'Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000' + family: 'Chromecast' + brand: 'Google' + model: 'Nest Hub' + + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.47 Safari/537.36 CrKey/1.36.159268' + family: 'Chromecast' + brand: 'Google' + model: 'First Generation' + + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) CrKey/1' + family: 'Chromecast' + brand: 'Google' + model: null + - user_agent_string: 'Mozilla/5.0 (Linux; U; Android 2.3.5; En-gb; Cloudfone_Excite320e Build/GRJ90) AppleWebKit/533.1 (KHTML, Like Gecko) Version/4.0 Mobile Safari/533.1' family: 'Cloudfone Excite 320e' brand: 'Cloudfone' diff --git a/tests/test_os.yaml b/tests/test_os.yaml index f66658e6..77b10bbf 100644 --- a/tests/test_os.yaml +++ b/tests/test_os.yaml @@ -2783,8 +2783,41 @@ test_cases: patch: '1' patch_minor: + # Android-based Chromecast (Google TV) + - user_agent_string: 'Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV' + family: 'Chromecast Android' + major: '12' + minor: '0' + patch: + patch_minor: + + # Fuchsia-based Chromecast (Nest Hub) + - user_agent_string: 'Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000' + family: 'Chromecast Fuchsia' + major: '1' + minor: '56' + patch: '500000' + patch_minor: + + # Linux-based Chromecast smart speaker, different OS from other Linux-based Chromecasts + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker' + family: 'Chromecast SmartSpeaker' + major: '1' + minor: '56' + patch: '500000' + patch_minor: + + # Latest hardware and firmware, Linux-based Chromecast + - user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast' + family: 'Chromecast Linux' + major: '1' + minor: '56' + patch: '500000' + patch_minor: + + # Older hardware and firmware, Linux-based Chromecast - user_agent_string: 'Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.84 Safari/537.36 CrKey/1.22.74257' - family: 'Chromecast' + family: 'Chromecast Linux' major: '1' minor: '22' patch: '74257'