diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.clang-format clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.clang-format --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.clang-format 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.clang-format 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,531 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# clang-format configuration file. Intended for clang-format >= 4. +# +# For more information, see: +# +# Documentation/process/clang-format.rst +# https://clang.llvm.org/docs/ClangFormat.html +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# +--- +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +#AlignEscapedNewlines: Left # Unknown to clang-format-4.0 +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + #AfterExternBlock: false # Unknown to clang-format-5.0 + BeforeCatch: false + BeforeElse: false + IndentBraces: false + #SplitEmptyFunction: true # Unknown to clang-format-4.0 + #SplitEmptyRecord: true # Unknown to clang-format-4.0 + #SplitEmptyNamespace: true # Unknown to clang-format-4.0 +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0 +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0 +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +#CompactNamespaces: false # Unknown to clang-format-4.0 +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +#FixNamespaceComments: false # Unknown to clang-format-4.0 + +# Taken from: +# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \ +# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ +# | sort | uniq +ForEachMacros: + - 'apei_estatus_for_each_section' + - 'ata_for_each_dev' + - 'ata_for_each_link' + - '__ata_qc_for_each' + - 'ata_qc_for_each' + - 'ata_qc_for_each_raw' + - 'ata_qc_for_each_with_internal' + - 'ax25_for_each' + - 'ax25_uid_for_each' + - '__bio_for_each_bvec' + - 'bio_for_each_bvec' + - 'bio_for_each_integrity_vec' + - '__bio_for_each_segment' + - 'bio_for_each_segment' + - 'bio_for_each_segment_all' + - 'bio_list_for_each' + - 'bip_for_each_vec' + - 'bitmap_for_each_clear_region' + - 'bitmap_for_each_set_region' + - 'blkg_for_each_descendant_post' + - 'blkg_for_each_descendant_pre' + - 'blk_queue_for_each_rl' + - 'bond_for_each_slave' + - 'bond_for_each_slave_rcu' + - 'bpf_for_each_spilled_reg' + - 'btree_for_each_safe128' + - 'btree_for_each_safe32' + - 'btree_for_each_safe64' + - 'btree_for_each_safel' + - 'card_for_each_dev' + - 'cgroup_taskset_for_each' + - 'cgroup_taskset_for_each_leader' + - 'cpufreq_for_each_entry' + - 'cpufreq_for_each_entry_idx' + - 'cpufreq_for_each_valid_entry' + - 'cpufreq_for_each_valid_entry_idx' + - 'css_for_each_child' + - 'css_for_each_descendant_post' + - 'css_for_each_descendant_pre' + - 'device_for_each_child_node' + - 'dma_fence_chain_for_each' + - 'drm_atomic_crtc_for_each_plane' + - 'drm_atomic_crtc_state_for_each_plane' + - 'drm_atomic_crtc_state_for_each_plane_state' + - 'drm_atomic_for_each_plane_damage' + - 'drm_client_for_each_connector_iter' + - 'drm_client_for_each_modeset' + - 'drm_connector_for_each_possible_encoder' + - 'drm_for_each_bridge_in_chain' + - 'drm_for_each_connector_iter' + - 'drm_for_each_crtc' + - 'drm_for_each_encoder' + - 'drm_for_each_encoder_mask' + - 'drm_for_each_fb' + - 'drm_for_each_legacy_plane' + - 'drm_for_each_plane' + - 'drm_for_each_plane_mask' + - 'drm_for_each_privobj' + - 'drm_mm_for_each_hole' + - 'drm_mm_for_each_node' + - 'drm_mm_for_each_node_in_range' + - 'drm_mm_for_each_node_safe' + - 'flow_action_for_each' + - 'for_each_active_dev_scope' + - 'for_each_active_drhd_unit' + - 'for_each_active_iommu' + - 'for_each_available_child_of_node' + - 'for_each_bio' + - 'for_each_board_func_rsrc' + - 'for_each_bvec' + - 'for_each_card_auxs' + - 'for_each_card_auxs_safe' + - 'for_each_card_components' + - 'for_each_card_dapms' + - 'for_each_card_pre_auxs' + - 'for_each_card_prelinks' + - 'for_each_card_rtds' + - 'for_each_card_rtds_safe' + - 'for_each_card_widgets' + - 'for_each_card_widgets_safe' + - 'for_each_cgroup_storage_type' + - 'for_each_child_of_node' + - 'for_each_clear_bit' + - 'for_each_clear_bit_from' + - 'for_each_cmsghdr' + - 'for_each_compatible_node' + - 'for_each_component_dais' + - 'for_each_component_dais_safe' + - 'for_each_comp_order' + - 'for_each_console' + - 'for_each_cpu' + - 'for_each_cpu_and' + - 'for_each_cpu_not' + - 'for_each_cpu_wrap' + - 'for_each_dapm_widgets' + - 'for_each_dev_addr' + - 'for_each_dev_scope' + - 'for_each_displayid_db' + - 'for_each_dma_cap_mask' + - 'for_each_dpcm_be' + - 'for_each_dpcm_be_rollback' + - 'for_each_dpcm_be_safe' + - 'for_each_dpcm_fe' + - 'for_each_drhd_unit' + - 'for_each_dss_dev' + - 'for_each_efi_memory_desc' + - 'for_each_efi_memory_desc_in_map' + - 'for_each_element' + - 'for_each_element_extid' + - 'for_each_element_id' + - 'for_each_endpoint_of_node' + - 'for_each_evictable_lru' + - 'for_each_fib6_node_rt_rcu' + - 'for_each_fib6_walker_rt' + - 'for_each_free_mem_pfn_range_in_zone' + - 'for_each_free_mem_pfn_range_in_zone_from' + - 'for_each_free_mem_range' + - 'for_each_free_mem_range_reverse' + - 'for_each_func_rsrc' + - 'for_each_hstate' + - 'for_each_if' + - 'for_each_iommu' + - 'for_each_ip_tunnel_rcu' + - 'for_each_irq_nr' + - 'for_each_link_codecs' + - 'for_each_link_cpus' + - 'for_each_link_platforms' + - 'for_each_lru' + - 'for_each_matching_node' + - 'for_each_matching_node_and_match' + - 'for_each_member' + - 'for_each_memblock' + - 'for_each_memblock_type' + - 'for_each_memcg_cache_index' + - 'for_each_mem_pfn_range' + - 'for_each_mem_range' + - 'for_each_mem_range_rev' + - 'for_each_migratetype_order' + - 'for_each_msi_entry' + - 'for_each_msi_entry_safe' + - 'for_each_net' + - 'for_each_net_continue_reverse' + - 'for_each_netdev' + - 'for_each_netdev_continue' + - 'for_each_netdev_continue_rcu' + - 'for_each_netdev_continue_reverse' + - 'for_each_netdev_feature' + - 'for_each_netdev_in_bond_rcu' + - 'for_each_netdev_rcu' + - 'for_each_netdev_reverse' + - 'for_each_netdev_safe' + - 'for_each_net_rcu' + - 'for_each_new_connector_in_state' + - 'for_each_new_crtc_in_state' + - 'for_each_new_mst_mgr_in_state' + - 'for_each_new_plane_in_state' + - 'for_each_new_private_obj_in_state' + - 'for_each_node' + - 'for_each_node_by_name' + - 'for_each_node_by_type' + - 'for_each_node_mask' + - 'for_each_node_state' + - 'for_each_node_with_cpus' + - 'for_each_node_with_property' + - 'for_each_of_allnodes' + - 'for_each_of_allnodes_from' + - 'for_each_of_cpu_node' + - 'for_each_of_pci_range' + - 'for_each_old_connector_in_state' + - 'for_each_old_crtc_in_state' + - 'for_each_old_mst_mgr_in_state' + - 'for_each_oldnew_connector_in_state' + - 'for_each_oldnew_crtc_in_state' + - 'for_each_oldnew_mst_mgr_in_state' + - 'for_each_oldnew_plane_in_state' + - 'for_each_oldnew_plane_in_state_reverse' + - 'for_each_oldnew_private_obj_in_state' + - 'for_each_old_plane_in_state' + - 'for_each_old_private_obj_in_state' + - 'for_each_online_cpu' + - 'for_each_online_node' + - 'for_each_online_pgdat' + - 'for_each_pci_bridge' + - 'for_each_pci_dev' + - 'for_each_pci_msi_entry' + - 'for_each_pcm_streams' + - 'for_each_populated_zone' + - 'for_each_possible_cpu' + - 'for_each_present_cpu' + - 'for_each_prime_number' + - 'for_each_prime_number_from' + - 'for_each_process' + - 'for_each_process_thread' + - 'for_each_property_of_node' + - 'for_each_registered_fb' + - 'for_each_reserved_mem_region' + - 'for_each_rtd_codec_dais' + - 'for_each_rtd_codec_dais_rollback' + - 'for_each_rtd_components' + - 'for_each_rtd_cpu_dais' + - 'for_each_rtd_cpu_dais_rollback' + - 'for_each_rtd_dais' + - 'for_each_set_bit' + - 'for_each_set_bit_from' + - 'for_each_set_clump8' + - 'for_each_sg' + - 'for_each_sg_dma_page' + - 'for_each_sg_page' + - 'for_each_sibling_event' + - 'for_each_subelement' + - 'for_each_subelement_extid' + - 'for_each_subelement_id' + - '__for_each_thread' + - 'for_each_thread' + - 'for_each_wakeup_source' + - 'for_each_zone' + - 'for_each_zone_zonelist' + - 'for_each_zone_zonelist_nodemask' + - 'fwnode_for_each_available_child_node' + - 'fwnode_for_each_child_node' + - 'fwnode_graph_for_each_endpoint' + - 'gadget_for_each_ep' + - 'genradix_for_each' + - 'genradix_for_each_from' + - 'hash_for_each' + - 'hash_for_each_possible' + - 'hash_for_each_possible_rcu' + - 'hash_for_each_possible_rcu_notrace' + - 'hash_for_each_possible_safe' + - 'hash_for_each_rcu' + - 'hash_for_each_safe' + - 'hctx_for_each_ctx' + - 'hlist_bl_for_each_entry' + - 'hlist_bl_for_each_entry_rcu' + - 'hlist_bl_for_each_entry_safe' + - 'hlist_for_each' + - 'hlist_for_each_entry' + - 'hlist_for_each_entry_continue' + - 'hlist_for_each_entry_continue_rcu' + - 'hlist_for_each_entry_continue_rcu_bh' + - 'hlist_for_each_entry_from' + - 'hlist_for_each_entry_from_rcu' + - 'hlist_for_each_entry_rcu' + - 'hlist_for_each_entry_rcu_bh' + - 'hlist_for_each_entry_rcu_notrace' + - 'hlist_for_each_entry_safe' + - '__hlist_for_each_rcu' + - 'hlist_for_each_safe' + - 'hlist_nulls_for_each_entry' + - 'hlist_nulls_for_each_entry_from' + - 'hlist_nulls_for_each_entry_rcu' + - 'hlist_nulls_for_each_entry_safe' + - 'i3c_bus_for_each_i2cdev' + - 'i3c_bus_for_each_i3cdev' + - 'ide_host_for_each_port' + - 'ide_port_for_each_dev' + - 'ide_port_for_each_present_dev' + - 'idr_for_each_entry' + - 'idr_for_each_entry_continue' + - 'idr_for_each_entry_continue_ul' + - 'idr_for_each_entry_ul' + - 'in_dev_for_each_ifa_rcu' + - 'in_dev_for_each_ifa_rtnl' + - 'inet_bind_bucket_for_each' + - 'inet_lhash2_for_each_icsk_rcu' + - 'key_for_each' + - 'key_for_each_safe' + - 'klp_for_each_func' + - 'klp_for_each_func_safe' + - 'klp_for_each_func_static' + - 'klp_for_each_object' + - 'klp_for_each_object_safe' + - 'klp_for_each_object_static' + - 'kunit_suite_for_each_test_case' + - 'kvm_for_each_memslot' + - 'kvm_for_each_vcpu' + - 'list_for_each' + - 'list_for_each_codec' + - 'list_for_each_codec_safe' + - 'list_for_each_continue' + - 'list_for_each_entry' + - 'list_for_each_entry_continue' + - 'list_for_each_entry_continue_rcu' + - 'list_for_each_entry_continue_reverse' + - 'list_for_each_entry_from' + - 'list_for_each_entry_from_rcu' + - 'list_for_each_entry_from_reverse' + - 'list_for_each_entry_lockless' + - 'list_for_each_entry_rcu' + - 'list_for_each_entry_reverse' + - 'list_for_each_entry_safe' + - 'list_for_each_entry_safe_continue' + - 'list_for_each_entry_safe_from' + - 'list_for_each_entry_safe_reverse' + - 'list_for_each_prev' + - 'list_for_each_prev_safe' + - 'list_for_each_safe' + - 'llist_for_each' + - 'llist_for_each_entry' + - 'llist_for_each_entry_safe' + - 'llist_for_each_safe' + - 'mci_for_each_dimm' + - 'media_device_for_each_entity' + - 'media_device_for_each_intf' + - 'media_device_for_each_link' + - 'media_device_for_each_pad' + - 'nanddev_io_for_each_page' + - 'netdev_for_each_lower_dev' + - 'netdev_for_each_lower_private' + - 'netdev_for_each_lower_private_rcu' + - 'netdev_for_each_mc_addr' + - 'netdev_for_each_uc_addr' + - 'netdev_for_each_upper_dev_rcu' + - 'netdev_hw_addr_list_for_each' + - 'nft_rule_for_each_expr' + - 'nla_for_each_attr' + - 'nla_for_each_nested' + - 'nlmsg_for_each_attr' + - 'nlmsg_for_each_msg' + - 'nr_neigh_for_each' + - 'nr_neigh_for_each_safe' + - 'nr_node_for_each' + - 'nr_node_for_each_safe' + - 'of_for_each_phandle' + - 'of_property_for_each_string' + - 'of_property_for_each_u32' + - 'pci_bus_for_each_resource' + - 'pcm_for_each_format' + - 'ping_portaddr_for_each_entry' + - 'plist_for_each' + - 'plist_for_each_continue' + - 'plist_for_each_entry' + - 'plist_for_each_entry_continue' + - 'plist_for_each_entry_safe' + - 'plist_for_each_safe' + - 'pnp_for_each_card' + - 'pnp_for_each_dev' + - 'protocol_for_each_card' + - 'protocol_for_each_dev' + - 'queue_for_each_hw_ctx' + - 'radix_tree_for_each_slot' + - 'radix_tree_for_each_tagged' + - 'rbtree_postorder_for_each_entry_safe' + - 'rdma_for_each_block' + - 'rdma_for_each_port' + - 'resource_list_for_each_entry' + - 'resource_list_for_each_entry_safe' + - 'rhl_for_each_entry_rcu' + - 'rhl_for_each_rcu' + - 'rht_for_each' + - 'rht_for_each_entry' + - 'rht_for_each_entry_from' + - 'rht_for_each_entry_rcu' + - 'rht_for_each_entry_rcu_from' + - 'rht_for_each_entry_safe' + - 'rht_for_each_from' + - 'rht_for_each_rcu' + - 'rht_for_each_rcu_from' + - '__rq_for_each_bio' + - 'rq_for_each_bvec' + - 'rq_for_each_segment' + - 'scsi_for_each_prot_sg' + - 'scsi_for_each_sg' + - 'sctp_for_each_hentry' + - 'sctp_skb_for_each' + - 'shdma_for_each_chan' + - '__shost_for_each_device' + - 'shost_for_each_device' + - 'sk_for_each' + - 'sk_for_each_bound' + - 'sk_for_each_entry_offset_rcu' + - 'sk_for_each_from' + - 'sk_for_each_rcu' + - 'sk_for_each_safe' + - 'sk_nulls_for_each' + - 'sk_nulls_for_each_from' + - 'sk_nulls_for_each_rcu' + - 'snd_array_for_each' + - 'snd_pcm_group_for_each_entry' + - 'snd_soc_dapm_widget_for_each_path' + - 'snd_soc_dapm_widget_for_each_path_safe' + - 'snd_soc_dapm_widget_for_each_sink_path' + - 'snd_soc_dapm_widget_for_each_source_path' + - 'tb_property_for_each' + - 'tcf_exts_for_each_action' + - 'udp_portaddr_for_each_entry' + - 'udp_portaddr_for_each_entry_rcu' + - 'usb_hub_for_each_child' + - 'v4l2_device_for_each_subdev' + - 'v4l2_m2m_for_each_dst_buf' + - 'v4l2_m2m_for_each_dst_buf_safe' + - 'v4l2_m2m_for_each_src_buf' + - 'v4l2_m2m_for_each_src_buf_safe' + - 'virtio_device_for_each_vq' + - 'xa_for_each' + - 'xa_for_each_marked' + - 'xa_for_each_range' + - 'xa_for_each_start' + - 'xas_for_each' + - 'xas_for_each_conflict' + - 'xas_for_each_marked' + - 'xbc_array_for_each_value' + - 'xbc_for_each_key_value' + - 'xbc_node_for_each_array_value' + - 'xbc_node_for_each_child' + - 'xbc_node_for_each_key_value' + - 'zorro_for_each_dev' + +#IncludeBlocks: Preserve # Unknown to clang-format-5.0 +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +#IndentPPDirectives: None # Unknown to clang-format-5.0 +IndentWidth: 8 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 +ObjCBlockIndentWidth: 8 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true + +# Taken from git's rules +#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +#SortUsingDeclarations: false # Unknown to clang-format-4.0 +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0 +#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0 +SpaceBeforeParens: ControlStatements +#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0 +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 8 +UseTab: Always +... diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/control clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/control --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/control 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/control 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,13 @@ +Package: module-name +Version: x.x.x +Section: admin +Priority: optional +Depends: dkms (>= 1.95) +Conflicts: tuxedo-keyboard-dkms (<= 2.0.0), tuxedo-wmi-dkms (<= 1.5.1), tuxedo-xp-xc-touchpad-key-fix, tuxedo-touchpad-fix (<= 1.0.8), tuxedo-xp-xc-airplane-mode-fix (<= 0.6), tuxedo-cc-wmi +Replaces: tuxedo-keyboard-dkms (<= 2.0.0), tuxedo-wmi-dkms (<= 1.5.1), tuxedo-xp-xc-touchpad-key-fix, tuxedo-touchpad-fix (<= 1.0.8), tuxedo-xp-xc-airplane-mode-fix (<= 0.6), tuxedo-cc-wmi +Maintainer: TUXEDO Computers GmbH +Homepage: https://www.tuxedocomputers.com +Architecture: all +Description: Keyboard driver for TUXEDO notebooks. + Keyboard & keyboard backlight driver for TUXEDO notebooks. + Meant for DKMS framework. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/postinst clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/postinst --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/postinst 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/postinst 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,94 @@ +#!/bin/sh +# Copyright (c) 2020 TUXEDO Computers GmbH + +set -e + +module=module-name +version=x.x.x + + +NAME=${module} +PACKAGE_NAME=${NAME} + +# From dkms standard postinst +# Copyright (C) 2002-2005 Flavio Stanchina +# Copyright (C) 2005-2006 Aric Cyr +# Copyright (C) 2007 Mario Limonciello +# Copyright (C) 2009 Alberto Milone +DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,') +CVERSION=`dpkg-query -W -f='${Version}' $DEB_NAME | awk -F "-" '{print $1}' | cut -d\: -f2` +ARCH=`dpkg --print-architecture` + +dkms_configure () { + for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do + if [ -f "$POSTINST" ]; then + "$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2" + return $? + fi + echo "WARNING: $POSTINST does not exist." >&2 + done + echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2 + echo "built with legacy DKMS support." >&2 + echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2 + echo "support or upgrade DKMS to a more current version." >&2 + return 1 +} + +# End dkms standard postinst + +case "$1" in + configure) + # Run standard dkms build/install for all kernels with headers installed + dkms_configure + + # Attempt to (re-)load module immediately, fail silently if not possible at this stage + + # Also stop tccd service if running before + echo "Check tccd running status" + if systemctl is-active --quiet tccd.service; then + TCCD_RUNNING=true + else + TCCD_RUNNING=false + fi + + if $TCCD_RUNNING; then + echo "Stop tccd temporarily" + systemctl stop tccd 2>&1 || true + fi + + echo "(Re)load modules if possible" + rmmod tuxedo_io > /dev/null 2>&1 || true + rmmod uniwill_wmi > /dev/null 2>&1 || true + rmmod clevo_wmi > /dev/null 2>&1 || true + rmmod clevo_acpi > /dev/null 2>&1 || true + rmmod tuxedo_keyboard > /dev/null 2>&1 || true + + modprobe tuxedo_keyboard > /dev/null 2>&1 || true + modprobe uniwill_wmi > /dev/null 2>&1 || true + modprobe clevo_wmi > /dev/null 2>&1 || true + modprobe clevo_acpi > /dev/null 2>&1 || true + modprobe tuxedo_io > /dev/null 2>&1 || true + + # Restart tccd after reload if it was running + if $TCCD_RUNNING; then + echo "Start tccd again" + systemctl start tccd 2>&1 || true + fi + + # Install default config if none exist already + if [ ! -f "/etc/modprobe.d/tuxedo_keyboard.conf" ]; then + cp -f /usr/share/tuxedo-keyboard/tuxedo_keyboard.conf /etc/modprobe.d/tuxedo_keyboard.conf + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/prerm clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/prerm --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/prerm 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/DEBIAN/prerm 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,41 @@ +#!/bin/sh + +module=module-name +version=x.x.x + +set -e + +case "$1" in + remove) + if [ "`dkms status -m $module`" ] + then + dkms remove -m $module -v $version --all + # Attempt to remove module, fail silently if module is already unloaded + rmmod -s $module > /dev/null 2>&1 || true + fi + rm -f /etc/modprobe.d/tuxedo_keyboard.conf || true + ;; + + upgrade|deconfigure) + if [ "`dkms status -m $module`" ] + then + dkms remove -m $module -v $version --all + # Attempt to remove module, fail silently if module is already unloaded + rmmod -s $module > /dev/null 2>&1 || true + fi + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + + +exit 0 + + Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/changelog.gz and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/changelog.gz differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/copyright clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/copyright --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/copyright 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/deb/module-name/usr/share/doc/module-name/copyright 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,24 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: tuxedo-keyboard +Upstream-Contact: TUXEDO Computers GmbH + +Files: * +Copyright: 2020 TUXEDO Computers GmbH +License: GPL-3+ + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in '/usr/share/common-licenses/GPL-3'. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/dkms.conf clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/dkms.conf --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/dkms.conf 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/dkms.conf 2023-10-07 06:03:48.000000000 +0000 @@ -0,0 +1,18 @@ +PACKAGE_NAME=clevo-keyboard +PACKAGE_VERSION=3.2.11 + +DEST_MODULE_LOCATION[0]="/kernel/lib/" +BUILT_MODULE_NAME[0]="clevo_keyboard" +BUILT_MODULE_LOCATION[0]="src/" + +DEST_MODULE_LOCATION[1]="/kernel/lib/" +BUILT_MODULE_NAME[1]="clevo_wmi" +BUILT_MODULE_LOCATION[1]="src/" + +DEST_MODULE_LOCATION[2]="/kernel/lib/" +BUILT_MODULE_NAME[2]="clevo_acpi" +BUILT_MODULE_LOCATION[2]="src/" + +MAKE[0]="make KDIR=/lib/modules/${kernelver}/build" +CLEAN="make clean" +AUTOINSTALL="yes" diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/config clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/config --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/config 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/config 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,11 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = https://github.com/tuxedocomputers/tuxedo-keyboard + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/description clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/description --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/description 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/description 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/HEAD 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/heads/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/applypatch-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/applypatch-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/applypatch-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/applypatch-msg.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/commit-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/commit-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/commit-msg.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/fsmonitor-watchman.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/fsmonitor-watchman.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/fsmonitor-watchman.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/fsmonitor-watchman.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,173 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 2) and last update token +# formatted as a string and outputs to stdout a new update token and +# all files that have been modified since the update token. Paths must +# be relative to the root of the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $last_update_token) = @ARGV; + +# Uncomment for debugging +# print STDERR "$0 $version $last_update_token\n"; + +# Check the hook interface version +if ($version ne 2) { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree = get_working_dir(); + +my $retry = 1; + +my $json_pkg; +eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; +} or do { + require JSON::PP; + $json_pkg = "JSON::PP"; +}; + +launch_watchman(); + +sub launch_watchman { + my $o = watchman_query(); + if (is_work_tree_watched($o)) { + output_result($o->{clock}, @{$o->{files}}); + } +} + +sub output_result { + my ($clockid, @files) = @_; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # binmode $fh, ":utf8"; + # print $fh "$clockid\n@files\n"; + # close $fh; + + binmode STDOUT, ":utf8"; + print $clockid; + print "\0"; + local $, = "\0"; + print @files; +} + +sub watchman_clock { + my $response = qx/watchman clock "$git_work_tree"/; + die "Failed to get clock id on '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + return $json_pkg->new->utf8->decode($response); +} + +sub watchman_query { + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $last_update_token but not from the .git folder. + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + if (substr($last_update_token, 0, 1) eq "c") { + $last_update_token = "\"$last_update_token\""; + } + my $query = <<" END"; + ["query", "$git_work_tree", { + "since": $last_update_token, + "fields": ["name"], + "expression": ["not", ["dirname", ".git"]] + }] + END + + # Uncomment for debugging the watchman query + # open (my $fh, ">", ".git/watchman-query.json"); + # print $fh $query; + # close $fh; + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + # Uncomment for debugging the watch response + # open ($fh, ">", ".git/watchman-response.json"); + # print $fh $response; + # close $fh; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + return $json_pkg->new->utf8->decode($response); +} + +sub is_work_tree_watched { + my ($output) = @_; + my $error = $output->{error}; + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { + $retry--; + my $response = qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + $output = $json_pkg->new->utf8->decode($response); + $error = $output->{error}; + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # close $fh; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + my $o = watchman_clock(); + $error = $output->{error}; + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + output_result($o->{clock}, ("/")); + $last_update_token = $o->{clock}; + + eval { launch_watchman() }; + return 0; + } + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + return 1; +} + +sub get_working_dir { + my $working_dir; + if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $working_dir = Win32::GetCwd(); + $working_dir =~ tr/\\/\//; + } else { + require Cwd; + $working_dir = Cwd::cwd(); + } + + return $working_dir; +} diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/post-update.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/post-update.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/post-update.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/post-update.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-applypatch.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-applypatch.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-applypatch.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-applypatch.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-commit.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-commit.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-commit.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-commit.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-merge-commit.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-merge-commit.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-merge-commit.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-merge-commit.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,13 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/prepare-commit-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/prepare-commit-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/prepare-commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/prepare-commit-msg.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-push.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-push.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-push.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-push.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-rebase.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-rebase.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-rebase.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-rebase.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-receive.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-receive.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/pre-receive.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/pre-receive.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/push-to-checkout.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/push-to-checkout.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/hooks/push-to-checkout.sample 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/hooks/push-to-checkout.sample 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,78 @@ +#!/bin/sh + +# An example hook script to update a checked-out tree on a git push. +# +# This hook is invoked by git-receive-pack(1) when it reacts to git +# push and updates reference(s) in its repository, and when the push +# tries to update the branch that is currently checked out and the +# receive.denyCurrentBranch configuration variable is set to +# updateInstead. +# +# By default, such a push is refused if the working tree and the index +# of the remote repository has any difference from the currently +# checked out commit; when both the working tree and the index match +# the current commit, they are updated to match the newly pushed tip +# of the branch. This hook is to be used to override the default +# behaviour; however the code below reimplements the default behaviour +# as a starting point for convenient modification. +# +# The hook receives the commit with which the tip of the current +# branch is going to be updated: +commit=$1 + +# It can exit with a non-zero status to refuse the push (when it does +# so, it must not modify the index or the working tree). +die () { + echo >&2 "$*" + exit 1 +} + +# Or it can make any necessary changes to the working tree and to the +# index to bring them to the desired state when the tip of the current +# branch is updated to the new commit, and exit with a zero status. +# +# For example, the hook can simply run git read-tree -u -m HEAD "$1" +# in order to emulate git fetch that is run in the reverse direction +# with git push, as the two-tree form of git read-tree -u -m is +# essentially the same as git switch or git checkout that switches +# branches while keeping the local changes in the working tree that do +# not interfere with the difference between the branches. + +# The below is a more-or-less exact translation to shell of the C code +# for the default behaviour for git's push-to-checkout hook defined in +# the push_to_deploy() function in builtin/receive-pack.c. +# +# Note that the hook will be executed from the repository directory, +# not from the working tree, so if you want to perform operations on +# the working tree, you will have to adapt your code accordingly, e.g. +# by adding "cd .." or using relative paths. + +if ! git update-index -q --ignore-submodules --refresh +then + die "Up-to-date check failed" +fi + +if ! git diff-files --quiet --ignore-submodules -- +then + die "Working directory has unstaged changes" +fi + +# This is a rough translation of: +# +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX +if git cat-file -e HEAD 2>/dev/null +then + head=HEAD +else + head=$(git hash-object -t tree --stdin &2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --type=bool hooks.allowunannotated) +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) +denycreatebranch=$(git config --type=bool hooks.denycreatebranch) +allowdeletetag=$(git config --type=bool hooks.allowdeletetag) +allowmodifytag=$(git config --type=bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin &2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/index and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/index differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/info/exclude clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/info/exclude --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/info/exclude 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/info/exclude 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/HEAD 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d Juno Computers 1696656912 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/refs/heads/master clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/refs/heads/master --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/refs/heads/master 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d Juno Computers 1696656912 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/refs/remotes/origin/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/refs/remotes/origin/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/logs/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/logs/refs/remotes/origin/HEAD 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d Juno Computers 1696656912 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/objects/pack/pack-ed24f200bdf17d3b717f7b6cf7dcdb52ac0cd68e.idx and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/objects/pack/pack-ed24f200bdf17d3b717f7b6cf7dcdb52ac0cd68e.idx differ Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/objects/pack/pack-ed24f200bdf17d3b717f7b6cf7dcdb52ac0cd68e.pack and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/objects/pack/pack-ed24f200bdf17d3b717f7b6cf7dcdb52ac0cd68e.pack differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/packed-refs clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/packed-refs --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/packed-refs 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/packed-refs 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,71 @@ +# pack-refs with: peeled fully-peeled sorted +25ca08a9956865d67ef296f8a4f6b42f9ca97404 refs/remotes/origin/led_code_diagnostics +9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d refs/remotes/origin/master +11ecb1dda8da72bd84acfe828d05ebe404ab6ed8 refs/remotes/origin/release +94f5d5239852041cf6cbd507e15746148fad8434 refs/remotes/origin/relicensing-gplv2 +7f6018afa8c8973654657ad56abfe18900788dc3 refs/tags/v2.0.2 +^8c3387e840fdbcfba296e8842aa4e8bced10c8d1 +2c7a194ef5946c4ed1f02a2ddefbad592fc25928 refs/tags/v2.0.3 +^fd21208d669e23851e73ed91c5b4f4276c286c23 +729abfcc05bc34a2bd5c58d0c68f2e4e19d9e903 refs/tags/v2.0.4 +^609c5f19dbe1d8f42fc37022f41a86d7e5f789ec +3cdc7ba449c0309fe47fa270b69b6ef1b5e1dca8 refs/tags/v2.0.5 +^84442d0b2f3d3bff691ce8b96bb3baced4d692c0 +21a33a222520d8f6cf9fbd12917e751c4a9473d1 refs/tags/v2.0.6 +^fbd1cd8e8a4059d4d1d9c643ab495c9854c50002 +b60a7e87c9b90039ffbcd169991f3de6cbdf227a refs/tags/v2.1.0 +^878a528223f24b82f205156fc9f1c7aca13c87f9 +3a3f90022094f7e94c08e2822b5ee19f6e54289d refs/tags/v3.0.0 +^c25363c133b9528192d1c9ae74dd40ce2dae17be +4033303f22e5fbf72550d3cb14771262e1f1f52b refs/tags/v3.0.1 +^4f763e9e74ea4bcd8a5f6973844c6ec11a012174 +37d48651aad09c1965391f9581ec16242598fb62 refs/tags/v3.0.10 +^48666348c69e8dcf520e413cf61f1a33d16df9c0 +c52dddaeed29a08bc6acfddf4f7c3cd83e8086e1 refs/tags/v3.0.11 +^824933fc7029dc784362763d4e20bcc6167ea129 +0c03ca0ee49f8aa9e3a10ea6b5da4adcceb40bdd refs/tags/v3.0.2 +^4296f75372213c37a022f6ccff4340ea7063a223 +e0c7ea060c3a7f78374419a7a502ec87319de7e5 refs/tags/v3.0.3 +^852c28cec45d3970e5b844cbd780e67ec914428e +cf3f6453e2432bb8b4f5be7e2864a808cd2b50af refs/tags/v3.0.4 +^fd683d410b2c778c63d61a448e5a406e341f277c +8d4b34d501e7dce4137d65169dad1f1630331beb refs/tags/v3.0.5 +^8a965edb336210e86d3748706152d16b3760d563 +367193e7d3926d0efb9dbb93870e9836c539a589 refs/tags/v3.0.6 +^d7f358a7786074a9321e3ff953037fdc8f02c494 +e85b336763930aac084175c0de22300f35db4e9a refs/tags/v3.0.7 +^aae9f01feba6a1c13c2d8c23e42fd75da463a3e1 +d0d0e5adb8679e5ae40ecb9c7d3aba340c8f5c88 refs/tags/v3.0.8 +^914e50b1608aa795f7322822c0151708e9942515 +057e497009d020ab945e0260c63480674029a020 refs/tags/v3.0.9 +^e1c8e5bf3b457a3ed2c9903c374d3713e6998f94 +0eaf1ad802e4cf9f142d90d7adbfa0e8306b6300 refs/tags/v3.1.0 +^e8dc238ae139a259134088a64f6789fef446976e +3a0b98384e72404e7c9b174f64bb9f47e99827af refs/tags/v3.1.1 +^b46ca9ef44568c6c384929a73624bd9ba9158577 +17c1294c415e4ebff068a26bd9be01cd3de9f547 refs/tags/v3.1.2 +^88363ec0309fe4b490d1f9576c45bd5b4d12c552 +0cdd0b6d0316bf72e870ac8fead41f7b049c8d6b refs/tags/v3.1.3 +^cd907695b548d91d73ab9c34886f07aceb02ed57 +385b8ea2cf5826d8795ec29f2a24d2f38d138667 refs/tags/v3.1.4 +^c3e03cbd7c314e3462de364b569788be2da86f70 +8e2c4280dd963577c8bc9a0dd1283e397cde340b refs/tags/v3.2.0 +^4749901db2dcc3430bf6497086bb9fefbac7eeff +3207ca33301e7667afbbb86e1141441c594109d7 refs/tags/v3.2.1 +^131af916be7298ef3516c453fd17189c78c40554 +d357613597cec90f2290a4ef78f15bcd8aa0cc59 refs/tags/v3.2.10 +^e236eec63aa04c60cc930f2f58f41b223dfee5e2 +6c1cd8e31fc70d74d7ccea996c2d4b27cf0cc1a3 refs/tags/v3.2.11 +^9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d +e40d67e13446bff5f12af87686bef74b73920238 refs/tags/v3.2.3 +^c202a4d671d9fe920a023d280a66a9f116e14759 +316bfb45395f638857ecca6d5c83b43128430d1a refs/tags/v3.2.5 +^08502a69045bd3152efef6af151597ea008ae779 +316ea1fe1c9e05d43deae7137f26e0c8da308169 refs/tags/v3.2.6 +^c51c01e3f2767a75e8b740264b4449c3e5a99638 +f48d83d87e1fb5b742521c4241f5bee9ebbf3b47 refs/tags/v3.2.7 +^31a25e2e3787fd817f31f288da0266d9398cbbb0 +3ecf77b2fd7ae928c71d6ba1bea7de19f97da087 refs/tags/v3.2.8 +^2b04cbc60a7b38031cdad8c98abc732ee64883b4 +1feaed6999bc003ea6fedd112707e8e01ef38a97 refs/tags/v3.2.9 +^f6f547870cdebb3e07ba8926d80ab49aed7964c7 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/refs/heads/master clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/refs/heads/master --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/refs/heads/master 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +9a7e9d0fbe36360df2fa9dd9a0ac6702377dc01d diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/refs/remotes/origin/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/refs/remotes/origin/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.git/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.git/refs/remotes/origin/HEAD 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/remotes/origin/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.gitignore clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.gitignore --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.gitignore 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,27 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old + +*.mk + +.vscode/ +*.kdev4 + +# Packaging +rpm +deb/tuxedo-keyboard-* +*.deb +*.rpm diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.gitlab-ci.yml clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.gitlab-ci.yml --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/.gitlab-ci.yml 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,28 @@ +image: debian:latest + +variables: + DEBIAN_FRONTEND: noninteractive + PACKAGES_FOLDER_NAME: $CI_PROJECT_DIR/packages + +before_script: + - apt-get update -qq + - apt-get install -qq -y dpkg dpkg-dev make rpm tar > /dev/null 2>&1 + +stages: + - build_packages + +packaging: + stage: build_packages + only: + refs: + - release + script: + - make package + - mkdir $PACKAGES_FOLDER_NAME + - mv *.deb $PACKAGES_FOLDER_NAME/ + - mv *.rpm $PACKAGES_FOLDER_NAME/ + artifacts: + name: tuxedo-keyboard-${CI_COMMIT_REF_SLUG} + when: on_success + paths: + - $PACKAGES_FOLDER_NAME/* diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/LICENSE clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/LICENSE --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/LICENSE 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/Makefile clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/Makefile --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/Makefile 2023-10-07 06:04:12.000000000 +0000 @@ -0,0 +1,133 @@ +# +# Copyright (c) 2018-2020 TUXEDO Computers GmbH +# +# This file is part of tuxedo-keyboard. +# +# tuxedo-keyboard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see . +# +obj-m := ./src/clevo_keyboard.o \ + ./src/clevo_wmi.o \ + ./src/clevo_acpi.o + +PWD := $(shell pwd) +KDIR := /lib/modules/$(shell uname -r)/build + +all: + make -C $(KDIR) M=$(PWD) modules + +clean: + make -C $(KDIR) M=$(PWD) clean + +install: + make -C $(KDIR) M=$(PWD) modules_install + +# Package version and name from dkms.conf +VER := $(shell sed -n 's/^PACKAGE_VERSION=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null) +MODULE_NAME := $(shell sed -n 's/^PACKAGE_NAME=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null) + +dkmsinstall: + cp -R . /usr/src/$(MODULE_NAME)-$(VER) + dkms install -m $(MODULE_NAME) -v $(VER) + +dkmsremove: + dkms remove -m $(MODULE_NAME) -v $(VER) --all + rm -rf /usr/src/$(MODULE_NAME)-$(VER) + +# -------------- +# Packaging only +# --------------- + +DEB_PACKAGE_NAME := $(MODULE_NAME)-$(VER) + +# Deb package folder variables +DEB_PACKAGE_BASE := deb/$(DEB_PACKAGE_NAME) +DEB_PACKAGE_SRC := $(DEB_PACKAGE_BASE)/usr/src/$(DEB_PACKAGE_NAME) +DEB_PACKAGE_CTRL := $(DEB_PACKAGE_BASE)/DEBIAN + +package: package-deb package-rpm +package-clean: package-deb-clean package-rpm-clean + +package-deb: + # Create/complete folder structure according to current version + rm -rf $(DEB_PACKAGE_BASE) || true + cp -rf deb/module-name $(DEB_PACKAGE_BASE) + mv $(DEB_PACKAGE_BASE)/usr/share/doc/module-name $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME) + mkdir -p $(DEB_PACKAGE_BASE)/usr/src || true + mkdir -p $(DEB_PACKAGE_SRC) || true + mkdir -p $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME) || true + + # Replace name/version numbers in control/script files + sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(DEB_PACKAGE_CTRL)/control + sed -i 's/^Package:[^\n]*/Package: $(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/control + sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/postinst + sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/postinst + sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/prerm + sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/prerm + # Copy source + cp -rf dkms.conf $(DEB_PACKAGE_SRC) + cp -rf Makefile $(DEB_PACKAGE_SRC) + cp -rf src $(DEB_PACKAGE_SRC) + cp -rf src_pkg/dkms_postinst $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst + cp -rf tuxedo_keyboard.conf $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf + # Make sure files and folders have acceptable permissions + chmod -R 755 $(DEB_PACKAGE_CTRL) + chmod 644 $(DEB_PACKAGE_CTRL)/control + find deb/$(DEB_PACKAGE_NAME)/usr -type d -exec chmod 755 {} \; + find deb/$(DEB_PACKAGE_NAME)/usr -type f -exec chmod 644 {} \; + chmod 755 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst + chmod 644 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf + + gunzip $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog.gz + gzip -n9 $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog + + # Make deb package + dpkg-deb --root-owner-group -b $(DEB_PACKAGE_BASE) $(DEB_PACKAGE_NAME).deb + +package-deb-clean: + rm -rf deb/$(MODULE_NAME)-* > /dev/null 2>&1 || true + rm *.deb > /dev/null 2>&1 || true + +RPM_PACKAGE_NAME := $(MODULE_NAME)-$(VER) +RPM_PACKAGE_SRC := rpm/SOURCES/$(RPM_PACKAGE_NAME) +RPM_SPEC := rpm/SPECS/$(MODULE_NAME).spec +RELEASE := 1 + +package-rpm: + # Create folder source structure according to current version + rm -rf rpm || true + mkdir -p $(RPM_PACKAGE_SRC) + mkdir -p rpm/SPECS + # Copy spec template + cp -rf src_pkg/rpm_pkg.spec $(RPM_SPEC) + # Modify spec file with version etc. + sed -i 's/^%define module[^\n]*/%define module $(MODULE_NAME)/g' $(RPM_SPEC) + sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(RPM_SPEC) + sed -i 's/^Release:[^\n]*/Release: $(RELEASE)/g' $(RPM_SPEC) + # Copy source + cp -rf dkms.conf $(RPM_PACKAGE_SRC) + cp -rf Makefile $(RPM_PACKAGE_SRC) + cp -rf src $(RPM_PACKAGE_SRC) + cp -rf LICENSE $(RPM_PACKAGE_SRC) + cp -rf src_pkg/dkms_postinst $(RPM_PACKAGE_SRC)/postinst + cp -rf tuxedo_keyboard.conf $(RPM_PACKAGE_SRC) + # Compress/package source + cd rpm/SOURCES && tar cjvf $(RPM_PACKAGE_NAME).tar.bz2 $(RPM_PACKAGE_NAME) + # Make rpm package + rpmbuild --debug -bb --define "_topdir `pwd`/rpm" $(RPM_SPEC) + # Copy built package + cp rpm/RPMS/noarch/*.rpm . + +package-rpm-clean: + rm -rf rpm > /dev/null 2>&1 || true + rm *.rpm > /dev/null 2>&1 || true diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/README.md clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/README.md --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/README.md 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/README.md 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,103 @@ +# Table of Content +- Description +- Building and Install +- Using + +# Description +TUXEDO Computers kernel module drivers for keyboard, keyboard backlight & general hardware I/O using the SysFS interface (since version 3.2.0) + +Features +- Driver for Fn-keys +- SysFS control of brightness/color/mode for most TUXEDO keyboards + - [https://docs.kernel.org/leds/leds-class.html](https://docs.kernel.org/leds/leds-class.html) + - [https://docs.kernel.org/leds/leds-class-multicolor.html](https://docs.kernel.org/leds/leds-class-multicolor.html) +- Hardware I/O driver for TUXEDO Control Center + +Modules included in this package +- tuxedo-keyboard +- tuxedo-io +- clevo-wmi +- clevo-acpi +- uniwill-wmi + +# Building and Install + +## Dependencies: +- make +- gcc or clang +- linux-headers +- dkms (Only when using this module with DKMS functionality) + +## Warning when installing the module: + +Use either method only. Do not combine installation methods, such as starting with the build step below and proceeding to use the same build artifacts with the DKMS module. Otherwise the module built via dkms will fail to load with an `exec_format` error on newer kernels due to a mismatched version magic. + +This is why the DKMS build step begins with a `make clean` step. + +For convenience, on platforms where DKMS is in use, skip to the DKMS section directly. + +## Clone the Git Repo: + +```sh +git clone https://github.com/tuxedocomputers/tuxedo-keyboard.git + +cd tuxedo-keyboard + +git checkout release +``` + +## Build the Module: + +```sh +make clean && make +``` + +## The DKMS route: + +### Add as DKMS Module: + +Install the Module: +```sh +make clean + +sudo make dkmsinstall +``` + +Load the Module with modprobe: +```sh +modprobe tuxedo_keyboard +``` +or +```sh +sudo modprobe tuxedo_keyboard +``` + +You might also want to activate `tuxedo_io` module the same way if you are using [TCC](https://github.com/tuxedocomputers/tuxedo-control-center). + +### Uninstalling the DKMS module: + +Remove the DKMS module and source: +```sh +sudo make dkmsremove + +sudo rm /etc/modprobe.d/tuxedo_keyboard.conf +``` + +# Using + +## modprobe + +```sh +modprobe tuxedo_keyboard +``` + +## Load the Module on boot: + +If a module is relevant it will be loaded automatically on boot. If it is not loaded after a reboot, it most likely means that it is not needed. + +Add Module to /etc/modules +```sh +sudo su + +echo tuxedo_keyboard >> /etc/modules +``` diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_acpi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_acpi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_acpi.c 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_acpi.c 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,209 @@ +/*! + * Copyright (c) 2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include "clevo_interfaces.h" + +#define DRIVER_NAME "clevo_acpi" + +struct clevo_acpi_driver_data_t { + struct acpi_device *adev; + struct clevo_interface_t *clevo_interface; +}; + +static struct clevo_acpi_driver_data_t *active_driver_data = NULL; + +static int clevo_acpi_evaluate(struct acpi_device *device, u8 cmd, u32 arg, union acpi_object **result) +{ + int status; + acpi_handle handle; + u64 dsm_rev_dummy = 0x00; // Dummy 0 value since not used + u64 dsm_func = cmd; + // Integer package data for argument + union acpi_object dsm_argv4_package_data[] = { + { + .integer.type = ACPI_TYPE_INTEGER, + .integer.value = arg + } + }; + + // Package argument + union acpi_object dsm_argv4 = { + .package.type = ACPI_TYPE_PACKAGE, + .package.count = 1, + .package.elements = dsm_argv4_package_data + }; + + union acpi_object *out_obj; + + guid_t clevo_acpi_dsm_uuid; + + status = guid_parse(CLEVO_ACPI_DSM_UUID, &clevo_acpi_dsm_uuid); + if (status < 0) + return -ENOENT; + + handle = acpi_device_handle(device); + if (handle == NULL) + return -ENODEV; + + out_obj = acpi_evaluate_dsm(handle, &clevo_acpi_dsm_uuid, dsm_rev_dummy, dsm_func, &dsm_argv4); + if (!out_obj) { + pr_err("failed to evaluate _DSM\n"); + status = -1; + } + else { + if (!IS_ERR_OR_NULL(result)) { + *result = out_obj; + } + } + + return status; +} + +int clevo_acpi_interface_method_call(u8 cmd, u32 arg, union acpi_object **result_value) +{ + int status = 0; + + if (!IS_ERR_OR_NULL(active_driver_data)) { + status = clevo_acpi_evaluate(active_driver_data->adev, cmd, arg, result_value); + } else { + pr_err("acpi method call exec, no driver data found\n"); + pr_err("..for method_call: %0#4x arg: %0#10x\n", cmd, arg); + status = -ENODATA; + } + // pr_debug("clevo_acpi method_call: %0#4x arg: %0#10x result: %0#10x\n", cmd, arg, !IS_ERR_OR_NULL(result_value) ? *result_value : 0); + + return status; +} + +struct clevo_interface_t clevo_acpi_interface = { + .string_id = CLEVO_INTERFACE_ACPI_STRID, + .method_call = clevo_acpi_interface_method_call, +}; + +static int clevo_acpi_add(struct acpi_device *device) +{ + struct clevo_acpi_driver_data_t *driver_data; + + driver_data = devm_kzalloc(&device->dev, sizeof(*driver_data), GFP_KERNEL); + if (!driver_data) + return -ENOMEM; + + driver_data->adev = device; + driver_data->clevo_interface = &clevo_acpi_interface; + + active_driver_data = driver_data; + + pr_debug("clevo_acpi driver add\n"); + + // Add this interface + clevo_keyboard_add_interface(&clevo_acpi_interface); + + pr_info("interface initialized\n"); + + return 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) +static int clevo_acpi_remove(struct acpi_device *device) +#else +static void clevo_acpi_remove(struct acpi_device *device) +#endif +{ + pr_debug("clevo_acpi driver remove\n"); + clevo_keyboard_remove_interface(&clevo_acpi_interface); + active_driver_data = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) + return 0; +#endif +} + +void clevo_acpi_notify(struct acpi_device *device, u32 event) +{ + u32 event_value; + union acpi_object *out_obj; + int status; + // struct clevo_acpi_driver_data_t *clevo_acpi_driver_data; + + status = clevo_acpi_evaluate(device, 0x01, 0, &out_obj); + if (!status) { + if (out_obj->type == ACPI_TYPE_INTEGER) { + event_value = (u32)out_obj->integer.value; + } else { + pr_err("return type not integer, use clevo_evaluate_method2\n"); + } + ACPI_FREE(out_obj); + } + pr_debug("clevo_acpi event: %0#6x, clevo event value: %0#6x\n", event, event_value); + + // clevo_acpi_driver_data = container_of(&device, struct clevo_acpi_driver_data_t, adev); + if (!IS_ERR_OR_NULL(clevo_acpi_interface.event_callb)) { + // Execute registered callback + clevo_acpi_interface.event_callb(event); + } +} + +#ifdef CONFIG_PM +static int driver_suspend_callb(struct device *dev) +{ + pr_debug("driver suspend\n"); + return 0; +} + +static int driver_resume_callb(struct device *dev) +{ + pr_debug("driver resume\n"); + return 0; +} + +static SIMPLE_DEV_PM_OPS(clevo_driver_pm_ops, driver_suspend_callb, driver_resume_callb); +#endif + +static const struct acpi_device_id clevo_acpi_device_ids[] = { + {CLEVO_ACPI_RESOURCE_HID, 0}, + {"", 0} +}; + +static struct acpi_driver clevo_acpi_driver = { + .name = DRIVER_NAME, + .class = DRIVER_NAME, + .owner = THIS_MODULE, + .ids = clevo_acpi_device_ids, + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, + .ops = { + .add = clevo_acpi_add, + .remove = clevo_acpi_remove, + .notify = clevo_acpi_notify, + }, +#ifdef CONFIG_PM + .drv.pm = &clevo_driver_pm_ops +#endif +}; + +module_acpi_driver(clevo_acpi_driver); + +MODULE_AUTHOR("TUXEDO Computers GmbH "); +MODULE_DESCRIPTION("Driver for Clevo ACPI interface"); +MODULE_VERSION("0.1.1"); +MODULE_LICENSE("GPL"); + +MODULE_DEVICE_TABLE(acpi, clevo_acpi_device_ids); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_interfaces.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_interfaces.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_interfaces.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_interfaces.h 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,100 @@ +/*! + * Copyright (c) 2020-2021 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#ifndef CLEVO_INTERFACES_H +#define CLEVO_INTERFACES_H + +#include +#include + +#define CLEVO_WMI_EVENT_GUID "ABBC0F6B-8EA1-11D1-00A0-C90629100000" +#define CLEVO_WMI_EMAIL_GUID "ABBC0F6C-8EA1-11D1-00A0-C90629100000" +#define CLEVO_WMI_METHOD_GUID "ABBC0F6D-8EA1-11D1-00A0-C90629100000" + +#define CLEVO_ACPI_RESOURCE_HID "CLV0001" +#define CLEVO_ACPI_DSM_UUID "93f224e4-fbdc-4bbf-add6-db71bdc0afad" + +// The clevo get commands expect no parameters +#define CLEVO_CMD_GET_FANINFO1 0x63 +#define CLEVO_CMD_GET_FANINFO2 0x64 +#define CLEVO_CMD_GET_FANINFO3 0x6e + +#define CLEVO_CMD_GET_WEBCAM_SW 0x06 +#define CLEVO_CMD_GET_FLIGHTMODE_SW 0x07 +#define CLEVO_CMD_GET_TOUCHPAD_SW 0x09 + +#define CLEVO_CMD_GET_EVENT 0x01 + +#define CLEVO_CMD_GET_SPECS 0x0D // Returns buffer -> only works with clevo_evaluate_method2 +#define CLEVO_CMD_GET_BIOS_FEATURES_1 0x52 +#define CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_WHITE_ONLY_KB 0x40000000 +#define CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_3_ZONE_RGB_KB 0x00400000 + +#define CLEVO_CMD_GET_BIOS_FEATURES_2 0x7A +#define CLEVO_CMD_GET_BIOS_FEATURES_2_SUB_WHITE_ONLY_KB_MAX_5 0x4000 + +#define CLEVO_CMD_GET_KB_WHITE_LEDS 0x3D // Get brightness of white only keyboard backlights + +// The clevo set commands expect a parameter +#define CLEVO_CMD_SET_FANSPEED_VALUE 0x68 +#define CLEVO_CMD_SET_FANSPEED_AUTO 0x69 + +#define CLEVO_CMD_SET_WEBCAM_SW 0x22 +#define CLEVO_CMD_SET_FLIGHTMODE_SW 0x20 +#define CLEVO_CMD_SET_TOUCHPAD_SW 0x2a + +#define CLEVO_CMD_SET_EVENTS_ENABLED 0x46 + +#define CLEVO_CMD_SET_KB_WHITE_LEDS 0x27 // Set brightness of white only keyboard backlights +#define CLEVO_CMD_SET_KB_RGB_LEDS 0x67 // Used to set color, brightness, blinking pattern, etc. +#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 0xF0000000 // 1-zone RGB and 3-zone RGB left +#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 0xF1000000 // 3-zone RGB center +#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 0xF2000000 // 3-Zone RGB right +#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_3 0xF3000000 // Unused on all known Clevo devices +#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_BRIGHTNESS 0xF4000000 + +#define CLEVO_CMD_OPT 0x79 +#define CLEVO_CMD_OPT_SUB_SET_PERF_PROF 0x19 + +struct clevo_interface_t { + char *string_id; + void (*event_callb)(u32); + int (*method_call)(u8, u32, union acpi_object **); +}; + +int clevo_keyboard_add_interface(struct clevo_interface_t *new_interface); +int clevo_keyboard_remove_interface(struct clevo_interface_t *interface); +int clevo_evaluate_method(u8 cmd, u32 arg, u32 *result); +int clevo_evaluate_method2(u8 cmd, u32 arg, union acpi_object **result); +int clevo_get_active_interface_id(char **id_str); + +#define MODULE_ALIAS_CLEVO_WMI() \ + MODULE_ALIAS("wmi:" CLEVO_WMI_EVENT_GUID); \ + MODULE_ALIAS("wmi:" CLEVO_WMI_METHOD_GUID); + +#define CLEVO_INTERFACE_WMI_STRID "clevo_wmi" +#define CLEVO_INTERFACE_ACPI_STRID "clevo_acpi" + +#define MODULE_ALIAS_CLEVO_ACPI() \ + MODULE_ALIAS("acpi*:" CLEVO_ACPI_RESOURCE_HID ":*"); + +#define MODULE_ALIAS_CLEVO_INTERFACES() \ + MODULE_ALIAS_CLEVO_WMI(); \ + MODULE_ALIAS_CLEVO_ACPI(); + +#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard.c 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard.c 2023-10-07 05:57:21.000000000 +0000 @@ -0,0 +1,310 @@ +/*! + * Copyright (c) 2018-2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#define pr_fmt(fmt) "clevo_keyboard" ": " fmt + +#include "clevo_keyboard_common.h" +#include "clevo_keyboard.h" +#include "uniwill_keyboard.h" +#include +#include +#include +#include + +MODULE_AUTHOR("TUXEDO Computers GmbH "); +MODULE_DESCRIPTION("TUXEDO Computers keyboard & keyboard backlight Driver"); +MODULE_LICENSE("GPL"); +MODULE_VERSION("3.2.11"); + +static DEFINE_MUTEX(tuxedo_keyboard_init_driver_lock); + +// static struct tuxedo_keyboard_driver *driver_list[] = { }; + +static int tuxedo_input_init(const struct key_entry key_map[]) +{ + int err; + + tuxedo_input_device = input_allocate_device(); + if (unlikely(!tuxedo_input_device)) { + TUXEDO_ERROR("Error allocating input device\n"); + return -ENOMEM; + } + + tuxedo_input_device->name = "CLEVO Keyboard"; + tuxedo_input_device->phys = DRIVER_NAME "/input0"; + tuxedo_input_device->id.bustype = BUS_HOST; + tuxedo_input_device->dev.parent = &tuxedo_platform_device->dev; + + if (key_map != NULL) { + err = sparse_keymap_setup(tuxedo_input_device, key_map, NULL); + if (err) { + TUXEDO_ERROR("Failed to setup sparse keymap\n"); + goto err_free_input_device; + } + } + + err = input_register_device(tuxedo_input_device); + if (unlikely(err)) { + TUXEDO_ERROR("Error registering input device\n"); + goto err_free_input_device; + } + + return 0; + +err_free_input_device: + input_free_device(tuxedo_input_device); + + return err; +} + +struct platform_device *tuxedo_keyboard_init_driver(struct tuxedo_keyboard_driver *tk_driver) +{ + int err; + struct platform_device *new_platform_device = NULL; + + TUXEDO_DEBUG("init driver start\n"); + + mutex_lock(&tuxedo_keyboard_init_driver_lock); + + if (!IS_ERR_OR_NULL(tuxedo_platform_device)) { + // If already initialized, don't proceed + TUXEDO_DEBUG("platform device already initialized\n"); + goto init_driver_exit; + } else { + // Otherwise, attempt to initialize structures + TUXEDO_DEBUG("create platform bundle\n"); + new_platform_device = platform_create_bundle( + tk_driver->platform_driver, tk_driver->probe, NULL, 0, NULL, 0); + + tuxedo_platform_device = new_platform_device; + + if (IS_ERR_OR_NULL(tuxedo_platform_device)) { + // Normal case probe failed, no init + goto init_driver_exit; + } + + TUXEDO_DEBUG("initialize input device\n"); + if (tk_driver->key_map != NULL) { + err = tuxedo_input_init(tk_driver->key_map); + if (unlikely(err)) { + TUXEDO_ERROR("Could not register input device\n"); + tk_driver->input_device = NULL; + } else { + TUXEDO_DEBUG("input device registered\n"); + tk_driver->input_device = tuxedo_input_device; + } + } + + current_driver = tk_driver; + } + +init_driver_exit: + mutex_unlock(&tuxedo_keyboard_init_driver_lock); + return new_platform_device; +} +EXPORT_SYMBOL(tuxedo_keyboard_init_driver); + +static void __exit tuxedo_input_exit(void) +{ + if (unlikely(!tuxedo_input_device)) { + return; + } + + input_unregister_device(tuxedo_input_device); + { + tuxedo_input_device = NULL; + } +} + +void tuxedo_keyboard_remove_driver(struct tuxedo_keyboard_driver *tk_driver) +{ + bool specified_driver_differ_from_used = + tk_driver != NULL && + ( + strcmp( + tk_driver->platform_driver->driver.name, + current_driver->platform_driver->driver.name + ) != 0 + ); + + if (specified_driver_differ_from_used) + return; + + TUXEDO_DEBUG("tuxedo_input_exit()\n"); + tuxedo_input_exit(); + TUXEDO_DEBUG("platform_device_unregister()\n"); + if (!IS_ERR_OR_NULL(tuxedo_platform_device)) { + platform_device_unregister(tuxedo_platform_device); + tuxedo_platform_device = NULL; + } + TUXEDO_DEBUG("platform_driver_unregister()\n"); + if (!IS_ERR_OR_NULL(current_driver)) { + platform_driver_unregister(current_driver->platform_driver); + current_driver = NULL; + } + +} +EXPORT_SYMBOL(tuxedo_keyboard_remove_driver); + +// Defines that might be missing in older kernel headers +#define INTEL_FAM6_SAPPHIRERAPIDS_X 0x8F +#define INTEL_FAM6_EMERALDRAPIDS_X 0xCF +#define INTEL_FAM6_ALDERLAKE 0x97 +#define INTEL_FAM6_ALDERLAKE_L 0x9A +#define INTEL_FAM6_ALDERLAKE_N 0xBE +#define INTEL_FAM6_RAPTORLAKE 0xB7 +#define INTEL_FAM6_RAPTORLAKE_P 0xBA +#define INTEL_FAM6_RAPTORLAKE_S 0xBF + +static const struct x86_cpu_id skip_tuxedo_dmi_string_check_match[] __initconst = { + X86_MATCH_INTEL_FAM6_MODEL(CORE_YONAH, NULL), + X86_MATCH_INTEL_FAM6_MODEL(CORE2_MEROM, NULL), + X86_MATCH_INTEL_FAM6_MODEL(CORE2_MEROM_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(CORE2_PENRYN, NULL), + X86_MATCH_INTEL_FAM6_MODEL(CORE2_DUNNINGTON, NULL), + X86_MATCH_INTEL_FAM6_MODEL(NEHALEM, NULL), + X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_G, NULL), + X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EP, NULL), + X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EX, NULL), + X86_MATCH_INTEL_FAM6_MODEL(WESTMERE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EP, NULL), + X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EX, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(HASWELL, NULL), + X86_MATCH_INTEL_FAM6_MODEL(HASWELL_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(HASWELL_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(HASWELL_G, NULL), + X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, NULL), + X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_G, NULL), + X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_D, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(CANNONLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_NNPI, NULL), + X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, NULL), // 12th Gen Xeon + //X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, NULL), // 13th Gen Xeon + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL), // 12th Gen + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL), // 12th Gen + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), // 12th Gen Atom + //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), // 13th Gen + //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), // 13th Gen + //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, NULL), // 13th Gen + X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL_MID, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_MID, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_TABLET, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_D, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT_MID, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT_NP, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, NULL), + X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, NULL), + X86_MATCH_VENDOR_FAM_MODEL(INTEL, 5, INTEL_FAM5_QUARK_X1000, NULL), + X86_MATCH_VENDOR_FAM(AMD, 5, NULL), + X86_MATCH_VENDOR_FAM(AMD, 6, NULL), + X86_MATCH_VENDOR_FAM(AMD, 15, NULL), + X86_MATCH_VENDOR_FAM(AMD, 16, NULL), + X86_MATCH_VENDOR_FAM(AMD, 17, NULL), + X86_MATCH_VENDOR_FAM(AMD, 18, NULL), + X86_MATCH_VENDOR_FAM(AMD, 19, NULL), + X86_MATCH_VENDOR_FAM(AMD, 20, NULL), + X86_MATCH_VENDOR_FAM(AMD, 21, NULL), + X86_MATCH_VENDOR_FAM(AMD, 22, NULL), + X86_MATCH_VENDOR_FAM(AMD, 23, NULL), // Zen, Zen+, Zen 2 + X86_MATCH_VENDOR_FAM(AMD, 24, NULL), // Zen + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x01, NULL), // Zen 3 Epyc + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x08, NULL), // Zen 3 Threadripper + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x21, NULL), // Zen 3 Vermeer + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x40, NULL), // Zen 3+ Rembrandt + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x44, NULL), // Zen 3+ Rembrandt + X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x50, NULL), // Zen 3 Cezanne + { } +}; + +static const struct x86_cpu_id force_tuxedo_dmi_string_check_match[] __initconst = { + { } +}; + +static const struct dmi_system_id tuxedo_dmi_string_match[] __initconst = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "TUXEDO"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_CHASSIS_VENDOR, "TUXEDO"), + }, + }, + { } +}; + +static int __init tuxedo_keyboard_init(void) +{ + TUXEDO_INFO("module init\n"); + + if (!(dmi_check_system(tuxedo_dmi_string_match) + || (x86_match_cpu(skip_tuxedo_dmi_string_check_match) + && !x86_match_cpu(force_tuxedo_dmi_string_check_match)))) { + return -ENODEV; + } + + return 0; +} + +static void __exit tuxedo_keyboard_exit(void) +{ + TUXEDO_INFO("module exit\n"); + + if (tuxedo_platform_device != NULL) + tuxedo_keyboard_remove_driver(NULL); +} + +module_init(tuxedo_keyboard_init); +module_exit(tuxedo_keyboard_exit); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard_common.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard_common.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard_common.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard_common.h 2023-10-07 05:55:45.000000000 +0000 @@ -0,0 +1,105 @@ +/*! + * Copyright (c) 2018-2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#ifndef TUXEDO_KEYBOARD_COMMON_H +#define TUXEDO_KEYBOARD_COMMON_H + +#include +#include +#include +#include +#include +#include +#include + +/* :::: Module specific Constants and simple Macros :::: */ +#define __TUXEDO_PR(lvl, fmt, ...) do { pr_##lvl(fmt, ##__VA_ARGS__); } while (0) +#define TUXEDO_INFO(fmt, ...) __TUXEDO_PR(info, fmt, ##__VA_ARGS__) +#define TUXEDO_ERROR(fmt, ...) __TUXEDO_PR(err, fmt, ##__VA_ARGS__) +#define TUXEDO_DEBUG(fmt, ...) __TUXEDO_PR(debug, "[%s:%u] " fmt, __func__, __LINE__, ##__VA_ARGS__) + +#ifndef DRIVER_NAME +#define DRIVER_NAME "clevo_keyboard" +#endif + +struct tuxedo_keyboard_driver { + // Platform driver provided by driver + struct platform_driver *platform_driver; + // Probe method provided by driver + int (*probe)(struct platform_device *); + // Keymap provided by driver + struct key_entry *key_map; + // Input device reference filled in on module init after probe success + struct input_dev *input_device; +}; + +// Global module devices +static struct platform_device *tuxedo_platform_device = NULL; +static struct input_dev *tuxedo_input_device = NULL; + +// Currently chosen driver +static struct tuxedo_keyboard_driver *current_driver = NULL; + +struct platform_device *tuxedo_keyboard_init_driver(struct tuxedo_keyboard_driver *tk_driver); +void tuxedo_keyboard_remove_driver(struct tuxedo_keyboard_driver *tk_driver); + +/** + * Basically a copy of the existing report event but doesn't report unknown events + */ +bool sparse_keymap_report_known_event(struct input_dev *dev, unsigned int code, + unsigned int value, bool autorelease) +{ + const struct key_entry *ke = + sparse_keymap_entry_from_scancode(dev, code); + + if (ke) { + sparse_keymap_report_entry(dev, ke, value, autorelease); + return true; + } + + return false; +} + +struct color_t { + u32 code; + char* name; +}; + +struct color_list_t { + uint size; + struct color_t colors[]; +}; + +/** + * Commonly used standard colors + */ +static struct color_list_t color_list = { + .size = 8, + .colors = { + { .name = "BLACK", .code = 0x000000 }, // 0 + { .name = "RED", .code = 0xFF0000 }, // 1 + { .name = "GREEN", .code = 0x00FF00 }, // 2 + { .name = "BLUE", .code = 0x0000FF }, // 3 + { .name = "YELLOW", .code = 0xFFFF00 }, // 4 + { .name = "MAGENTA", .code = 0xFF00FF }, // 5 + { .name = "CYAN", .code = 0x00FFFF }, // 6 + { .name = "WHITE", .code = 0xFFFFFF }, // 7 + } +}; + +#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_keyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_keyboard.h 2023-10-07 08:01:52.000000000 +0000 @@ -0,0 +1,468 @@ +/*! + * Copyright (c) 2018-2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#ifndef CLEVO_KEYBOARD_H +#define CLEVO_KEYBOARD_H + +#include "clevo_keyboard_common.h" +#include "clevo_interfaces.h" +#include "clevo_leds.h" + +// Clevo event codes +#define CLEVO_EVENT_KB_LEDS_DECREASE 0x81 +#define CLEVO_EVENT_KB_LEDS_INCREASE 0x82 +#define CLEVO_EVENT_KB_LEDS_CYCLE_MODE 0x83 +#define CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS 0x8A +#define CLEVO_EVENT_KB_LEDS_TOGGLE 0x9F + +#define CLEVO_EVENT_KB_LEDS_DECREASE2 0x20 +#define CLEVO_EVENT_KB_LEDS_INCREASE2 0x21 +#define CLEVO_EVENT_KB_LEDS_TOGGLE2 0x3f + +#define CLEVO_EVENT_TOUCHPAD_TOGGLE 0x5D +#define CLEVO_EVENT_TOUCHPAD_OFF 0xFC +#define CLEVO_EVENT_TOUCHPAD_ON 0xFD + +#define CLEVO_EVENT_RFKILL1 0x85 +#define CLEVO_EVENT_RFKILL2 0x86 + +#define CLEVO_EVENT_GAUGE_KEY 0x59 + +#define CLEVO_KB_MODE_DEFAULT 0 // "CUSTOM"/Static Color + +static struct clevo_interfaces_t { + struct clevo_interface_t *wmi; + struct clevo_interface_t *acpi; +} clevo_interfaces; + +static struct clevo_interface_t *active_clevo_interface; + +static struct tuxedo_keyboard_driver clevo_keyboard_driver; + +static DEFINE_MUTEX(clevo_keyboard_interface_modification_lock); + +static struct key_entry clevo_keymap[] = { + // Keyboard backlight (RGB versions) + { KE_KEY, CLEVO_EVENT_KB_LEDS_DECREASE, { KEY_KBDILLUMDOWN } }, + { KE_KEY, CLEVO_EVENT_KB_LEDS_INCREASE, { KEY_KBDILLUMUP } }, + { KE_KEY, CLEVO_EVENT_KB_LEDS_TOGGLE, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_MODE, { KEY_LIGHTS_TOGGLE } }, + // Single cycle key (white only versions) (currently handled in driver) + // { KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS, { KEY_KBDILLUMTOGGLE } }, + + // Alternative events (ex. 6 step white kbd) + { KE_KEY, CLEVO_EVENT_KB_LEDS_DECREASE2, { KEY_KBDILLUMDOWN } }, + { KE_KEY, CLEVO_EVENT_KB_LEDS_INCREASE2, { KEY_KBDILLUMUP } }, + { KE_KEY, CLEVO_EVENT_KB_LEDS_TOGGLE2, { KEY_KBDILLUMTOGGLE } }, + + // Touchpad + // The weirdly named touchpad toggle key that is implemented as KEY_F21 "everywhere" + // (instead of KEY_TOUCHPAD_TOGGLE or on/off) + // Most "new" devices just provide one toggle event + { KE_KEY, CLEVO_EVENT_TOUCHPAD_TOGGLE, { KEY_F21 } }, + // Some "old" devices produces on/off events + { KE_KEY, CLEVO_EVENT_TOUCHPAD_OFF, { KEY_F21 } }, + { KE_KEY, CLEVO_EVENT_TOUCHPAD_ON, { KEY_F21 } }, + // The alternative key events (currently not used) + // { KE_KEY, CLEVO_EVENT_TOUCHPAD_OFF, { KEY_TOUCHPAD_OFF } }, + // { KE_KEY, CLEVO_EVENT_TOUCHPAD_ON, { KEY_TOUCHPAD_ON } }, + // { KE_KEY, CLEVO_EVENT_TOUCHPAD_TOGGLE, { KEY_TOUCHPAD_TOGGLE } }, + + // Rfkill still needed by some devices + { KE_KEY, CLEVO_EVENT_RFKILL1, { KEY_RFKILL } }, + { KE_IGNORE, CLEVO_EVENT_RFKILL2, { KEY_RFKILL } }, // Older rfkill event + // Note: Volume events need to be ignored as to not interfere with built-in functionality + { KE_IGNORE, 0xfa, { KEY_UNKNOWN } }, // Appears by volume up/down + { KE_IGNORE, 0xfb, { KEY_UNKNOWN } }, // Appears by mute toggle + + // Only used to put ev bits + { KE_KEY, 0xffff, { KEY_F6 } }, + { KE_KEY, 0xffff, { KEY_LEFTALT } }, + { KE_KEY, 0xffff, { KEY_LEFTMETA } }, + + { KE_END, 0 } +}; + +// Keyboard struct +static struct kbd_led_state_t { + u8 has_mode; + u8 mode; + u8 whole_kbd_color; +} kbd_led_state = { + .has_mode = 1, + .mode = CLEVO_KB_MODE_DEFAULT, + .whole_kbd_color = 7, +}; + +static struct kbd_backlight_mode_t { + u8 key; + u32 value; + const char *const name; +} kbd_backlight_modes[] = { + { .key = 0, .value = 0x00000000, .name = "CUSTOM"}, + { .key = 1, .value = 0x1002a000, .name = "BREATHE"}, + { .key = 2, .value = 0x33010000, .name = "CYCLE"}, + { .key = 3, .value = 0x80000000, .name = "DANCE"}, + { .key = 4, .value = 0xA0000000, .name = "FLASH"}, + { .key = 5, .value = 0x70000000, .name = "RANDOM_COLOR"}, + { .key = 6, .value = 0x90000000, .name = "TEMPO"}, + { .key = 7, .value = 0xB0000000, .name = "WAVE"} +}; + +int clevo_evaluate_method2(u8 cmd, u32 arg, union acpi_object **result) +{ + if (IS_ERR_OR_NULL(active_clevo_interface)) { + pr_err("clevo_keyboard: no active interface while attempting cmd %02x arg %08x\n", cmd, arg); + return -ENODEV; + } + return active_clevo_interface->method_call(cmd, arg, result); +} +EXPORT_SYMBOL(clevo_evaluate_method2); + +int clevo_evaluate_method(u8 cmd, u32 arg, u32 *result) +{ + int status = 0; + union acpi_object *out_obj; + + status = clevo_evaluate_method2(cmd, arg, &out_obj); + if (status) { + return status; + } + else { + if (out_obj->type == ACPI_TYPE_INTEGER) { + if (!IS_ERR_OR_NULL(result)) + *result = (u32) out_obj->integer.value; + } else { + pr_err("return type not integer, use clevo_evaluate_method2\n"); + status = -ENODATA; + } + ACPI_FREE(out_obj); + } + + return status; +} +EXPORT_SYMBOL(clevo_evaluate_method); + +int clevo_get_active_interface_id(char **id_str) +{ + if (IS_ERR_OR_NULL(active_clevo_interface)) + return -ENODEV; + + if (!IS_ERR_OR_NULL(id_str)) + *id_str = active_clevo_interface->string_id; + + return 0; +} +EXPORT_SYMBOL(clevo_get_active_interface_id); + +static void set_next_color_whole_kb(void) +{ + /* "Calculate" new to-be color */ + u32 new_color_id; + u32 new_color_code; + + new_color_id = kbd_led_state.whole_kbd_color + 1; + if (new_color_id >= color_list.size) { + new_color_id = 1; // Skip black + } + new_color_code = color_list.colors[new_color_id].code; + + TUXEDO_INFO("set_next_color_whole_kb(): new_color_id: %i, new_color_code %X", + new_color_id, new_color_code); + + /* Set color on all four regions*/ + clevo_leds_set_color_extern(new_color_code); + kbd_led_state.whole_kbd_color = new_color_id; +} + +static void set_kbd_backlight_mode(u8 kbd_backlight_mode) +{ + TUXEDO_INFO("Set keyboard backlight mode on %s", kbd_backlight_modes[kbd_backlight_mode].name); + + if (!clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, kbd_backlight_modes[kbd_backlight_mode].value, NULL)) { + // method was succesfull so update ur internal state struct + kbd_led_state.mode = kbd_backlight_mode; + } +} + +// Sysfs Interface for the keyboard backlight mode +static ssize_t list_kbd_backlight_modes_fs(struct device *child, struct device_attribute *attr, + char *buffer) +{ + return sprintf(buffer, "%d\n", kbd_led_state.mode); +} + +static ssize_t set_kbd_backlight_mode_fs(struct device *child, + struct device_attribute *attr, + const char *buffer, size_t size) +{ + unsigned int kbd_backlight_mode; + + int err = kstrtouint(buffer, 0, &kbd_backlight_mode); + if (err) { + return err; + } + + kbd_backlight_mode = clamp_t(u8, kbd_backlight_mode, 0, ARRAY_SIZE(kbd_backlight_modes) - 1); + set_kbd_backlight_mode(kbd_backlight_mode); + + return size; +} + +// Sysfs attribute file permissions and method linking +static DEVICE_ATTR(kbd_backlight_mode, 0644, list_kbd_backlight_modes_fs, set_kbd_backlight_mode_fs); + +static int kbd_backlight_mode_id_validator(const char *value, + const struct kernel_param *kbd_backlight_mode_param) +{ + int kbd_backlight_mode = 0; + + if (kstrtoint(value, 10, &kbd_backlight_mode) != 0 + || kbd_backlight_mode < 0 + || kbd_backlight_mode > (ARRAY_SIZE(kbd_backlight_modes) - 1)) { + return -EINVAL; + } + + return param_set_int(value, kbd_backlight_mode_param); +} + +static const struct kernel_param_ops param_ops_mode_ops = { + .set = kbd_backlight_mode_id_validator, + .get = param_get_int, +}; + +static u8 param_kbd_backlight_mode = CLEVO_KB_MODE_DEFAULT; +module_param_cb(kbd_backlight_mode, ¶m_ops_mode_ops, ¶m_kbd_backlight_mode, S_IRUSR); +MODULE_PARM_DESC(kbd_backlight_mode, "Set the keyboard backlight mode"); + +static void clevo_send_cc_combo(void) +{ + // Special key combination. Opens TCC by default when installed. + input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 1); + input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 1); + input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 1); + input_sync(clevo_keyboard_driver.input_device); + input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 0); + input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 0); + input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 0); + input_sync(clevo_keyboard_driver.input_device); +} + +static void clevo_keyboard_event_callb(u32 event) +{ + u32 key_event = event; + + TUXEDO_DEBUG("Clevo event: %0#6x\n", event); + + switch (key_event) { + case CLEVO_EVENT_GAUGE_KEY: + clevo_send_cc_combo(); + break; + case CLEVO_EVENT_KB_LEDS_CYCLE_MODE: + if (clevo_leds_get_backlight_type() == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + clevo_send_cc_combo(); + } else { + set_next_color_whole_kb(); + } + break; + case CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS: + clevo_leds_notify_brightness_change_extern(); + break; + default: + break; + } + + if (current_driver != NULL && current_driver->input_device != NULL) { + if (!sparse_keymap_report_known_event(current_driver->input_device, key_event, 1, true)) { + TUXEDO_DEBUG("Unknown key - %d (%0#6x)\n", key_event, key_event); + } + } +} + +static void clevo_keyboard_init_device_interface(struct platform_device *dev) +{ + // Setup sysfs + if (clevo_leds_get_backlight_type() == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + if (device_create_file(&dev->dev, &dev_attr_kbd_backlight_mode) != 0) { + TUXEDO_ERROR("Sysfs attribute file creation failed for blinking pattern\n"); + } + else { + kbd_led_state.has_mode = 1; + } + } +} + +/** + * strstr version of dmi_match + */ +static bool dmi_string_in(enum dmi_field f, const char *str) +{ + const char *info = dmi_get_system_info(f); + + if (info == NULL || str == NULL) + return info == str; + + return strstr(info, str) != NULL; +} + +static void clevo_keyboard_init(void) +{ + bool performance_profile_set_workaround; + + kbd_led_state.mode = param_kbd_backlight_mode; + set_kbd_backlight_mode(kbd_led_state.mode); + + clevo_evaluate_method(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); + + // Workaround for firmware issue not setting selected performance profile. + // Explicitly set "performance" perf. profile on init regardless of what is chosen + // for these devices (Aura, XP14, IBS14v5) + performance_profile_set_workaround = false + || dmi_string_in(DMI_BOARD_NAME, "AURA1501") + || dmi_string_in(DMI_BOARD_NAME, "EDUBOOK1502") + || dmi_string_in(DMI_BOARD_NAME, "L140CU") + || dmi_string_in(DMI_BOARD_NAME, "PCx0Dx_GN20") + || dmi_string_in(DMI_BOARD_NAME, "L14xMU") + ; + if (performance_profile_set_workaround) { + TUXEDO_INFO("Performance profile 'performance' set workaround applied\n"); + clevo_evaluate_method(CLEVO_CMD_OPT, 0x19000002, NULL); + } +} + +static int clevo_keyboard_probe(struct platform_device *dev) +{ + clevo_leds_init(dev); + // clevo_keyboard_init_device_interface() must come after clevo_leds_init() + // to know keyboard backlight type + clevo_keyboard_init_device_interface(dev); + clevo_keyboard_init(); + + return 0; +} + +static void clevo_keyboard_remove_device_interface(struct platform_device *dev) +{ + if (kbd_led_state.has_mode == 1) { + device_remove_file(&dev->dev, &dev_attr_kbd_backlight_mode); + } +} + +static int clevo_keyboard_remove(struct platform_device *dev) +{ + clevo_keyboard_remove_device_interface(dev); + clevo_leds_remove(dev); + return 0; +} + +static int clevo_keyboard_suspend(struct platform_device *dev, pm_message_t state) +{ + clevo_leds_suspend(dev); + return 0; +} + +static int clevo_keyboard_resume(struct platform_device *dev) +{ + clevo_evaluate_method(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); + clevo_leds_restore_state_extern(); // Sometimes clevo devices forget their last state after + // suspend, so let the kernel ensure it. + clevo_leds_resume(dev); + return 0; +} + +static struct platform_driver platform_driver_clevo = { + .remove = clevo_keyboard_remove, + .suspend = clevo_keyboard_suspend, + .resume = clevo_keyboard_resume, + .driver = + { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, +}; + +static struct tuxedo_keyboard_driver clevo_keyboard_driver = { + .platform_driver = &platform_driver_clevo, + .probe = clevo_keyboard_probe, + .key_map = clevo_keymap, +}; + +int clevo_keyboard_add_interface(struct clevo_interface_t *new_interface) +{ + mutex_lock(&clevo_keyboard_interface_modification_lock); + + if (strcmp(new_interface->string_id, CLEVO_INTERFACE_WMI_STRID) == 0) { + clevo_interfaces.wmi = new_interface; + clevo_interfaces.wmi->event_callb = clevo_keyboard_event_callb; + + // Only use wmi if there is no other current interface + if (ZERO_OR_NULL_PTR(active_clevo_interface)) { + pr_debug("enable wmi events\n"); + clevo_interfaces.wmi->method_call(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); + + active_clevo_interface = clevo_interfaces.wmi; + } + } else if (strcmp(new_interface->string_id, CLEVO_INTERFACE_ACPI_STRID) == 0) { + clevo_interfaces.acpi = new_interface; + clevo_interfaces.acpi->event_callb = clevo_keyboard_event_callb; + + pr_debug("enable acpi events (takes priority)\n"); + clevo_interfaces.acpi->method_call(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); + active_clevo_interface = clevo_interfaces.acpi; + } else { + // Not recognized interface + pr_err("unrecognized interface\n"); + mutex_unlock(&clevo_keyboard_interface_modification_lock); + return -EINVAL; + } + + mutex_unlock(&clevo_keyboard_interface_modification_lock); + + if (active_clevo_interface != NULL) + tuxedo_keyboard_init_driver(&clevo_keyboard_driver); + + return 0; +} +EXPORT_SYMBOL(clevo_keyboard_add_interface); + +int clevo_keyboard_remove_interface(struct clevo_interface_t *interface) +{ + mutex_lock(&clevo_keyboard_interface_modification_lock); + + if (strcmp(interface->string_id, CLEVO_INTERFACE_WMI_STRID) == 0) { + clevo_interfaces.wmi = NULL; + } else if (strcmp(interface->string_id, CLEVO_INTERFACE_ACPI_STRID) == 0) { + clevo_interfaces.acpi = NULL; + } else { + mutex_unlock(&clevo_keyboard_interface_modification_lock); + return -EINVAL; + } + + if (active_clevo_interface == interface) { + tuxedo_keyboard_remove_driver(&clevo_keyboard_driver); + active_clevo_interface = NULL; + } + + + mutex_unlock(&clevo_keyboard_interface_modification_lock); + + return 0; +} +EXPORT_SYMBOL(clevo_keyboard_remove_interface); + +#endif // CLEVO_KEYBOARD_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_leds.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_leds.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_leds.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_leds.h 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,542 @@ +/*! + * Copyright (c) 2018-2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ + +#ifndef CLEVO_LEDS_H +#define CLEVO_LEDS_H + +#include +#include +#include + +enum clevo_kb_backlight_types { + CLEVO_KB_BACKLIGHT_TYPE_NONE = 0x00, + CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR = 0x01, + CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB = 0x02, + CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB = 0x06, + CLEVO_KB_BACKLIGHT_TYPE_PER_KEY_RGB = 0xf3 +}; + +int clevo_leds_init(struct platform_device *dev); +int clevo_leds_remove(struct platform_device *dev); +int clevo_leds_suspend(struct platform_device *dev); +int clevo_leds_resume(struct platform_device *dev); +enum clevo_kb_backlight_types clevo_leds_get_backlight_type(void); +void clevo_leds_restore_state_extern(void); +void clevo_leds_notify_brightness_change_extern(void); +void clevo_leds_set_brightness_extern(enum led_brightness brightness); +void clevo_leds_set_color_extern(u32 color); + +// TODO The following should go into a seperate .c file, but for this to work more reworking is required in the tuxedo_keyboard structure. + +#include "clevo_leds.h" + +#include "clevo_interfaces.h" + +#include +#include + +#define CLEVO_KBD_BRIGHTNESS_MAX 0xff +#define CLEVO_KBD_BRIGHTNESS_DEFAULT 0x00 + +#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX 0x02 // White only keyboards can only be off, half, or full brightness +#define CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT 0x00 + +#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5 0x05 // Devices <= Intel 7th gen had a different white control with 5 brightness values + off +#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5_DEFAULT 0x00 + +#define CLEVO_KB_COLOR_DEFAULT_RED 0xff +#define CLEVO_KB_COLOR_DEFAULT_GREEN 0xff +#define CLEVO_KB_COLOR_DEFAULT_BLUE 0xff +#define CLEVO_KB_COLOR_DEFAULT ((CLEVO_KB_COLOR_DEFAULT_RED << 16) + (CLEVO_KB_COLOR_DEFAULT_GREEN << 8) + CLEVO_KB_COLOR_DEFAULT_BLUE) + +static enum clevo_kb_backlight_types clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_NONE; +static bool leds_initialized = false; + +/** + * Color scaling quirk list + */ +static void color_scaling(enum clevo_kb_backlight_types *type, u8 *red, u8 *green, u8 *blue) +{ + if (*type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + *red = (180 * *red) / 255; + *blue = (200 * *blue) / 255; + } +} + +static int clevo_evaluate_set_white_brightness(u8 brightness) +{ + pr_debug("Set white brightness to %d\n", brightness); + + return clevo_evaluate_method (CLEVO_CMD_SET_KB_WHITE_LEDS, brightness, NULL); +} + +static int clevo_evaluate_set_rgb_brightness(u8 brightness) +{ + pr_debug("Set RGB brightness to %d\n", brightness); + + return clevo_evaluate_method (CLEVO_CMD_SET_KB_RGB_LEDS, CLEVO_CMD_SET_KB_LEDS_SUB_RGB_BRIGHTNESS | brightness, NULL); +} + +static int clevo_evaluate_set_rgb_color(u32 zone, u32 color) +{ + u32 cset = ((color & 0x0000FF) << 16) | ((color & 0xFF0000) >> 8) | ((color & 0x00FF00) >> 8); + u32 clevo_submethod_arg = zone | cset; + + pr_debug("Set Color 0x%08x for region 0x%08x\n", color, zone); + + return clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, clevo_submethod_arg, NULL); +} + +static int clevo_evaluate_set_keyboard_status(u8 state) +{ + u32 cmd = 0xE0000000; + TUXEDO_INFO("Set keyboard enabled to: %d\n", state); + + if (state == 0) { + cmd |= 0x003001; + } else { + cmd |= 0x07F001; + } + + return clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, cmd, NULL); +} + +static void clevo_leds_set_brightness(struct led_classdev *led_cdev __always_unused, enum led_brightness brightness) { + int ret = clevo_evaluate_set_white_brightness(brightness); + if (ret) { + pr_debug("clevo_leds_set_brightness(): clevo_evaluate_set_white_brightness() failed\n"); + return; + } + led_cdev->brightness = brightness; +} + +/*static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { + int ret; + u32 zone, color; + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + + ret = clevo_evaluate_set_rgb_brightness(CLEVO_KBD_BRIGHTNESS_MAX); + if (ret) { + pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_brightness() failed\n"); + return; + } + + zone = mcled_cdev->subled_info[0].channel; + + led_mc_calc_color_components(mcled_cdev, brightness); + color = (mcled_cdev->subled_info[0].brightness << 16) + + (mcled_cdev->subled_info[1].brightness << 8) + + mcled_cdev->subled_info[2].brightness; + + ret = clevo_evaluate_set_rgb_color(zone, color); + if (ret) { + pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_color() failed\n"); + return; + } + led_cdev->brightness = brightness; +}*/ + +// Temprary fix for KDE: KDE does only set one kbd_backlight brightness value, this version of the +// function uses clevos built in brightness setting to set the whole keyboard brightness at once. +// -> use clevo_evaluate_set_rgb_brightness() to set overall brightness via firmware instead of scaling +// the RGB values +// -> update all clevo_mcled_cdevs brightness levels to refect that the firmware method sets the +// the whole keyboard brightness and not just one zone +// This is a temporary fix until KDE handles multiple keyboard backlights correctly +static struct led_classdev_mc clevo_mcled_cdevs[3]; // forward declaration +static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { + int ret; + u32 zone, color; + u8 red, green, blue; + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + + ret = clevo_evaluate_set_rgb_brightness(brightness); + if (ret) { + pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_brightness() failed\n"); + return; + } + clevo_mcled_cdevs[0].led_cdev.brightness = brightness; + clevo_mcled_cdevs[1].led_cdev.brightness = brightness; + clevo_mcled_cdevs[2].led_cdev.brightness = brightness; + + zone = mcled_cdev->subled_info[0].channel; + + red = mcled_cdev->subled_info[0].intensity; + green = mcled_cdev->subled_info[1].intensity; + blue = mcled_cdev->subled_info[2].intensity; + + color_scaling(&clevo_kb_backlight_type, &red, &green, &blue); + + color = (red << 16) + + (green << 8) + + blue; + + ret = clevo_evaluate_set_rgb_color(zone, color); + if (ret) { + pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_color() failed\n"); + } +} + +static struct led_classdev clevo_led_cdev = { + .name = "white:" LED_FUNCTION_KBD_BACKLIGHT, + .max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX, + .brightness_set = &clevo_leds_set_brightness, + .brightness = CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT, + .flags = LED_BRIGHT_HW_CHANGED +}; + +static struct mc_subled clevo_mcled_cdevs_subleds[3][3] = { + { + { + .color_index = LED_COLOR_ID_RED, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_RED, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 + }, + { + .color_index = LED_COLOR_ID_GREEN, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 + }, + { + .color_index = LED_COLOR_ID_BLUE, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 + } + }, + { + { + .color_index = LED_COLOR_ID_RED, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_RED, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 + }, + { + .color_index = LED_COLOR_ID_GREEN, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 + }, + { + .color_index = LED_COLOR_ID_BLUE, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 + } + }, + { + { + .color_index = LED_COLOR_ID_RED, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_RED, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 + }, + { + .color_index = LED_COLOR_ID_GREEN, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 + }, + { + .color_index = LED_COLOR_ID_BLUE, + .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, + .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 + } + } +}; + +static struct led_classdev_mc clevo_mcled_cdevs[3] = { + { + .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, + .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, + .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, + .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .num_colors = 3, + .subled_info = clevo_mcled_cdevs_subleds[0] + }, + { + .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, + .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, + .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, + .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .num_colors = 3, + .subled_info = clevo_mcled_cdevs_subleds[1] + }, + { + .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, + .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, + .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, + .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, + .num_colors = 3, + .subled_info = clevo_mcled_cdevs_subleds[2] + } +}; + +int clevo_leds_init(struct platform_device *dev) +{ + int ret, i; + int status; + union acpi_object *result; + u32 result_fallback; + + for (i = 0; i < 3; ++i) { + status = clevo_evaluate_method2(CLEVO_CMD_GET_SPECS, 0, &result); + if (!status) { + if (result->type == ACPI_TYPE_BUFFER) { + pr_debug("CLEVO_CMD_GET_SPECS result->buffer.pointer[0x0f]: 0x%02x\n", result->buffer.pointer[0x0f]); + clevo_kb_backlight_type = result->buffer.pointer[0x0f]; + if (clevo_kb_backlight_type) { + status = clevo_evaluate_method(CLEVO_CMD_GET_BIOS_FEATURES_2, 0, &result_fallback); + if (!status) { + pr_debug("CLEVO_CMD_GET_BIOS_FEATURES_2 result_fallback: 0x%08x\n", result_fallback); + if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_2_SUB_WHITE_ONLY_KB_MAX_5) { + clevo_led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5; + clevo_led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5_DEFAULT; + } + } + break; + } else { + pr_debug("clevo_kb_backlight_type 0x00 probably wrong, retrying...\n"); + msleep(50); + } + } + else { + pr_err("CLEVO_CMD_GET_SPECS does not exist on this device or return value has wrong type, trying CLEVO_CMD_GET_BIOS_FEATURES\n"); + status = -EINVAL; + } + ACPI_FREE(result); + } + else { + pr_notice("CLEVO_CMD_GET_SPECS does not exist on this device or failed, trying CLEVO_CMD_GET_BIOS_FEATURES_1\n"); + } + } + + if (status || clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_NONE) { + // check for devices <= Intel 8th gen (only white only, 3 zone RGB, or no backlight on these devices) + status = clevo_evaluate_method(CLEVO_CMD_GET_BIOS_FEATURES_1, 0, &result_fallback); + if (!status) { + pr_debug("CLEVO_CMD_GET_BIOS_FEATURES_1 result_fallback: 0x%08x\n", result_fallback); + if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_3_ZONE_RGB_KB) { + clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB; + } + else if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_WHITE_ONLY_KB) { + clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR; + + status = clevo_evaluate_method(CLEVO_CMD_GET_BIOS_FEATURES_2, 0, &result_fallback); + if (!status) { + pr_debug("CLEVO_CMD_GET_BIOS_FEATURES_2 result_fallback: 0x%08x\n", result_fallback); + if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_2_SUB_WHITE_ONLY_KB_MAX_5) { + clevo_led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5; + clevo_led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5_DEFAULT; + } + } + else { + pr_notice("CLEVO_CMD_GET_BIOS_FEATURES_2 does not exist on this device or failed\n"); + } + } + } + else { + pr_notice("CLEVO_CMD_GET_BIOS_FEATURES_1 does not exist on this device or failed\n"); + } + } + pr_debug("Keyboard backlight type: 0x%02x\n", clevo_kb_backlight_type); + + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) + clevo_leds_set_brightness_extern(clevo_led_cdev.brightness); + else + clevo_leds_set_color_extern(CLEVO_KB_COLOR_DEFAULT); + + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + pr_debug("Registering fixed color leds interface\n"); + ret = led_classdev_register(&dev->dev, &clevo_led_cdev); + if (ret) { + pr_err("Registering fixed color leds interface failed\n"); + return ret; + } + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + clevo_evaluate_set_keyboard_status(1); + pr_debug("Registering single zone rgb leds interface\n"); + ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[0]); + if (ret) { + pr_err("Registering single zone rgb leds interface failed\n"); + return ret; + } + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + clevo_evaluate_set_keyboard_status(1); + pr_debug("Registering three zone rgb leds interface\n"); + ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[0]); + if (ret) { + pr_err("Registering three zone rgb zone 0 leds interface failed\n"); + return ret; + } + ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[1]); + if (ret) { + pr_err("Registering three zone rgb zone 1 leds interface failed\n"); + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); + return ret; + } + ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[2]); + if (ret) { + pr_err("Registering three zone rgb zone 2 leds interface failed\n"); + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[1]); + return ret; + } + } + + leds_initialized = true; + return 0; +} +EXPORT_SYMBOL(clevo_leds_init); + +int clevo_leds_suspend(struct platform_device *dev) +{ + switch (clevo_kb_backlight_type) { + case CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB: + case CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB: + clevo_evaluate_set_keyboard_status(0); + break; + default: + break; + } + return 0; +} +EXPORT_SYMBOL(clevo_leds_suspend); + +int clevo_leds_resume(struct platform_device *dev) +{ + switch (clevo_kb_backlight_type) { + case CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB: + case CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB: + clevo_evaluate_set_keyboard_status(1); + break; + default: + break; + } + return 0; +} +EXPORT_SYMBOL(clevo_leds_resume); + +int clevo_leds_remove(struct platform_device *dev) { + if (leds_initialized) { + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + led_classdev_unregister(&clevo_led_cdev); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[1]); + devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[2]); + } + } + + leds_initialized = false; + + return 0; +} +EXPORT_SYMBOL(clevo_leds_remove); + +enum clevo_kb_backlight_types clevo_leds_get_backlight_type(void) { + return clevo_kb_backlight_type; +} +EXPORT_SYMBOL(clevo_leds_get_backlight_type); + +// TODO Don't reuse brightness_set as it is writing back the same brightness which could lead to race conditions. +// Reimplement brightness_set instead without writing back brightness value like in uniwill_leds.h. +void clevo_leds_restore_state_extern(void) { + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + clevo_led_cdev.brightness_set(&clevo_led_cdev, clevo_led_cdev.brightness); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); + clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, clevo_mcled_cdevs[1].led_cdev.brightness); + clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, clevo_mcled_cdevs[2].led_cdev.brightness); + } +} +EXPORT_SYMBOL(clevo_leds_restore_state_extern); + +void clevo_leds_notify_brightness_change_extern(void) { + int status; + u32 result; + + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + status = clevo_evaluate_method(CLEVO_CMD_GET_KB_WHITE_LEDS, 0, &result); + pr_debug("Firmware set brightness: %u\n", result); + clevo_led_cdev.brightness = result; + led_classdev_notify_brightness_hw_changed(&clevo_led_cdev, result); + } +} +EXPORT_SYMBOL(clevo_leds_notify_brightness_change_extern); + +// TODO Not used externaly, but only on init. Should not be exposed because it would require a correct +// led_classdev_notify_brightness_hw_changed implementation when used outside of init. +void clevo_leds_set_brightness_extern(enum led_brightness brightness) { + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + clevo_led_cdev.brightness_set(&clevo_led_cdev, brightness); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, brightness); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, brightness); + clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, brightness); + clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, brightness); + } +} +EXPORT_SYMBOL(clevo_leds_set_brightness_extern); + +// TODO Not used externaly, but only on init. Should not be exposed because it would require a correct +// led_classdev_notify_brightness_hw_changed equivalent for color implementation when used outside of init. +void clevo_leds_set_color_extern(u32 color) { + if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + clevo_mcled_cdevs[0].subled_info[0].intensity = (color >> 16) & 0xff; + clevo_mcled_cdevs[0].subled_info[1].intensity = (color >> 8) & 0xff; + clevo_mcled_cdevs[0].subled_info[2].intensity = color & 0xff; + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); + } + else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { + clevo_mcled_cdevs[0].subled_info[0].intensity = (color >> 16) & 0xff; + clevo_mcled_cdevs[0].subled_info[1].intensity = (color >> 8) & 0xff; + clevo_mcled_cdevs[0].subled_info[2].intensity = color & 0xff; + clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); + clevo_mcled_cdevs[1].subled_info[0].intensity = (color >> 16) & 0xff; + clevo_mcled_cdevs[1].subled_info[1].intensity = (color >> 8) & 0xff; + clevo_mcled_cdevs[1].subled_info[2].intensity = color & 0xff; + clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, clevo_mcled_cdevs[1].led_cdev.brightness); + clevo_mcled_cdevs[2].subled_info[0].intensity = (color >> 16) & 0xff; + clevo_mcled_cdevs[2].subled_info[1].intensity = (color >> 8) & 0xff; + clevo_mcled_cdevs[2].subled_info[2].intensity = color & 0xff; + clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, clevo_mcled_cdevs[2].led_cdev.brightness); + } +} +EXPORT_SYMBOL(clevo_leds_set_color_extern); + +MODULE_LICENSE("GPL"); + +#endif // CLEVO_LEDS_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_wmi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_wmi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/clevo_wmi.c 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/clevo_wmi.c 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,173 @@ +/*! + * Copyright (c) 2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include "clevo_interfaces.h" + +static int clevo_wmi_evaluate(u32 wmi_method_id, u32 wmi_arg, union acpi_object **result) +{ + struct acpi_buffer acpi_buffer_in = { (acpi_size)sizeof(wmi_arg), + &wmi_arg }; + struct acpi_buffer acpi_buffer_out = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *acpi_result; + acpi_status status_acpi; + int return_status = 0; + + status_acpi = + wmi_evaluate_method(CLEVO_WMI_METHOD_GUID, 0x00, wmi_method_id, + &acpi_buffer_in, &acpi_buffer_out); + + if (unlikely(ACPI_FAILURE(status_acpi))) { + pr_err("failed to evaluate wmi method\n"); + return -EIO; + } + + acpi_result = (union acpi_object *)acpi_buffer_out.pointer; + if (!acpi_result) { + pr_err("failed to evaluate WMI method\n"); + return_status = -1; + } + else { + if (!IS_ERR_OR_NULL(result)) { + *result = acpi_result; + } + } + + return return_status; +} + +int clevo_wmi_interface_method_call(u8 cmd, u32 arg, union acpi_object **result_value) +{ + return clevo_wmi_evaluate(cmd, arg, result_value); +} + +struct clevo_interface_t clevo_wmi_interface = { + .string_id = CLEVO_INTERFACE_WMI_STRID, + .method_call = clevo_wmi_interface_method_call, +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) +static int clevo_wmi_probe(struct wmi_device *wdev) +#else +static int clevo_wmi_probe(struct wmi_device *wdev, const void *dummy_context) +#endif +{ + int status; + union acpi_object *out_obj; + + pr_debug("clevo_wmi driver probe\n"); + + if (!wmi_has_guid(CLEVO_WMI_EVENT_GUID)) { + pr_debug("probe: Clevo event guid missing\n"); + return -ENODEV; + } + + if (!wmi_has_guid(CLEVO_WMI_METHOD_GUID)) { + pr_debug("probe: Clevo method guid missing\n"); + return -ENODEV; + } + + // Since the WMI GUIDs aren't unique let's (at least) + // check the return of some "known existing general" method + status = clevo_wmi_evaluate(0x52, 0, &out_obj); + if (status < 0) { + pr_debug("probe: Clevo GUIDs present but method call failed\n"); + return -ENODEV; + } + if (out_obj->type != ACPI_TYPE_INTEGER || (out_obj->type == ACPI_TYPE_INTEGER && (u32)out_obj->integer.value == 0xffffffff)) { + pr_debug( + "probe: Clevo GUIDs present but method returned unexpected value\n"); + ACPI_FREE(out_obj); + return -ENODEV; + } + ACPI_FREE(out_obj); + + // Add this interface + clevo_keyboard_add_interface(&clevo_wmi_interface); + + pr_info("interface initialized\n"); + + return 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) +static int clevo_wmi_remove(struct wmi_device *wdev) +#else +static void clevo_wmi_remove(struct wmi_device *wdev) +#endif +{ + pr_debug("clevo_wmi driver remove\n"); + clevo_keyboard_remove_interface(&clevo_wmi_interface); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) + return 0; +#endif +} + +static void clevo_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy) +{ + u32 event_value; + union acpi_object *out_obj; + int status; + + status = clevo_wmi_evaluate(0x01, 0, &out_obj); + if (!status) { + if (out_obj->type == ACPI_TYPE_INTEGER) { + event_value = (u32)out_obj->integer.value; + } else { + pr_err("return type not integer, use clevo_evaluate_method2\n"); + } + ACPI_FREE(out_obj); + } + pr_debug("clevo_wmi notify\n"); + if (!IS_ERR_OR_NULL(clevo_wmi_interface.event_callb)) { + // Execute registered callback + clevo_wmi_interface.event_callb(event_value); + } +} + +static const struct wmi_device_id clevo_wmi_device_ids[] = { + // Listing one should be enough, for a driver that "takes care of all anyways" + // also prevents probe (and handling) per "device" + { .guid_string = CLEVO_WMI_EVENT_GUID }, + { } +}; + +static struct wmi_driver clevo_wmi_driver = { + .driver = { + .name = CLEVO_INTERFACE_WMI_STRID, + .owner = THIS_MODULE + }, + .id_table = clevo_wmi_device_ids, + .probe = clevo_wmi_probe, + .remove = clevo_wmi_remove, + .notify = clevo_wmi_notify, +}; + +module_wmi_driver(clevo_wmi_driver); + +MODULE_AUTHOR("TUXEDO Computers GmbH "); +MODULE_DESCRIPTION("Driver for Clevo WMI interface"); +MODULE_VERSION("0.1.1"); +MODULE_LICENSE("GPL"); + +MODULE_DEVICE_TABLE(wmi, clevo_wmi_device_ids); +MODULE_ALIAS_CLEVO_WMI(); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_interfaces.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_interfaces.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_interfaces.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_interfaces.h 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,139 @@ +/*! + * Copyright (c) 2021 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#ifndef UNIWILL_INTERFACES_H +#define UNIWILL_INTERFACES_H + +#include + +#define UNIWILL_WMI_MGMT_GUID_BA "ABBC0F6D-8EA1-11D1-00A0-C90629100000" +#define UNIWILL_WMI_MGMT_GUID_BB "ABBC0F6E-8EA1-11D1-00A0-C90629100000" +#define UNIWILL_WMI_MGMT_GUID_BC "ABBC0F6F-8EA1-11D1-00A0-C90629100000" + +#define UNIWILL_WMI_EVENT_GUID_0 "ABBC0F70-8EA1-11D1-00A0-C90629100000" +#define UNIWILL_WMI_EVENT_GUID_1 "ABBC0F71-8EA1-11D1-00A0-C90629100000" +#define UNIWILL_WMI_EVENT_GUID_2 "ABBC0F72-8EA1-11D1-00A0-C90629100000" + +#define MODULE_ALIAS_UNIWILL_WMI() \ + MODULE_ALIAS("wmi:" UNIWILL_WMI_EVENT_GUID_2); \ + MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC); + +#define UNIWILL_INTERFACE_WMI_STRID "uniwill_wmi" + +typedef int (uniwill_read_ec_ram_t)(u16, u8*); +typedef int (uniwill_read_ec_ram_with_retry_t)(u16, u8*, int); +typedef int (uniwill_write_ec_ram_t)(u16, u8); +typedef int (uniwill_write_ec_ram_with_retry_t)(u16, u8, int); +typedef void (uniwill_event_callb_t)(u32); + +// UW_EC_REG_* known relevant EC address exposing some information or function +// UW_EC_REG_*_BIT_* single bit from byte holding information, should be handled with bit-wise operations +// UW_EC_REG_*_VALUE_* discrete value of the whole byte with special meaning +// UW_EC_REG_*_SUBCMD_* writing this discrete value triggers special behaviour + +#define UW_EC_REG_KBD_BL_STATUS 0x078c +#define UW_EC_REG_KBD_BL_STATUS_BIT_WHITE_ONLY_KB 0x01 +#define UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET 0x10 + +#define UW_EC_REG_KBD_BL_MAX_BRIGHTNESS 0x1801 +#define UW_EC_REG_KBD_BL_WHITE_BRIGHTNESS 0x1802 +#define UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS 0x1803 +#define UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS 0x1805 +#define UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS 0x1808 + +#define UW_EC_REG_BAREBONE_ID 0x0740 +#define UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx 0x09 +#define UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx 0x0e +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TRX1 0x12 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TUX1 0x13 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 0x14 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 0x15 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx 0x16 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx 0x17 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx 0x18 + +#define UW_EC_REG_FEATURES_0 0x0765 +#define UW_EC_REG_FEATURES_1 0x0766 +#define UW_EC_REG_FEATURES_1_BIT_1_ZONE_RGB_KB 0x04 + +#define UW_EC_REG_ROMID_START 0x0770 +#define UW_EC_REG_ROMID_SPECIAL_1 0x077e +#define UW_EC_REG_ROMID_SPECIAL_2 0x077f + +struct uniwill_interface_t { + char *string_id; + uniwill_event_callb_t *event_callb; + uniwill_read_ec_ram_t *read_ec_ram; + uniwill_write_ec_ram_t *write_ec_ram; +}; + +int uniwill_add_interface(struct uniwill_interface_t *new_interface); +int uniwill_remove_interface(struct uniwill_interface_t *interface); +uniwill_read_ec_ram_t uniwill_read_ec_ram; +uniwill_write_ec_ram_t uniwill_write_ec_ram; +uniwill_write_ec_ram_with_retry_t uniwill_write_ec_ram_with_retry; +uniwill_read_ec_ram_with_retry_t uniwill_read_ec_ram_with_retry; +int uniwill_get_active_interface_id(char **id_str); + +#define UW_MODEL_PF5LUXG 0x09 +#define UW_MODEL_PH4TUX 0x13 +#define UW_MODEL_PH4TRX 0x12 +#define UW_MODEL_PH4TQF 0x14 +#define UW_MODEL_PH4AQF_ARX 0x17 + +struct uniwill_device_features_t { + u8 model; + /** + * Identification for uniwill_power_profile_v1 + * + * - Two profiles present in low power devices often called + * "power save" and "balanced". + * - Three profiles present mainly in devices with discrete + * graphics card often called "power save", "balanced" + * and "enthusiast" + */ + bool uniwill_profile_v1; + bool uniwill_profile_v1_two_profs; + bool uniwill_profile_v1_three_profs; + bool uniwill_profile_v1_three_profs_leds_only; + bool uniwill_has_charging_prio; + bool uniwill_has_charging_profile; + bool uniwill_has_universal_ec_fan_control; +}; + +struct uniwill_device_features_t *uniwill_get_device_features(void); + +union uw_ec_read_return { + u32 dword; + struct { + u8 data_low; + u8 data_high; + } bytes; +}; + +union uw_ec_write_return { + u32 dword; + struct { + u8 addr_low; + u8 addr_high; + u8 data_low; + u8 data_high; + } bytes; +}; + +#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_keyboard.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_keyboard.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_keyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_keyboard.h 2023-10-07 05:59:51.000000000 +0000 @@ -0,0 +1,1275 @@ +/*! + * Copyright (c) 2020-2021 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#ifndef UNIWILL_KEYBOARD_H +#define UNIWILL_KEYBOARD_H + +#include "clevo_keyboard_common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "uniwill_interfaces.h" +#include "uniwill_leds.h" + +#define UNIWILL_OSD_RADIOON 0x01A +#define UNIWILL_OSD_RADIOOFF 0x01B +#define UNIWILL_OSD_KB_LED_LEVEL0 0x03B +#define UNIWILL_OSD_KB_LED_LEVEL1 0x03C +#define UNIWILL_OSD_KB_LED_LEVEL2 0x03D +#define UNIWILL_OSD_KB_LED_LEVEL3 0x03E +#define UNIWILL_OSD_KB_LED_LEVEL4 0x03F +#define UNIWILL_OSD_DC_ADAPTER_CHANGE 0x0AB +#define UNIWILL_OSD_MODE_CHANGE_KEY_EVENT 0x0B0 + +#define UNIWILL_KEY_RFKILL 0x0A4 +#define UNIWILL_KEY_KBDILLUMDOWN 0x0B1 +#define UNIWILL_KEY_KBDILLUMUP 0x0B2 +#define UNIWILL_KEY_KBDILLUMTOGGLE 0x0B9 + +#define UNIWILL_OSD_TOUCHPADWORKAROUND 0xFFF + +static void uw_charging_priority_write_state(void); +static void uw_charging_profile_write_state(void); + +struct tuxedo_keyboard_driver uniwill_keyboard_driver; + +struct uniwill_device_features_t uniwill_device_features; + +static bool uw_feats_loaded = false; + +static u8 uniwill_kbd_bl_enable_state_on_start; + +static struct key_entry uniwill_wmi_keymap[] = { + // { KE_KEY, UNIWILL_OSD_RADIOON, { KEY_RFKILL } }, + // { KE_KEY, UNIWILL_OSD_RADIOOFF, { KEY_RFKILL } }, + // { KE_KEY, 0xb0, { KEY_F13 } }, + // Manual mode rfkill + { KE_KEY, UNIWILL_KEY_RFKILL, { KEY_RFKILL }}, + { KE_KEY, UNIWILL_OSD_TOUCHPADWORKAROUND, { KEY_F21 } }, + // Keyboard brightness + { KE_KEY, UNIWILL_KEY_KBDILLUMDOWN, { KEY_KBDILLUMDOWN } }, + { KE_KEY, UNIWILL_KEY_KBDILLUMUP, { KEY_KBDILLUMUP } }, + { KE_KEY, UNIWILL_KEY_KBDILLUMTOGGLE, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL0, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL1, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL2, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL3, { KEY_KBDILLUMTOGGLE } }, + { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL4, { KEY_KBDILLUMTOGGLE } }, + // Only used to put ev bits + { KE_KEY, 0xffff, { KEY_F6 } }, + { KE_KEY, 0xffff, { KEY_LEFTALT } }, + { KE_KEY, 0xffff, { KEY_LEFTMETA } }, + { KE_END, 0 } +}; + +static struct uniwill_interfaces_t { + struct uniwill_interface_t *wmi; +} uniwill_interfaces = { .wmi = NULL }; + +uniwill_event_callb_t uniwill_event_callb; + +int uniwill_read_ec_ram(u16 address, u8 *data) +{ + int status; + + if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) + status = uniwill_interfaces.wmi->read_ec_ram(address, data); + else { + pr_err("no active interface while read addr 0x%04x\n", address); + status = -EIO; + } + + return status; +} +EXPORT_SYMBOL(uniwill_read_ec_ram); + +int uniwill_read_ec_ram_with_retry(u16 address, u8 *data, int retries) +{ + int status, i; + + for (i = 0; i < retries; ++i) { + status = uniwill_read_ec_ram(address, data); + if (status != 0) + pr_debug("uniwill_read_ec_ram(...) failed.\n"); + else + break; + } + + return status; +} +EXPORT_SYMBOL(uniwill_read_ec_ram_with_retry); + +int uniwill_write_ec_ram(u16 address, u8 data) +{ + int status; + + if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) + status = uniwill_interfaces.wmi->write_ec_ram(address, data); + else { + pr_err("no active interface while write addr 0x%04x data 0x%02x\n", address, data); + status = -EIO; + } + + return status; +} +EXPORT_SYMBOL(uniwill_write_ec_ram); + +int uniwill_write_ec_ram_with_retry(u16 address, u8 data, int retries) +{ + int status, i; + u8 control_data; + + for (i = 0; i < retries; ++i) { + status = uniwill_write_ec_ram(address, data); + if (status != 0) { + msleep(50); + continue; + } + else { + status = uniwill_read_ec_ram(address, &control_data); + if (status != 0 || data != control_data) { + msleep(50); + continue; + } + break; + } + } + + return status; +} +EXPORT_SYMBOL(uniwill_write_ec_ram_with_retry); + +static DEFINE_MUTEX(uniwill_interface_modification_lock); + +int uniwill_add_interface(struct uniwill_interface_t *interface) +{ + mutex_lock(&uniwill_interface_modification_lock); + + if (strcmp(interface->string_id, UNIWILL_INTERFACE_WMI_STRID) == 0) + uniwill_interfaces.wmi = interface; + else { + TUXEDO_DEBUG("trying to add unknown interface\n"); + mutex_unlock(&uniwill_interface_modification_lock); + return -EINVAL; + } + interface->event_callb = uniwill_event_callb; + + mutex_unlock(&uniwill_interface_modification_lock); + + // Initialize driver if not already present + tuxedo_keyboard_init_driver(&uniwill_keyboard_driver); + + return 0; +} +EXPORT_SYMBOL(uniwill_add_interface); + +int uniwill_remove_interface(struct uniwill_interface_t *interface) +{ + mutex_lock(&uniwill_interface_modification_lock); + + if (strcmp(interface->string_id, UNIWILL_INTERFACE_WMI_STRID) == 0) { + // Remove driver if last interface is removed + tuxedo_keyboard_remove_driver(&uniwill_keyboard_driver); + + uniwill_interfaces.wmi = NULL; + } else { + mutex_unlock(&uniwill_interface_modification_lock); + return -EINVAL; + } + + mutex_unlock(&uniwill_interface_modification_lock); + + return 0; +} +EXPORT_SYMBOL(uniwill_remove_interface); + +int uniwill_get_active_interface_id(char **id_str) +{ + if (IS_ERR_OR_NULL(uniwill_interfaces.wmi)) + return -ENODEV; + + if (!IS_ERR_OR_NULL(id_str)) + *id_str = uniwill_interfaces.wmi->string_id; + + return 0; +} +EXPORT_SYMBOL(uniwill_get_active_interface_id); + +static void key_event_work(struct work_struct *work) +{ + sparse_keymap_report_known_event( + uniwill_keyboard_driver.input_device, + UNIWILL_OSD_TOUCHPADWORKAROUND, + 1, + true + ); +} + +// Previous key codes for detecting longer combination +static u32 prev_key = 0, prevprev_key = 0; +static DECLARE_WORK(uniwill_key_event_work, key_event_work); + +static int keyboard_notifier_callb(struct notifier_block *nb, unsigned long code, void *_param) +{ + struct keyboard_notifier_param *param = _param; + int ret = NOTIFY_OK; + + if (!param->down) { + if (code == KBD_KEYCODE) { + switch (param->value) { + case KEY_LEFTMETA: + // If the last keys up were 85 -> 29 -> 125 + // manually report KEY_F21 + if (prevprev_key == KEY_ZENKAKUHANKAKU && prev_key == KEY_LEFTCTRL) { + TUXEDO_DEBUG("Touchpad Toggle\n"); + schedule_work(&uniwill_key_event_work); + ret = NOTIFY_OK; + } + break; + } + prevprev_key = prev_key; + prev_key = param->value; + } + } + + return ret; +} + +static struct notifier_block keyboard_notifier_block = { + .notifier_call = keyboard_notifier_callb +}; + +static void uniwill_write_kbd_bl_enable(u8 enable) +{ + u8 backlight_data; + enable = enable & 0x01; + + uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &backlight_data); + backlight_data = backlight_data & ~(1 << 1); + backlight_data |= (!enable << 1); + uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, backlight_data); +} + +void uniwill_event_callb(u32 code) +{ + switch (code) { + case UNIWILL_OSD_MODE_CHANGE_KEY_EVENT: + // Special key combination when mode change key is pressed (the one next to + // the power key). Opens TCC by default when installed. + input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTMETA, 1); + input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTALT, 1); + input_report_key(uniwill_keyboard_driver.input_device, KEY_F6, 1); + input_sync(uniwill_keyboard_driver.input_device); + input_report_key(uniwill_keyboard_driver.input_device, KEY_F6, 0); + input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTALT, 0); + input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTMETA, 0); + input_sync(uniwill_keyboard_driver.input_device); + break; + case UNIWILL_OSD_DC_ADAPTER_CHANGE: + // Refresh keyboard state and charging prio on cable switch event + uniwill_leds_restore_state_extern(); + msleep(50); + uw_charging_priority_write_state(); + break; + case UNIWILL_KEY_KBDILLUMTOGGLE: + case UNIWILL_OSD_KB_LED_LEVEL0: + case UNIWILL_OSD_KB_LED_LEVEL1: + case UNIWILL_OSD_KB_LED_LEVEL2: + case UNIWILL_OSD_KB_LED_LEVEL3: + case UNIWILL_OSD_KB_LED_LEVEL4: + // Notify userspace/UPower that the firmware changed the keyboard backlight + // brightness on white only keyboards. Fallthrough on other keyboards to + // emit KEY_KBDILLUMTOGGLE. + if (uniwill_leds_notify_brightness_change_extern()) + return; + fallthrough; + default: + if (uniwill_keyboard_driver.input_device != NULL) + if (!sparse_keymap_report_known_event(uniwill_keyboard_driver.input_device, code, 1, true)) + TUXEDO_DEBUG("Unknown code - %d (%0#6x)\n", code, code); + } +} + +static void uw_kbd_bl_init_set(struct platform_device *dev) +{ + uniwill_leds_init_late(dev); + uniwill_write_kbd_bl_enable(1); +} + +// Keep track of previous colors on start, init array with different non-colors +static u32 uw_prev_colors[] = {0x01000000, 0x02000000, 0x03000000}; +static u32 uw_prev_colors_size = 3; +static u32 uw_prev_colors_index = 0; + +// Timer for checking animation colors +static struct timer_list uw_kbd_bl_init_timer; +static volatile int uw_kbd_bl_check_count = 40; +static int uw_kbd_bl_init_check_interval_ms = 500; + +static int uniwill_read_kbd_bl_rgb(u8 *red, u8 *green, u8 *blue) +{ + int result = 0; + + result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS, red); + if (result) { + return result; + } + result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS, green); + if (result) { + return result; + } + result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, blue); + if (result) { + return result; + } + + return result; +} + +static struct platform_device *uw_kbd_bl_init_ready_check_work_func_args_dev; + +static void uw_kbd_bl_init_ready_check_work_func(struct work_struct *work) +{ + u8 uw_cur_red, uw_cur_green, uw_cur_blue; + int i; + bool prev_colors_same; + uniwill_read_kbd_bl_rgb(&uw_cur_red, &uw_cur_green, &uw_cur_blue); + uw_prev_colors[uw_prev_colors_index] = (uw_cur_red << 0x10) | (uw_cur_green << 0x08) | uw_cur_blue; + uw_prev_colors_index = (uw_prev_colors_index + 1) % uw_prev_colors_size; + + prev_colors_same = true; + for (i = 1; i < uw_prev_colors_size; ++i) { + if (uw_prev_colors[i-1] != uw_prev_colors[i]) prev_colors_same = false; + } + + if (prev_colors_same) { + uw_kbd_bl_init_set(uw_kbd_bl_init_ready_check_work_func_args_dev); + del_timer(&uw_kbd_bl_init_timer); + } else { + if (uw_kbd_bl_check_count != 0) { + mod_timer(&uw_kbd_bl_init_timer, jiffies + msecs_to_jiffies(uw_kbd_bl_init_check_interval_ms)); + } else { + TUXEDO_INFO("uw kbd init timeout, failed to detect end of boot animation\n"); + del_timer(&uw_kbd_bl_init_timer); + } + } + + uw_kbd_bl_check_count -= 1; +} + +static DECLARE_WORK(uw_kbd_bl_init_ready_check_work, uw_kbd_bl_init_ready_check_work_func); + +static void uw_kbd_bl_init_ready_check(struct timer_list *t) +{ + schedule_work(&uw_kbd_bl_init_ready_check_work); +} + +static int uw_kbd_bl_init(struct platform_device *dev) +{ + int status = 0; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + TUXEDO_ERROR("Warning: Kernel version less that 4.18, keyboard backlight might not be properly recognized."); +#endif + + uniwill_leds_init_early(dev); + + if (uniwill_leds_get_backlight_type() == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + // Start periodic checking of animation, set and enable bl when done + uw_kbd_bl_init_ready_check_work_func_args_dev = dev; + timer_setup(&uw_kbd_bl_init_timer, uw_kbd_bl_init_ready_check, 0); + mod_timer(&uw_kbd_bl_init_timer, jiffies + msecs_to_jiffies(uw_kbd_bl_init_check_interval_ms)); + } else { + // For non-RGB versions + // Enable keyboard backlight immediately (should it be disabled) + uniwill_write_kbd_bl_enable(1); + } + + return status; +} + +#define UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS 0x24 +#define UNIWILL_LIGHTBAR_LED_NAME_RGB_RED "lightbar_rgb:1:status" +#define UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN "lightbar_rgb:2:status" +#define UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE "lightbar_rgb:3:status" +#define UNIWILL_LIGHTBAR_LED_NAME_ANIMATION "lightbar_animation::status" + +static void uniwill_write_lightbar_rgb(u8 red, u8 green, u8 blue) +{ + if (red <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { + uniwill_write_ec_ram(0x0749, red); + } + if (green <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { + uniwill_write_ec_ram(0x074a, green); + } + if (blue <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { + uniwill_write_ec_ram(0x074b, blue); + } +} + +static void uniwill_read_lightbar_rgb(u8 *red, u8 *green, u8 *blue) +{ + uniwill_read_ec_ram(0x0749, red); + uniwill_read_ec_ram(0x074a, green); + uniwill_read_ec_ram(0x074b, blue); +} + +static void uniwill_write_lightbar_animation(bool animation_status) +{ + u8 value; + + uniwill_read_ec_ram(0x0748, &value); + if (animation_status) { + value |= 0x80; + } else { + value &= ~0x80; + } + uniwill_write_ec_ram(0x0748, value); +} + +static void uniwill_read_lightbar_animation(bool *animation_status) +{ + u8 lightbar_animation_data; + uniwill_read_ec_ram(0x0748, &lightbar_animation_data); + *animation_status = (lightbar_animation_data & 0x80) > 0; +} + +static int lightbar_set_blocking(struct led_classdev *led_cdev, enum led_brightness brightness) +{ + u8 red = 0xff, green = 0xff, blue = 0xff; + bool led_red = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_RED) != NULL; + bool led_green = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN) != NULL; + bool led_blue = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE) != NULL; + bool led_animation = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_ANIMATION) != NULL; + + if (led_red || led_green || led_blue) { + if (led_red) { + red = brightness; + } else if (led_green) { + green = brightness; + } else if (led_blue) { + blue = brightness; + } + uniwill_write_lightbar_rgb(red, green, blue); + // Also make sure the animation is off + uniwill_write_lightbar_animation(false); + } else if (led_animation) { + if (brightness == 1) { + uniwill_write_lightbar_animation(true); + } else { + uniwill_write_lightbar_animation(false); + } + } + return 0; +} + +static enum led_brightness lightbar_get(struct led_classdev *led_cdev) +{ + u8 red, green, blue; + bool animation_status; + bool led_red = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_RED) != NULL; + bool led_green = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN) != NULL; + bool led_blue = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE) != NULL; + bool led_animation = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_ANIMATION) != NULL; + + if (led_red || led_green || led_blue) { + uniwill_read_lightbar_rgb(&red, &green, &blue); + if (led_red) { + return red; + } else if (led_green) { + return green; + } else if (led_blue) { + return blue; + } + } else if (led_animation) { + uniwill_read_lightbar_animation(&animation_status); + return animation_status ? 1 : 0; + } + + return 0; +} + +static bool uw_lightbar_loaded; +static struct led_classdev lightbar_led_classdevs[] = { + { + .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_RED, + .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, + .brightness_set_blocking = &lightbar_set_blocking, + .brightness_get = &lightbar_get + }, + { + .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN, + .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, + .brightness_set_blocking = &lightbar_set_blocking, + .brightness_get = &lightbar_get + }, + { + .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE, + .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, + .brightness_set_blocking = &lightbar_set_blocking, + .brightness_get = &lightbar_get + }, + { + .name = UNIWILL_LIGHTBAR_LED_NAME_ANIMATION, + .max_brightness = 1, + .brightness_set_blocking = &lightbar_set_blocking, + .brightness_get = &lightbar_get + } +}; + +static int uw_lightbar_init(struct platform_device *dev) +{ + int i, j, status; + + bool lightbar_supported = false + || dmi_match(DMI_BOARD_NAME, "LAPQC71A") + || dmi_match(DMI_BOARD_NAME, "LAPQC71B") + || dmi_match(DMI_BOARD_NAME, "TRINITY1501I") + || dmi_match(DMI_BOARD_NAME, "TRINITY1701I") + || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") + || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") + +#endif + ; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + TUXEDO_ERROR( + "Warning: Kernel version less that 4.18, lightbar might not be properly recognized."); +#endif + + if (!lightbar_supported) + return -ENODEV; + + for (i = 0; i < ARRAY_SIZE(lightbar_led_classdevs); ++i) { + status = led_classdev_register(&dev->dev, &lightbar_led_classdevs[i]); + if (status < 0) { + for (j = 0; j < i; j++) + led_classdev_unregister(&lightbar_led_classdevs[j]); + return status; + } + } + + // Init default state + uniwill_write_lightbar_animation(false); + uniwill_write_lightbar_rgb(0, 0, 0); + + return 0; +} + +static int uw_lightbar_remove(struct platform_device *dev) +{ + int i; + for (i = 0; i < ARRAY_SIZE(lightbar_led_classdevs); ++i) { + led_classdev_unregister(&lightbar_led_classdevs[i]); + } + return 0; +} + +static bool uw_charging_prio_loaded = false; +static bool uw_charging_prio_last_written_value; + +static ssize_t uw_charging_prios_available_show(struct device *child, + struct device_attribute *attr, + char *buffer); +static ssize_t uw_charging_prio_show(struct device *child, + struct device_attribute *attr, char *buffer); +static ssize_t uw_charging_prio_store(struct device *child, + struct device_attribute *attr, + const char *buffer, size_t size); + +struct uw_charging_prio_attrs_t { + struct device_attribute charging_prios_available; + struct device_attribute charging_prio; +} uw_charging_prio_attrs = { + .charging_prios_available = __ATTR(charging_prios_available, 0444, uw_charging_prios_available_show, NULL), + .charging_prio = __ATTR(charging_prio, 0644, uw_charging_prio_show, uw_charging_prio_store) +}; + +static struct attribute *uw_charging_prio_attrs_list[] = { + &uw_charging_prio_attrs.charging_prios_available.attr, + &uw_charging_prio_attrs.charging_prio.attr, + NULL +}; + +static struct attribute_group uw_charging_prio_attr_group = { + .name = "charging_priority", + .attrs = uw_charging_prio_attrs_list +}; + +/* + * charging_prio values + * 0 => charging priority + * 1 => performance priority + */ +static int uw_set_charging_priority(u8 charging_priority) +{ + u8 previous_data, next_data; + int result; + + charging_priority = (charging_priority & 0x01) << 7; + + result = uniwill_read_ec_ram(0x07cc, &previous_data); + if (result != 0) + return result; + + next_data = (previous_data & ~(1 << 7)) | charging_priority; + result = uniwill_write_ec_ram(0x07cc, next_data); + if (result == 0) + uw_charging_prio_last_written_value = charging_priority; + + return result; +} + +static int uw_get_charging_priority(u8 *charging_priority) +{ + int result = uniwill_read_ec_ram(0x07cc, charging_priority); + *charging_priority = (*charging_priority >> 7) & 0x01; + return result; +} + +static int uw_has_charging_priority(bool *status) +{ + u8 data; + int result; + + bool not_supported_device = false + || dmi_match(DMI_BOARD_NAME, "PF5PU1G") + || dmi_match(DMI_BOARD_NAME, "LAPQC71A") + || dmi_match(DMI_BOARD_NAME, "LAPQC71B") + || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") + ; + + if (not_supported_device) { + *status = false; + return 0; + } + + result = uniwill_read_ec_ram(0x0742, &data); + if (result != 0) + return -EIO; + + if (data & (1 << 5)) + *status = true; + else + *status = false; + + return 0; +} + +static void uw_charging_priority_write_state(void) +{ + if (uw_charging_prio_loaded) + uw_set_charging_priority(uw_charging_prio_last_written_value); +} + +static void uw_charging_priority_init(struct platform_device *dev) +{ + u8 value; + struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + + if (uw_feats->uniwill_has_charging_prio) + uw_charging_prio_loaded = sysfs_create_group(&dev->dev.kobj, &uw_charging_prio_attr_group) == 0; + + // Read for state init + if (uw_charging_prio_loaded) { + uw_get_charging_priority(&value); + uw_charging_prio_last_written_value = value; + } +} + +static bool uw_charging_profile_loaded = false; +static bool uw_charging_profile_last_written_value; + +static ssize_t uw_charging_profiles_available_show(struct device *child, + struct device_attribute *attr, + char *buffer); +static ssize_t uw_charging_profile_show(struct device *child, + struct device_attribute *attr, char *buffer); +static ssize_t uw_charging_profile_store(struct device *child, + struct device_attribute *attr, + const char *buffer, size_t size); + +struct uw_charging_profile_attrs_t { + struct device_attribute charging_profiles_available; + struct device_attribute charging_profile; +} uw_charging_profile_attrs = { + .charging_profiles_available = __ATTR(charging_profiles_available, 0444, uw_charging_profiles_available_show, NULL), + .charging_profile = __ATTR(charging_profile, 0644, uw_charging_profile_show, uw_charging_profile_store) +}; + +static struct attribute *uw_charging_profile_attrs_list[] = { + &uw_charging_profile_attrs.charging_profiles_available.attr, + &uw_charging_profile_attrs.charging_profile.attr, + NULL +}; + +static struct attribute_group uw_charging_profile_attr_group = { + .name = "charging_profile", + .attrs = uw_charging_profile_attrs_list +}; + +/* + * charging_profile values + * 0 => high capacity + * 1 => balanced + * 2 => stationary + */ +static int uw_set_charging_profile(u8 charging_profile) +{ + u8 previous_data, next_data; + int result; + + charging_profile = (charging_profile & 0x03) << 4; + + result = uniwill_read_ec_ram(0x07a6, &previous_data); + if (result != 0) + return result; + + next_data = (previous_data & ~(0x03 << 4)) | charging_profile; + result = uniwill_write_ec_ram(0x07a6, next_data); + + if (result == 0) + uw_charging_profile_last_written_value = charging_profile; + + return result; +} + +static int uw_get_charging_profile(u8 *charging_profile) +{ + int result = uniwill_read_ec_ram(0x07a6, charging_profile); + if (result == 0) + *charging_profile = (*charging_profile >> 4) & 0x03; + return result; +} + +static int uw_has_charging_profile(bool *status) +{ + u8 data; + int result; + + bool not_supported_device = false + || dmi_match(DMI_BOARD_NAME, "PF5PU1G") + || dmi_match(DMI_BOARD_NAME, "LAPQC71A") + || dmi_match(DMI_BOARD_NAME, "LAPQC71B") + || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") + ; + + if (not_supported_device) { + *status = false; + return 0; + } + + result = uniwill_read_ec_ram(0x078e, &data); + if (result != 0) + return -EIO; + + if (data & (1 << 3)) + *status = true; + else + *status = false; + + return 0; +} + +static void __attribute__ ((unused)) uw_charging_profile_write_state(void) +{ + if (uw_charging_profile_loaded) + uw_set_charging_profile(uw_charging_profile_last_written_value); +} + +static void uw_charging_profile_init(struct platform_device *dev) +{ + u8 value; + struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + + if (uw_feats->uniwill_has_charging_profile) + uw_charging_profile_loaded = sysfs_create_group(&dev->dev.kobj, &uw_charging_profile_attr_group) == 0; + + // Read for state init + if (uw_charging_profile_loaded) { + uw_get_charging_profile(&value); + uw_charging_profile_last_written_value = value; + } +} + +struct char_to_u8_t { + char* descriptor; + u8 value; +}; + +static struct char_to_u8_t charging_profile_options[] = { + { .descriptor = "high_capacity", .value = 0x00 }, + { .descriptor = "balanced", .value = 0x01 }, + { .descriptor = "stationary", .value = 0x02 } +}; + +static ssize_t uw_charging_profiles_available_show(struct device *child, + struct device_attribute *attr, + char *buffer) +{ + int i, n; + n = ARRAY_SIZE(charging_profile_options); + for (i = 0; i < n; ++i) { + sprintf(buffer + strlen(buffer), "%s", + charging_profile_options[i].descriptor); + if (i < n - 1) + sprintf(buffer + strlen(buffer), " "); + else + sprintf(buffer + strlen(buffer), "\n"); + } + + return strlen(buffer); +} + +static ssize_t uw_charging_profile_show(struct device *child, + struct device_attribute *attr, char *buffer) +{ + u8 charging_profile_value; + int i, result; + + result = uw_get_charging_profile(&charging_profile_value); + if (result != 0) + return result; + + for (i = 0; i < ARRAY_SIZE(charging_profile_options); ++i) + if (charging_profile_options[i].value == charging_profile_value) { + sprintf(buffer, "%s\n", charging_profile_options[i].descriptor); + return strlen(buffer); + } + + pr_err("Read charging profile value not matched to a descriptor\n"); + + return -EIO; +} + +static ssize_t uw_charging_profile_store(struct device *child, + struct device_attribute *attr, + const char *buffer, size_t size) +{ + u8 charging_profile_value; + int i, result; + char *buffer_copy; + char *charging_profile_descriptor; + buffer_copy = kmalloc(size + 1, GFP_KERNEL); + strcpy(buffer_copy, buffer); + charging_profile_descriptor = strstrip(buffer_copy); + + for (i = 0; i < ARRAY_SIZE(charging_profile_options); ++i) + if (strcmp(charging_profile_options[i].descriptor, charging_profile_descriptor) == 0) { + charging_profile_value = charging_profile_options[i].value; + break; + } + + kfree(buffer_copy); + + if (i < ARRAY_SIZE(charging_profile_options)) { + // Option found try to set + result = uw_set_charging_profile(charging_profile_value); + if (result == 0) + return size; + else + return -EIO; + } else + // Invalid input, not matched to an option + return -EINVAL; +} + +static struct char_to_u8_t charging_prio_options[] = { + { .descriptor = "charge_battery", .value = 0x00 }, + { .descriptor = "performance", .value = 0x01 } +}; + +static ssize_t uw_charging_prios_available_show(struct device *child, + struct device_attribute *attr, + char *buffer) +{ + int i, n; + n = ARRAY_SIZE(charging_prio_options); + for (i = 0; i < n; ++i) { + sprintf(buffer + strlen(buffer), "%s", + charging_prio_options[i].descriptor); + if (i < n - 1) + sprintf(buffer + strlen(buffer), " "); + else + sprintf(buffer + strlen(buffer), "\n"); + } + + return strlen(buffer); +} + +static ssize_t uw_charging_prio_show(struct device *child, + struct device_attribute *attr, char *buffer) +{ + u8 charging_prio_value; + int i, result; + + result = uw_get_charging_priority(&charging_prio_value); + if (result != 0) + return result; + + for (i = 0; i < ARRAY_SIZE(charging_prio_options); ++i) + if (charging_prio_options[i].value == charging_prio_value) { + sprintf(buffer, "%s\n", charging_prio_options[i].descriptor); + return strlen(buffer); + } + + pr_err("Read charging prio value not matched to a descriptor\n"); + + return -EIO; +} + +static ssize_t uw_charging_prio_store(struct device *child, + struct device_attribute *attr, + const char *buffer, size_t size) +{ + u8 charging_prio_value; + int i, result; + char *buffer_copy; + char *charging_prio_descriptor; + buffer_copy = kmalloc(size + 1, GFP_KERNEL); + strcpy(buffer_copy, buffer); + charging_prio_descriptor = strstrip(buffer_copy); + + for (i = 0; i < ARRAY_SIZE(charging_prio_options); ++i) + if (strcmp(charging_prio_options[i].descriptor, charging_prio_descriptor) == 0) { + charging_prio_value = charging_prio_options[i].value; + break; + } + + kfree(buffer_copy); + + if (i < ARRAY_SIZE(charging_prio_options)) { + // Option found try to set + result = uw_set_charging_priority(charging_prio_value); + if (result == 0) + return size; + else + return -EIO; + } else + // Invalid input, not matched to an option + return -EINVAL; +} + +static const u8 uw_romid_PH4PxX[14] = {0x0C, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +static const u8 uw_romid_PH6PxX[14] = {0x0C, 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + +static const struct dmi_system_id uw_sku_romid_table[] = { + // IBPG8 mk1 + // Logic: If product serial matches 16inch use that, else default to 14inch + { + .matches = { + DMI_MATCH(DMI_PRODUCT_SKU, "IBP1XI08MK1"), + DMI_MATCH(DMI_PRODUCT_SERIAL, "PH6PRX"), + }, + .driver_data = (void *)&uw_romid_PH6PxX + }, + { + .matches = { + DMI_MATCH(DMI_PRODUCT_SKU, "IBP1XI08MK1"), + }, + .driver_data = (void *)&uw_romid_PH4PxX + }, + // IBP16G8 mk2 + { + .matches = { + DMI_MATCH(DMI_PRODUCT_SKU, "IBP1XI08MK2"), + DMI_MATCH(DMI_PRODUCT_SERIAL, "PH6"), + }, + .driver_data = (void *)&uw_romid_PH6PxX + }, + {} +}; + +static int set_rom_id(void) { + int i, ret; + const struct dmi_system_id *uw_sku_romid; + const u8 *romid; + u8 data; + bool romid_false = false; + + uw_sku_romid = dmi_first_match(uw_sku_romid_table); + if (!uw_sku_romid) + return 0; + + romid = (const u8 *)uw_sku_romid->driver_data; + pr_debug("ROMID 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", + romid[0], romid[1], romid[2], romid[3], romid[4], romid[5], romid[6], romid[7], + romid[8], romid[9], romid[10], romid[11], romid[12], romid[13]); + + for (i = 0; i < 14; ++i) { + ret = uniwill_read_ec_ram_with_retry(UW_EC_REG_ROMID_START + i, &data, 3); + if (ret) { + pr_debug("uniwill_read_ec_ram_with_retry(...) failed.\n"); + return ret; + } + pr_debug("ROMID index: %d, expected value: 0x%02X, actual value: 0x%02X\n", i, romid[i], data); + if (data != romid[i]) { + pr_debug("ROMID is false. Correcting...\n"); + romid_false = true; + break; + } + } + + if (romid_false) { + ret = uniwill_write_ec_ram_with_retry(UW_EC_REG_ROMID_SPECIAL_1, 0xA5, 3); + if (ret) { + pr_debug("uniwill_write_ec_ram_with_retry(...) failed.\n"); + return ret; + } + ret = uniwill_write_ec_ram_with_retry(UW_EC_REG_ROMID_SPECIAL_2, 0x78, 3); + if (ret) { + pr_debug("uniwill_write_ec_ram_with_retry(...) failed.\n"); + return ret; + } + for (i = 0; i < 14; ++i) { + ret = uniwill_write_ec_ram_with_retry(UW_EC_REG_ROMID_START + i, romid[i], 3); + if (ret) { + pr_debug("uniwill_write_ec_ram_with_retry(...) failed.\n"); + return ret; + } + } + } + else + pr_debug("ROMID is correct.\n"); + + return 0; +} + +static int has_universal_ec_fan_control(void) { + int ret; + u8 data; + + struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + + if (uw_feats->model == UW_MODEL_PH4TRX) { + // For some reason, on this particular device, the 2nd fan is not controlled via the + // "GPU" fan curve when the bit to separate both fancurves is set, but the old fan + // control works just fine. + return 0; + } + + ret = uniwill_read_ec_ram(0x078e, &data); + if (ret < 0) { + return ret; + } + return (data >> 6) & 1; +} + +struct uniwill_device_features_t *uniwill_get_device_features(void) +{ + struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + u32 status; + int result; + bool feats_loaded; + + if (uw_feats_loaded) + return uw_feats; + + feats_loaded = true; + + status = uniwill_read_ec_ram(0x0740, &uw_feats->model); + if (status != 0) { + uw_feats->model = 0; + feats_loaded = false; + } + + uw_feats->uniwill_profile_v1_two_profs = false + || dmi_match(DMI_BOARD_NAME, "PF5PU1G") + || dmi_match(DMI_BOARD_NAME, "PULSE1401") + || dmi_match(DMI_BOARD_NAME, "PULSE1501") + ; + + uw_feats->uniwill_profile_v1_three_profs = false + // Devices with "classic" profile support + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + // Note: XMG Fusion removed for now, seem to have + // neither same power profile control nor TDP set + //|| dmi_match(DMI_BOARD_NAME, "LAPQC71A") + //|| dmi_match(DMI_BOARD_NAME, "LAPQC71B") + //|| dmi_match(DMI_PRODUCT_NAME, "A60 MUV") + ; + + uw_feats->uniwill_profile_v1_three_profs_leds_only = false + // Devices where profile mainly controls power profile LED status +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") + || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") +#endif + ; + + uw_feats->uniwill_profile_v1 = + uw_feats->uniwill_profile_v1_two_profs || + uw_feats->uniwill_profile_v1_three_profs; + + if (uw_has_charging_priority(&uw_feats->uniwill_has_charging_prio) != 0) + feats_loaded = false; + if (uw_has_charging_profile(&uw_feats->uniwill_has_charging_profile) != 0) + feats_loaded = false; + + result = has_universal_ec_fan_control(); + if (result < 0) { + feats_loaded = false; + } else { + uw_feats->uniwill_has_universal_ec_fan_control = (result == 1); + } + + + if (feats_loaded) + pr_debug("feats loaded\n"); + else + pr_debug("feats not yet loaded\n"); + + uw_feats_loaded = feats_loaded; + + return uw_feats; +} +EXPORT_SYMBOL(uniwill_get_device_features); + +static int uniwill_keyboard_probe(struct platform_device *dev) +{ + u32 i; + u8 data; + int status; + struct uniwill_device_features_t *uw_feats; + + set_rom_id(); + + uw_feats = uniwill_get_device_features(); + + // FIXME Hard set balanced profile until we have implemented a way to + // switch it while tuxedo_io is loaded + // uw_ec_write_addr(0x51, 0x07, 0x00, 0x00, ®_write_return); + uniwill_write_ec_ram(0x0751, 0x00); + + if (uw_feats->uniwill_profile_v1) { + // Set manual-mode fan-curve in 0x0743 - 0x0747 + // Some kind of default fan-curve is stored in 0x0786 - 0x078a: Using it to initialize manual-mode fan-curve + for (i = 0; i < 5; ++i) { + uniwill_read_ec_ram(0x0786 + i, &data); + uniwill_write_ec_ram(0x0743 + i, data); + } + } + else { + // Activate NVIDIA Dynamic Boost + uniwill_write_ec_ram(0x0746, 0x19); + uniwill_write_ec_ram(0x0745, 0x23); + uniwill_write_ec_ram(0x0743, 0x03); + } + + // Enable manual mode + uniwill_write_ec_ram(0x0741, 0x01); + + // Zero second fan temp for detection + uniwill_write_ec_ram(0x044f, 0x00); + + status = register_keyboard_notifier(&keyboard_notifier_block); + + uw_kbd_bl_init(dev); + + status = uw_lightbar_init(dev); + uw_lightbar_loaded = (status >= 0); + + uw_charging_priority_init(dev); + uw_charging_profile_init(dev); + + return 0; +} + +static int uniwill_keyboard_remove(struct platform_device *dev) +{ + if (uw_charging_prio_loaded) + sysfs_remove_group(&dev->dev.kobj, &uw_charging_prio_attr_group); + + if (uw_charging_profile_loaded) + sysfs_remove_group(&dev->dev.kobj, &uw_charging_profile_attr_group); + + uniwill_leds_remove(dev); + + // Restore previous backlight enable state + if (uniwill_kbd_bl_enable_state_on_start != 0xff) { + uniwill_write_kbd_bl_enable(uniwill_kbd_bl_enable_state_on_start); + } + + unregister_keyboard_notifier(&keyboard_notifier_block); + + del_timer(&uw_kbd_bl_init_timer); + + if (uw_lightbar_loaded) + uw_lightbar_remove(dev); + + // Disable manual mode + uniwill_write_ec_ram(0x0741, 0x00); + + return 0; +} + +static int uniwill_keyboard_suspend(struct platform_device *dev, pm_message_t state) +{ + uniwill_write_kbd_bl_enable(0); + return 0; +} + +static int uniwill_keyboard_resume(struct platform_device *dev) +{ + uniwill_leds_restore_state_extern(); + uniwill_write_kbd_bl_enable(1); + return 0; +} + +static struct platform_driver platform_driver_uniwill = { + .remove = uniwill_keyboard_remove, + .suspend = uniwill_keyboard_suspend, + .resume = uniwill_keyboard_resume, + .driver = + { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, +}; + +struct tuxedo_keyboard_driver uniwill_keyboard_driver = { + .platform_driver = &platform_driver_uniwill, + .probe = uniwill_keyboard_probe, + .key_map = uniwill_wmi_keymap, +}; + +#endif // UNIWILL_KEYBOARD_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_leds.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_leds.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_leds.h 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_leds.h 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,355 @@ +/*! + * Copyright (c) 2018-2020 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ + +#ifndef UNIWILL_LEDS_H +#define UNIWILL_LEDS_H + +#include +#include +#include +#include + +enum uniwill_kb_backlight_types { + UNIWILL_KB_BACKLIGHT_TYPE_NONE, + UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR, + UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB, + UNIWILL_KB_BACKLIGHT_TYPE_PER_KEY_RGB +}; + +#define UNIWILL_KBD_BRIGHTNESS_MAX 0xff +#define UNIWILL_KBD_BRIGHTNESS_DEFAULT 0x00 + +#define UNIWILL_KBD_BRIGHTNESS_WHITE_MAX 0x02 +#define UNIWILL_KBD_BRIGHTNESS_WHITE_DEFAULT 0x00 + +#define UNIWILL_KB_COLOR_DEFAULT_RED 0xff +#define UNIWILL_KB_COLOR_DEFAULT_GREEN 0xff +#define UNIWILL_KB_COLOR_DEFAULT_BLUE 0xff +#define UNIWILL_KB_COLOR_DEFAULT ((UNIWILL_KB_COLOR_DEFAULT_RED << 16) + (UNIWILL_KB_COLOR_DEFAULT_GREEN << 8) + UNIWILL_KB_COLOR_DEFAULT_BLUE) + +int uniwill_leds_init_early(struct platform_device *dev); +int uniwill_leds_init_late(struct platform_device *dev); +int uniwill_leds_remove(struct platform_device *dev); +enum uniwill_kb_backlight_types uniwill_leds_get_backlight_type(void); +int uniwill_leds_notify_brightness_change_extern(void); +void uniwill_leds_restore_state_extern(void); +void uniwill_leds_set_brightness_extern(enum led_brightness brightness); +void uniwill_leds_set_color_extern(u32 color); + +// TODO The following should go into a seperate .c file, but for this to work more reworking is required in the tuxedo_keyboard structure. + +#include "uniwill_leds.h" + +#include "uniwill_interfaces.h" + +#include + +static enum uniwill_kb_backlight_types uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_NONE; +static bool uw_leds_initialized = false; + +static int uniwill_write_kbd_bl_white(u8 brightness) +{ + u8 data; + + uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, &data); + // When keyboard backlight is off, new settings to 0x078c do not get applied automatically + // on Pulse Gen1/2 until next keypress or manual change to 0x1808 (immediate brightness + // value for some reason. + // Sidenote: IBP Gen6/7 has immediate brightness value on 0x1802 and not on 0x1808, but does + // not need this workaround. + if (!data && brightness) { + uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, 0x01); + } + + data = 0; + uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); + data &= 0x0f; // lower bits must be preserved + data |= UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET; + data |= brightness << 5; + return uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, data); +} + +static int uniwill_write_kbd_bl_rgb(u8 red, u8 green, u8 blue) +{ + int result = 0; + + result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS, red); + if (result) { + return result; + } + result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS, green); + if (result) { + return result; + } + result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, blue); + if (result) { + return result; + } + + pr_debug("Wrote kbd color [%0#4x, %0#4x, %0#4x]\n", red, green, blue); + + return result; +} + +static void uniwill_leds_set_brightness(struct led_classdev *led_cdev __always_unused, enum led_brightness brightness) { + int ret = uniwill_write_kbd_bl_white(brightness); + if (ret) { + pr_debug("uniwill_leds_set_brightness(): uniwill_write_kbd_bl_white() failed\n"); + return; + } + led_cdev->brightness = brightness; +} + +static void uniwill_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { + int ret; + struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); + + led_mc_calc_color_components(mcled_cdev, brightness); + + ret = uniwill_write_kbd_bl_rgb(mcled_cdev->subled_info[0].brightness, + mcled_cdev->subled_info[1].brightness, + mcled_cdev->subled_info[2].brightness); + if (ret) { + pr_debug("uniwill_leds_set_brightness_mc(): uniwill_write_kbd_bl_rgb() failed\n"); + return; + } + led_cdev->brightness = brightness; +} + +static struct led_classdev uniwill_led_cdev = { + .name = "white:" LED_FUNCTION_KBD_BACKLIGHT, + .max_brightness = UNIWILL_KBD_BRIGHTNESS_WHITE_MAX, + .brightness_set = &uniwill_leds_set_brightness, + .brightness = UNIWILL_KBD_BRIGHTNESS_WHITE_DEFAULT, + .flags = LED_BRIGHT_HW_CHANGED +}; + +static struct mc_subled uw_mcled_cdev_subleds[3] = { + { + .color_index = LED_COLOR_ID_RED, + .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, + .intensity = UNIWILL_KB_COLOR_DEFAULT_RED, + .channel = 0 + }, + { + .color_index = LED_COLOR_ID_GREEN, + .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, + .intensity = UNIWILL_KB_COLOR_DEFAULT_GREEN, + .channel = 0 + }, + { + .color_index = LED_COLOR_ID_BLUE, + .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, + .intensity = UNIWILL_KB_COLOR_DEFAULT_BLUE, + .channel = 0 + } +}; + +static struct led_classdev_mc uniwill_mcled_cdev = { + .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, + .led_cdev.max_brightness = UNIWILL_KBD_BRIGHTNESS_MAX, + .led_cdev.brightness_set = &uniwill_leds_set_brightness_mc, + .led_cdev.brightness = UNIWILL_KBD_BRIGHTNESS_DEFAULT, + .led_cdev.flags = LED_BRIGHT_HW_CHANGED, + .num_colors = 3, + .subled_info = uw_mcled_cdev_subleds +}; + +int uniwill_leds_init_early(struct platform_device *dev) +{ + // FIXME Use mutexes + int ret; + u8 data; + + ret = uniwill_read_ec_ram(UW_EC_REG_BAREBONE_ID, &data); + if (ret) { + pr_err("Reading barebone ID failed.\n"); + return ret; + } + pr_debug("EC Barebone ID: %#04x\n", data); + + if (data == UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx || + data == UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TRX1 || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TUX1 || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx) { + ret = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); + if (ret) { + pr_err("Reading keyboard backlight status failed.\n"); + return ret; + } + if (data & UW_EC_REG_KBD_BL_STATUS_BIT_WHITE_ONLY_KB) { + uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR; + } + } + else { + ret = uniwill_read_ec_ram(UW_EC_REG_FEATURES_1, &data); + if (ret) { + pr_err("Reading features 1 failed.\n"); + return ret; + } + if (data & UW_EC_REG_FEATURES_1_BIT_1_ZONE_RGB_KB) { + uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB; + } + } + pr_debug("Keyboard backlight type: 0x%02x\n", uniwill_kb_backlight_type); + + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + pr_debug("Registering fixed color leds interface\n"); + ret = led_classdev_register(&dev->dev, &uniwill_led_cdev); + if (ret) { + pr_err("Registering fixed color leds interface failed\n"); + return ret; + } + } + else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + pr_debug("Registering single zone rgb leds interface\n"); + ret = devm_led_classdev_multicolor_register(&dev->dev, &uniwill_mcled_cdev); + if (ret) { + pr_err("Registering single zone rgb leds interface failed\n"); + return ret; + } + } + + uw_leds_initialized = true; + return 0; +} +EXPORT_SYMBOL(uniwill_leds_init_early); + +int uniwill_leds_init_late(struct platform_device *dev) +{ + // FIXME Use mutexes + int ret; + + ret = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_MAX_BRIGHTNESS, 0xff); + if (ret) { + pr_err("Setting max keyboard brightness value failed\n"); + uniwill_leds_remove(dev); + return ret; + } + + uniwill_leds_restore_state_extern(); + + return 0; +} +EXPORT_SYMBOL(uniwill_leds_init_late); + +int uniwill_leds_remove(struct platform_device *dev) +{ + // FIXME Use mutexes + int ret = 0; + + if (uw_leds_initialized) { + uw_leds_initialized = false; + + uniwill_leds_set_brightness_extern(0x00); + ret = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_MAX_BRIGHTNESS, 0xc8); + if (ret) { + pr_err("Resetting max keyboard brightness value failed\n"); + } + + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + led_classdev_unregister(&uniwill_led_cdev); + } + else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + devm_led_classdev_multicolor_unregister(&dev->dev, &uniwill_mcled_cdev); + } + } + + return ret; +} +EXPORT_SYMBOL(uniwill_leds_remove); + +enum uniwill_kb_backlight_types uniwill_leds_get_backlight_type(void) { + return uniwill_kb_backlight_type; +} +EXPORT_SYMBOL(uniwill_leds_get_backlight_type); + +int uniwill_leds_notify_brightness_change_extern(void) { + u8 data = 0; + + if (uw_leds_initialized) { + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); + data = (data >> 5) & 0x3; + uniwill_led_cdev.brightness = data; + led_classdev_notify_brightness_hw_changed(&uniwill_led_cdev, data); + return true; + } + } + return false; +} + +void uniwill_leds_restore_state_extern(void) { + u8 data; + + if (uw_leds_initialized) { + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + if (uniwill_write_kbd_bl_white(uniwill_led_cdev.brightness)) { + pr_debug("uniwill_leds_restore_state_extern(): uniwill_write_kbd_bl_white() failed\n"); + } + } + else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + // reset + uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); + data |= UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET; + uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, data); + + // write + if (uniwill_write_kbd_bl_rgb(uniwill_mcled_cdev.subled_info[0].brightness, + uniwill_mcled_cdev.subled_info[1].brightness, + uniwill_mcled_cdev.subled_info[2].brightness)) { + pr_debug("uniwill_leds_restore_state_extern(): uniwill_write_kbd_bl_rgb() failed\n"); + } + } + } +} +EXPORT_SYMBOL(uniwill_leds_restore_state_extern); + +void uniwill_leds_set_brightness_extern(enum led_brightness brightness) { + if (uw_leds_initialized) { + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { + uniwill_led_cdev.brightness_set(&uniwill_led_cdev, brightness); + } + else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, brightness); + } + } +} +EXPORT_SYMBOL(uniwill_leds_set_brightness_extern); + +void uniwill_leds_set_color_extern(u32 color) { + if (uw_leds_initialized) { + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + uniwill_mcled_cdev.subled_info[0].intensity = (color >> 16) & 0xff; + uniwill_mcled_cdev.subled_info[1].intensity = (color >> 8) & 0xff; + uniwill_mcled_cdev.subled_info[2].intensity = color & 0xff; + uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, uniwill_mcled_cdev.led_cdev.brightness); + } + } +} +EXPORT_SYMBOL(uniwill_leds_set_color_extern); + +MODULE_LICENSE("GPL"); + +#endif // UNIWILL_LEDS_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_wmi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_wmi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src/uniwill_wmi.c 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src/uniwill_wmi.c 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,397 @@ +/*! + * Copyright (c) 2021 TUXEDO Computers GmbH + * + * This file is part of tuxedo-keyboard. + * + * tuxedo-keyboard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include +#include "uniwill_interfaces.h" + +#define UNIWILL_EC_REG_LDAT 0x8a +#define UNIWILL_EC_REG_HDAT 0x8b +#define UNIWILL_EC_REG_FLAGS 0x8c +#define UNIWILL_EC_REG_CMDL 0x8d +#define UNIWILL_EC_REG_CMDH 0x8e + +#define UNIWILL_EC_BIT_RFLG 0 +#define UNIWILL_EC_BIT_WFLG 1 +#define UNIWILL_EC_BIT_BFLG 2 +#define UNIWILL_EC_BIT_CFLG 3 +#define UNIWILL_EC_BIT_DRDY 7 + +#define UW_EC_BUSY_WAIT_CYCLES 30 +#define UW_EC_BUSY_WAIT_DELAY 15 + +static bool uniwill_ec_direct = true; + +DEFINE_MUTEX(uniwill_ec_lock); + +static int uw_wmi_ec_evaluate(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, u8 read_flag, u32 *return_buffer) +{ + acpi_status status; + union acpi_object *out_acpi; + int e_result = 0; + + // Kernel buffer for input argument + u32 *wmi_arg = (u32 *) kmalloc(sizeof(u32)*10, GFP_KERNEL); + // Byte reference to the input buffer + u8 *wmi_arg_bytes = (u8 *) wmi_arg; + + u8 wmi_instance = 0x00; + u32 wmi_method_id = 0x04; + struct acpi_buffer wmi_in = { (acpi_size) sizeof(wmi_arg), wmi_arg}; + struct acpi_buffer wmi_out = { ACPI_ALLOCATE_BUFFER, NULL }; + + mutex_lock(&uniwill_ec_lock); + + // Zero input buffer + memset(wmi_arg, 0x00, 10 * sizeof(u32)); + + // Configure the input buffer + wmi_arg_bytes[0] = addr_low; + wmi_arg_bytes[1] = addr_high; + wmi_arg_bytes[2] = data_low; + wmi_arg_bytes[3] = data_high; + + if (read_flag != 0) { + wmi_arg_bytes[5] = 0x01; + } + + status = wmi_evaluate_method(UNIWILL_WMI_MGMT_GUID_BC, wmi_instance, wmi_method_id, &wmi_in, &wmi_out); + out_acpi = (union acpi_object *) wmi_out.pointer; + + if (out_acpi && out_acpi->type == ACPI_TYPE_BUFFER) { + memcpy(return_buffer, out_acpi->buffer.pointer, out_acpi->buffer.length); + } /* else if (out_acpi && out_acpi->type == ACPI_TYPE_INTEGER) { + e_result = (u32) out_acpi->integer.value; + }*/ + if (ACPI_FAILURE(status)) { + pr_err("uniwill_wmi.h: Error evaluating method\n"); + e_result = -EIO; + } + + kfree(out_acpi); + kfree(wmi_arg); + + mutex_unlock(&uniwill_ec_lock); + + return e_result; +} + +/** + * EC address read through WMI + */ +static int uw_ec_read_addr_wmi(u8 addr_low, u8 addr_high, union uw_ec_read_return *output) +{ + u32 uw_data[10]; + int ret = uw_wmi_ec_evaluate(addr_low, addr_high, 0x00, 0x00, 1, uw_data); + output->dword = uw_data[0]; + // pr_debug("addr: 0x%02x%02x value: %0#4x (high: %0#4x) result: %d\n", addr_high, addr_low, output->bytes.data_low, output->bytes.data_high, ret); + return ret; +} + +/** + * EC address write through WMI + */ +static int uw_ec_write_addr_wmi(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, union uw_ec_write_return *output) +{ + u32 uw_data[10]; + int ret = uw_wmi_ec_evaluate(addr_low, addr_high, data_low, data_high, 0, uw_data); + output->dword = uw_data[0]; + return ret; +} + +/** + * Direct EC address read + */ +static int uw_ec_read_addr_direct(u8 addr_low, u8 addr_high, union uw_ec_read_return *output) +{ + int result; + int count; + u8 tmp, flags; + bool ready; + bool bflag = false; + + mutex_lock(&uniwill_ec_lock); + + ec_read(UNIWILL_EC_REG_FLAGS, &flags); + if ((flags & (1 << UNIWILL_EC_BIT_BFLG)) > 0) { + pr_debug("read: BFLG set\n"); + bflag = true; + } + + flags |= (1 << UNIWILL_EC_BIT_BFLG); + ec_write(UNIWILL_EC_REG_FLAGS, flags); + + ec_write(UNIWILL_EC_REG_LDAT, addr_low); + ec_write(UNIWILL_EC_REG_HDAT, addr_high); + + flags &= ~(1 << UNIWILL_EC_BIT_DRDY); + flags |= (1 << UNIWILL_EC_BIT_RFLG); + ec_write(UNIWILL_EC_REG_FLAGS, flags); + + // Wait for ready flag + count = UW_EC_BUSY_WAIT_CYCLES; + ready = false; + while (!ready && count != 0) { + msleep(UW_EC_BUSY_WAIT_DELAY); + ec_read(UNIWILL_EC_REG_FLAGS, &tmp); + ready = (tmp & (1 << UNIWILL_EC_BIT_DRDY)) != 0; + count -= 1; + } + + if (count != 0) { + output->dword = 0; + ec_read(UNIWILL_EC_REG_CMDL, &tmp); + output->bytes.data_low = tmp; + ec_read(UNIWILL_EC_REG_CMDH, &tmp); + output->bytes.data_high = tmp; + result = 0; + } else { + pr_err("uw ec read timeout, addr: 0x%02x%02x\n", addr_high, addr_low); + output->dword = 0xfefefefe; + result = -EIO; + } + + ec_write(UNIWILL_EC_REG_FLAGS, 0x00); + + mutex_unlock(&uniwill_ec_lock); + + if (bflag) + pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, output->bytes.data_low, result); + + if ((UW_EC_BUSY_WAIT_CYCLES - count) > 1) + pr_debug("read wait count: %i", (UW_EC_BUSY_WAIT_CYCLES - count)); + + // pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, output->bytes.data_low, result); + + return result; +} + +static int uw_ec_write_addr_direct(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, union uw_ec_write_return *output) +{ + int result = 0; + int count; + u8 tmp, flags; + bool ready; + bool bflag = false; + + mutex_lock(&uniwill_ec_lock); + + ec_read(UNIWILL_EC_REG_FLAGS, &flags); + if ((flags & (1 << UNIWILL_EC_BIT_BFLG)) > 0) { + pr_debug("write: BFLG set\n"); + bflag = true; + } + + flags |= (1 << UNIWILL_EC_BIT_BFLG); + ec_write(UNIWILL_EC_REG_FLAGS, flags); + + ec_write(UNIWILL_EC_REG_LDAT, addr_low); + ec_write(UNIWILL_EC_REG_HDAT, addr_high); + ec_write(UNIWILL_EC_REG_CMDL, data_low); + ec_write(UNIWILL_EC_REG_CMDH, data_high); + + flags &= ~(1 << UNIWILL_EC_BIT_DRDY); + flags |= (1 << UNIWILL_EC_BIT_WFLG); + ec_write(UNIWILL_EC_REG_FLAGS, flags); + + // Wait for ready flag + count = UW_EC_BUSY_WAIT_CYCLES; + ready = false; + while (!ready && count != 0) { + msleep(UW_EC_BUSY_WAIT_DELAY); + ec_read(UNIWILL_EC_REG_FLAGS, &tmp); + ready = (tmp & (1 << UNIWILL_EC_BIT_DRDY)) != 0; + count -= 1; + } + + // Replicate wmi output depending on success + if (count != 0) { + output->bytes.addr_low = addr_low; + output->bytes.addr_high = addr_high; + output->bytes.data_low = data_low; + output->bytes.data_high = data_high; + result = 0; + } else { + pr_err("uw ec write timeout, addr: 0x%02x%02x, value: %0#4x\n", addr_high, addr_low, data_low); + output->dword = 0xfefefefe; + result = -EIO; + } + + ec_write(UNIWILL_EC_REG_FLAGS, 0x00); + + if (bflag) + pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, data_low, result); + + if ((UW_EC_BUSY_WAIT_CYCLES - count) > 1) + pr_debug("write wait count: %i", (UW_EC_BUSY_WAIT_CYCLES - count)); + + mutex_unlock(&uniwill_ec_lock); + + return result; +} + +int uw_wmi_read_ec_ram(u16 addr, u8 *data) +{ + int result; + u8 addr_low, addr_high; + union uw_ec_read_return output; + + if (IS_ERR_OR_NULL(data)) + return -EINVAL; + + addr_low = addr & 0xff; + addr_high = (addr >> 8) & 0xff; + + if (uniwill_ec_direct) { + result = uw_ec_read_addr_direct(addr_low, addr_high, &output); + } else { + result = uw_ec_read_addr_wmi(addr_low, addr_high, &output); + } + + *data = output.bytes.data_low; + return result; +} + +int uw_wmi_write_ec_ram(u16 addr, u8 data) +{ + int result; + u8 addr_low, addr_high, data_low, data_high; + union uw_ec_write_return output; + + addr_low = addr & 0xff; + addr_high = (addr >> 8) & 0xff; + data_low = data; + data_high = 0x00; + + if (uniwill_ec_direct) + result = uw_ec_write_addr_direct(addr_low, addr_high, data_low, data_high, &output); + else + result = uw_ec_write_addr_wmi(addr_low, addr_high, data_low, data_high, &output); + + return result; +} + +struct uniwill_interface_t uniwill_wmi_interface = { + .string_id = UNIWILL_INTERFACE_WMI_STRID, + .read_ec_ram = uw_wmi_read_ec_ram, + .write_ec_ram = uw_wmi_write_ec_ram +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) +static int uniwill_wmi_probe(struct wmi_device *wdev) +#else +static int uniwill_wmi_probe(struct wmi_device *wdev, const void *dummy_context) +#endif +{ + int status; + + // Look for for GUIDs used on uniwill devices + status = + wmi_has_guid(UNIWILL_WMI_EVENT_GUID_0) && + wmi_has_guid(UNIWILL_WMI_EVENT_GUID_1) && + wmi_has_guid(UNIWILL_WMI_EVENT_GUID_2) && + wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BA) && + wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BB) && + wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BC); + + if (!status) { + pr_debug("probe: At least one Uniwill GUID missing\n"); + return -ENODEV; + } + + uniwill_add_interface(&uniwill_wmi_interface); + + pr_info("interface initialized\n"); + + return 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) +static int uniwill_wmi_remove(struct wmi_device *wdev) +#else +static void uniwill_wmi_remove(struct wmi_device *wdev) +#endif +{ + pr_debug("uniwill_wmi driver remove\n"); + uniwill_remove_interface(&uniwill_wmi_interface); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) + return 0; +#endif +} + +static void uniwill_wmi_notify(struct wmi_device *wdev, union acpi_object *obj) +{ + u32 code; + + if (!IS_ERR_OR_NULL(uniwill_wmi_interface.event_callb)) { + if (obj) { + if (obj->type == ACPI_TYPE_INTEGER) { + code = obj->integer.value; + // Execute registered callback + uniwill_wmi_interface.event_callb(code); + } else { + pr_debug("unknown event type - %d (%0#6x)\n", obj->type, obj->type); + } + } else { + pr_debug("expected ACPI object doesn't exist\n"); + } + } else { + pr_debug("no registered callback\n"); + } +} + +static const struct wmi_device_id uniwill_wmi_device_ids[] = { + // Listing one should be enough, for a driver that "takes care of all anyways" + // also prevents probe (and handling) per "device" + { .guid_string = UNIWILL_WMI_EVENT_GUID_2 }, + { } +}; + +static struct wmi_driver uniwill_wmi_driver = { + .driver = { + .name = UNIWILL_INTERFACE_WMI_STRID, + .owner = THIS_MODULE + }, + .id_table = uniwill_wmi_device_ids, + .probe = uniwill_wmi_probe, + .remove = uniwill_wmi_remove, + .notify = uniwill_wmi_notify, +}; + +module_wmi_driver(uniwill_wmi_driver); + +MODULE_AUTHOR("TUXEDO Computers GmbH "); +MODULE_DESCRIPTION("Driver for Uniwill WMI interface"); +MODULE_VERSION("0.0.4"); +MODULE_LICENSE("GPL"); + +/* + * If set to true, the module will use the replicated WMI functions + * (direct ec_read/ec_write) to read and write to the EC RAM instead + * of the original. Since the original functions, in all observed cases, + * use excessive delays, they are not preferred. + */ +module_param_cb(ec_direct_io, ¶m_ops_bool, &uniwill_ec_direct, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); +MODULE_PARM_DESC(ec_direct_io, "Do not use WMI methods to read/write EC RAM (default: true)."); + +MODULE_DEVICE_TABLE(wmi, uniwill_wmi_device_ids); +MODULE_ALIAS_UNIWILL_WMI(); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src_pkg/dkms_postinst clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src_pkg/dkms_postinst --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src_pkg/dkms_postinst 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src_pkg/dkms_postinst 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,291 @@ +#!/bin/sh +# Copyright (C) 2002-2005 Flavio Stanchina +# Copyright (C) 2005-2006 Aric Cyr +# Copyright (C) 2007 Mario Limonciello +# Copyright (C) 2009 Alberto Milone + +set -e + +uname_s=$(uname -s) + +_get_kernel_dir() { + KVER=$1 + case ${uname_s} in + Linux) DIR="/lib/modules/$KVER/build" ;; + GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;; + esac + echo $DIR +} + +_check_kernel_dir() { + DIR=$(_get_kernel_dir $1) + case ${uname_s} in + Linux) test -e $DIR/include ;; + GNU/kFreeBSD) test -e $DIR/kern && test -e $DIR/conf/kmod.mk ;; + *) return 1 ;; + esac + return $? +} + +# Check the existence of a kernel named as $1 +_is_kernel_name_correct() { + CORRECT="no" + KERNEL_NAME=$1 + + for kernel in /boot/config-*; do + KERNEL=${kernel#*-} + if [ "${KERNEL}" = "${KERNEL_NAME}" ]; then + CORRECT="yes" + break + fi + done + + echo $CORRECT +} + + +# Get the most recent kernel on Debian based systems. This keeps +# into account both the version and the ABI. If the current kernel +# is the most recent kernel then the function will print a null string. +_get_newest_kernel_debian() { + NEWEST_KERNEL= + NEWEST_VERSION= + NEWEST_ABI= + + for kernel in /boot/config-*; do + KERNEL=${kernel#*-} + KERNEL_VERSION=${KERNEL%%-*} + ABI=${KERNEL#*-} + ABI=${ABI%%-*} + + if [ -z "$NEWEST_KERNEL" ]; then + # The 1st time get a version which is bigger than $1 + COMPARE_TO=$1 + else + # Get the biggest version + COMPARE_TO="$NEWEST_VERSION-$NEWEST_ABI" + fi + + # if $kernel is greater than $COMPARE_TO + if [ `dpkg --compare-versions "$KERNEL_VERSION-$ABI" gt "$COMPARE_TO" && echo "yes" || \ + echo "no"` = "yes" ]; then + NEWEST_KERNEL=$KERNEL + NEWEST_VERSION=$KERNEL_VERSION + NEWEST_ABI=$ABI + fi + done + + echo "$NEWEST_KERNEL" +} + +# Get the most recent kernel in Rhel based systems. If the current kernel +# is the most recent kernel then the function will print a null string. +_get_newest_kernel_rhel() { + NEWEST_KERNEL= + + LAST_INSTALLED_KERNEL=$(rpm -q --whatprovides kernel --last | grep kernel -m1 | cut -f1 -d' ') + + LIK_FORMATTED_NAME=$(rpm -q $LAST_INSTALLED_KERNEL --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}\n") + + if [ `echo $LIK_FORMATTED_NAME | grep 2.6 >/dev/null` ]; then + # Fedora and Suse + NEWEST_KERNEL=$LIK_FORMATTED_NAME + else + # Hack for Mandriva where $LIK_FORMATTED_NAME is broken + LIK_NAME=$(rpm -q $LAST_INSTALLED_KERNEL --queryformat="%{NAME}\n") + LIK_TYPE=${LIK_NAME#kernel-} + LIK_TYPE=${LIK_TYPE%%-*} + LIK_STRIPPED=${LIK_NAME#kernel-} + LIK_STRIPPED=${LIK_STRIPPED#$LIK_TYPE-} + LIK_STRIPPED_BASE=${LIK_STRIPPED%%-*} + LIK_STRIPPED_END=${LIK_STRIPPED#$LIK_STRIPPED_BASE-} + LIK_FINAL=$LIK_STRIPPED_BASE-$LIK_TYPE-$LIK_STRIPPED_END + + NEWEST_KERNEL=$LIK_FINAL + fi + + echo $NEWEST_KERNEL +} + +# Get the newest kernel on Debian and Rhel based systems. +get_newest_kernel() { + NEWEST_KERNEL= + # Try Debian first as rpm can be installed in Debian based distros + if [ -e /usr/bin/dpkg ]; then + # If DEB based + CURRENT_KERNEL=$1 + CURRENT_VERSION=${CURRENT_KERNEL%%-*} + CURRENT_ABI=${CURRENT_KERNEL#*-} + CURRENT_FLAVOUR=${CURRENT_ABI#*-} + CURRENT_ABI=${CURRENT_ABI%%-*} + NEWEST_KERNEL=$(_get_newest_kernel_debian "$CURRENT_VERSION-$CURRENT_ABI") + + elif [ `which rpm >/dev/null` ]; then + # If RPM based + NEWEST_KERNEL=$(_get_newest_kernel_rhel) + fi + + # Make sure that kernel name that we extracted corresponds to an installed + # kernel + if [ -n "$NEWEST_KERNEL" ] && [ `_is_kernel_name_correct $NEWEST_KERNEL` = "no" ]; then + NEWEST_KERNEL= + fi + + echo $NEWEST_KERNEL +} + +NAME=$1 +VERSION=$2 +TARBALL_ROOT=$3 +ARCH=$4 +UPGRADE=$5 + +if [ -z "$NAME" ] || [ -z "$VERSION" ]; then + echo "Need NAME, and VERSION defined" + echo "ARCH is optional" + exit 1 +fi + +# read framework configuration options +if [ -r /etc/dkms/framework.conf ]; then + . /etc/dkms/framework.conf +fi + +KERNELS=$(ls /lib/modules/ 2>/dev/null || true) +CURRENT_KERNEL=$(uname -r) + +#We never want to keep an older version side by side to prevent conflicts +if [ -e "/var/lib/dkms/$NAME/$VERSION" ]; then + echo "Removing old $NAME-$VERSION DKMS files..." + dkms remove -m $NAME -v $VERSION --all +fi + +#Load new files, by source package and by tarball +if [ -f "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz" ]; then + if ! dkms ldtarball --archive "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz"; then + echo "" + echo "" + echo "Unable to load DKMS tarball $TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz." + echo "Common causes include: " + echo " - You must be using DKMS 2.1.0.0 or later to support binaries only" + echo " distribution specific archives." + echo " - Corrupt distribution specific archive" + echo "" + echo "" + exit 2 + fi +elif [ -d "/usr/src/$NAME-$VERSION" ]; then + echo "Loading new $NAME-$VERSION DKMS files..." + dkms add -m $NAME -v $VERSION > /dev/null +fi + +# On 1st installation, let us look for a directory +# in /lib/modules which matches `uname -r`. If none +# is found it is possible that buildd is being used +# and that uname -r is giving us the name of the +# kernel used by the buildd machine. +# +# If this is the case we try to build the kernel +# module for each kernel which has a directory in +# /lib/modules. Furthermore we will have to tell +# DKMS which architecture it should build the module +# for (e.g. if the buildd machine is using a +# 2.6.24-23-xen 64bit kernel). +# +# NOTE: if the headers are not installed then the +# module won't be built, as usual + +# Here we look for the most recent kernel so that we can +# build the module for it (in addition to doing it for the +# current kernel. +NEWEST_KERNEL=$(get_newest_kernel "$KERNELS") + +if [ -z "$autoinstall_all_kernels" ]; then + # If the current kernel is installed on the system or chroot + if [ `_is_kernel_name_correct $CURRENT_KERNEL` = "yes" ]; then + if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then + KERNELS="$CURRENT_KERNEL $NEWEST_KERNEL" + else + KERNELS=$CURRENT_KERNEL + fi + # The current kernel is not useful as it's not installed + else + echo "It is likely that $CURRENT_KERNEL belongs to a chroot's host" + + # Let's use only the newest kernel if this is not a first installation + # otherwise build for all kernels + if [ -n "$NEWEST_KERNEL" -a -n "$UPGRADE" ]; then + KERNELS="$NEWEST_KERNEL" + fi + fi +fi + +# Take care of displaying newline separated list +echo "Building for $KERNELS" | tr '\n' ',' \ + | sed -e 's/,/, /g; s/, $/\n/; s/, \([^,]\+\)$/ and \1/' + +if [ -n "$ARCH" ]; then + if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then + case $ARCH in + amd64) + ARCH="x86_64" + ;; + lpia|i?86) + ARCH="i686" + ;; + esac + fi + echo "Building for architecture $ARCH" + ARCH="-a $ARCH" +fi + +for KERNEL in $KERNELS; do + dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH` + if [ `echo $KERNEL | grep -c "BOOT"` -gt 0 ]; then + echo "" + echo "Module build and install for $KERNEL was skipped as " + echo "it is a BOOT variant" + continue + fi + + + #if the module isn't yet built, try to build it + if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then + if [ ! -L /var/lib/dkms/$NAME/$VERSION/source ]; then + echo "This package appears to be a binaries-only package" + echo " you will not be able to build against kernel $KERNEL" + echo " since the package source was not provided" + continue + fi + if _check_kernel_dir $KERNEL; then + echo "Building initial module for $KERNEL" + set +e + dkms build -m $NAME -v $VERSION -k $KERNEL $ARCH > /dev/null + case $? in + 9) + set -e + echo "Skipped." + continue + ;; + 0) + set -e + echo "Done." + ;; + *) + exit $? + ;; + esac + dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH` + else + echo "Module build for kernel $KERNEL was skipped since the" + echo "kernel headers for this kernel does not seem to be installed." + fi + fi + + #if the module is built (either pre-built or just now), install it + if [ `echo $dkms_status | grep -c ": built"` -eq 1 ] && + [ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then + dkms install -m $NAME -v $VERSION -k $KERNEL $ARCH + fi +done + diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src_pkg/rpm_pkg.spec clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src_pkg/rpm_pkg.spec --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/src_pkg/rpm_pkg.spec 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/src_pkg/rpm_pkg.spec 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,267 @@ +%define module module-name + +# +# spec file for package tuxedo-keyboard +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Summary: Kernel module for TUXEDO keyboards +Name: %{module} +Version: x.x.x +Release: x +License: GPLv3+ +Group: Hardware/Other +BuildArch: noarch +Url: https://www.tuxedocomputers.com +Source: %{module}-%{version}.tar.bz2 +Provides: tuxedo_keyboard = %{version}-%{release} +Obsoletes: tuxedo_keyboard < %{version}-%{release} +Obsoletes: tuxedo-xp-xc-touchpad-key-fix +Obsoletes: tuxedo-touchpad-fix <= 1.0.1 +Obsoletes: tuxedo-cc-wmi +Requires: dkms >= 1.95 +BuildRoot: %{_tmppath} +Packager: TUXEDO Computers GmbH + +%description +Keyboard & keyboard backlight driver for TUXEDO notebooks +meant for DKMS framework. + +%prep +%setup -n %{module}-%{version} -q + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}/usr/src/%{module}-%{version}/ +cp dkms.conf Makefile %{buildroot}/usr/src/%{module}-%{version} +cp -R src/ %{buildroot}/usr/src/%{module}-%{version} +mkdir -p %{buildroot}/usr/share/ +mkdir -p %{buildroot}/usr/share/%{module}/ +cp postinst %{buildroot}/usr/share/%{module} +cp tuxedo_keyboard.conf %{buildroot}/usr/share/%{module} + +%clean +rm -rf %{buildroot} + +%files +%defattr(0644,root,root,0755) +%attr(0755,root,root) /usr/src/%{module}-%{version}/ +%attr(0644,root,root) /usr/src/%{module}-%{version}/* +%attr(0755,root,root) /usr/src/%{module}-%{version}/src/ +%attr(0644,root,root) /usr/src/%{module}-%{version}/src/* +%attr(0755,root,root) /usr/src/%{module}-%{version}/src/tuxedo_io/ +%attr(0644,root,root) /usr/src/%{module}-%{version}/src/tuxedo_io/* +%attr(0755,root,root) /usr/share/%{module}/ +%attr(0755,root,root) /usr/share/%{module}/postinst +%attr(0644,root,root) /usr/share/%{module}/tuxedo_keyboard.conf +%license LICENSE + +%post +for POSTINST in /usr/lib/dkms/common.postinst /usr/share/%{module}/postinst; do + if [ -f $POSTINST ]; then + $POSTINST %{module} %{version} /usr/share/%{module} + RET=$? + + # Attempt to (re-)load module immediately, fail silently if not possible at this stage + + # Also stop tccd service if running before + echo "Check tccd running status" + if systemctl is-active --quiet tccd.service; then + TCCD_RUNNING=true + else + TCCD_RUNNING=false + fi + + if $TCCD_RUNNING; then + echo "Stop tccd temporarily" + systemctl stop tccd 2>&1 || true + fi + + % Explicitly unload old tuxedo_cc_wmi if loaded at this point + rmmod tuxedo_cc_wmi > /dev/null 2>&1 || true + + echo "(Re)load modules if possible" + + rmmod tuxedo_io > /dev/null 2>&1 || true + rmmod uniwill_wmi > /dev/null 2>&1 || true + rmmod clevo_wmi > /dev/null 2>&1 || true + rmmod clevo_acpi > /dev/null 2>&1 || true + rmmod tuxedo_keyboard > /dev/null 2>&1 || true + + modprobe tuxedo_keyboard > /dev/null 2>&1 || true + modprobe uniwill_wmi > /dev/null 2>&1 || true + modprobe clevo_wmi > /dev/null 2>&1 || true + modprobe clevo_acpi > /dev/null 2>&1 || true + modprobe tuxedo_io > /dev/null 2>&1 || true + + # Install default config if none exist already + if [ ! -f "/etc/modprobe.d/tuxedo_keyboard.conf" ]; then + cp -f /usr/share/tuxedo-keyboard/tuxedo_keyboard.conf /etc/modprobe.d/tuxedo_keyboard.conf + fi + + # Restart tccd after reload if it was running + if $TCCD_RUNNING; then + echo "Start tccd again" + systemctl start tccd 2>&1 || true + fi + + exit $RET + fi + echo "WARNING: $POSTINST does not exist." +done + +echo -e "ERROR: DKMS version is too old and %{module} was not" +echo -e "built with legacy DKMS support." +echo -e "You must either rebuild %{module} with legacy postinst" +echo -e "support or upgrade DKMS to a more current version." +exit 1 + + +%preun +echo -e +echo -e "Uninstall of %{module} module (version %{version}-%{release}) beginning:" +dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade +if [ $1 != 1 ];then + /usr/sbin/rmmod %{module} > /dev/null 2>&1 || true + rm -f /etc/modprobe.d/tuxedo_keyboard.conf || true +fi +exit 0 + + +%changelog +* Thu Sep 21 2023 C Sandberg 3.2.11-1 +- Aura Gen3 support +* Thu Aug 10 2023 C Sandberg 3.2.10-1 +- Fix build on certain systems +* Tue Aug 01 2023 C Sandberg 3.2.9-1 +- Quirks for setting missing IBP16Gen8 keyboard layouts +- Fix IBP 16 Gen8 mk1 layout set to 14inch variant layout +* Fri Jul 21 2023 C Sandberg 3.2.8-1 +- Keyboard backlight support for IBS17Gen8 (white-only) +- Fn backlight key support for IBS17Gen8 +* Wed Jun 28 2023 C Sandberg 3.2.7-1 +- Fix for certain white kbd bl identification on boot (XA15) +- General white-only kbd bl rework to use firmware set on Fn+brightness + switch +- Kernel 6.4 build compatibility fix +* Tue Jun 13 2023 C Sandberg 3.2.6-1 +- Fallback ROM ID set quirk support +* Mon May 19 2023 C Sandberg 3.2.5-1 +- IBP Gen8 keyboard backlight support +- IBP Gen8 TDP support +- Color scaling for certain one-zone RGB keyboards +- Fix for certain white kbd bl devices (like Pulse) not setting brightness + to zero on init +* Thu Apr 20 2023 C Sandberg 3.2.3-1 +- Fix missing state write on resume for some devices which woke up with "default blue" keyboard backlight +- Add TDP device definitions for Stellaris Intel Gen5 +- Add device check on newer cpu gens +* Mon Mar 27 2023 C Sandberg 3.2.1-1 +- Fix "lost fan control" in some circumstances (on eg. IBPGen7) +* Wed Mar 22 2023 C Sandberg 3.2.0-1 +- KBD BL: Interface rewrite, now generally exported through /sys/class/leds :kbd_backlight +- KBD BL: New interface impl. for white backlight keyboards (also :kbd_backlight) +- Note: Old interface is hereby deprecated (and removed) +* Fri Feb 17 2023 C Sandberg 3.1.4-1 +- Fix upcoming 6.2 kernel build issue (from github Buddy-Matt) +- Re-write last set charging priority on barrel plug connect +- UW interface performance tweaks (should help with lagging keyboard issues on certain devices) +* Wed Jan 11 2023 C Sandberg 3.1.3-1 +- Fix IBP14Gen6 second fan not spinning (alternative fan ctl approach) +- Fix some error-lookalike messages in kernel log (aka prevent uw feature + id when interface not available) +* Mon Dec 19 2022 C Sandberg 3.1.2-1 +- Enables dynamic boost (max offset) for certain devices needing sw ctl +- Adds charging profile interface for devices supporting charging profiles +- Adds charging priority interface for devices supporting USB-C PD charging + priority setting +* Mon Oct 17 2022 C Sandberg 3.1.1-1 +- Reenable fans-off for some devices that got it turned of as a temporary workaround +- Fix default fan curve not being reenabled when tccd is stopped +* Mon Oct 10 2022 C Sandberg 3.1.0-1 +- Add power profiles and tdp functionality (uw) +* Thu Oct 06 2022 C Sandberg 3.0.11-1 +- Introduce alternative fan control (uw) +- Fan control parameters from driver "has fan off" and "min fan speed" +- Fixes missing/broken fan control on newer devices +* Thu Apr 28 2022 C Sandberg 3.0.10-1 +- Add Stellaris Intel gen 4 lightbar support +- Default lightbar to off +* Mon Oct 10 2021 C Sandberg 3.0.9-1 +- Add IBS15v6 & IBS17v6 new module name to perf. prof workaround +- Interface modularization (uw) +- Fix Pulse14/15 gen 1 keyboard backlight ctrl dissapearing +* Fri Jul 9 2021 C Sandberg 3.0.8-1 +- Add IBS14v6 to perf. prof workaround +* Thu Jun 24 2021 C Sandberg 3.0.7-1 +- Add new Polaris devices gen 2 & gen 3 keyb bl support +- Add Stellaris (gen3) lightbar support +- Fix kernel 5.13 build issue (from github BlackIkeEagle) +- Add another Fusion lightbar ID (from github ArlindoFNeto) +* Mon Jun 07 2021 C Sandberg 3.0.6-1 +- Add tuxedo-io performance profile set (cl) +* Fri Apr 23 2021 C Sandberg 3.0.5-1 +- Add NS50MU to perf. profile workaround +- Add EDUBOOK1502 to perf. profile workaround +- Add XP gen 11 & 12 to perf. profile workaround +- Clean-up cl driver state init (should fix some init color issues) +* Fri Mar 19 2021 C Sandberg 3.0.4-1 +- Fixed various possible race conditions on driver init +- Added IBS14v5 to perf. profile workaround +- Added new Aura board name to perf. profile workaround +- Fixed non-initialized firmware fan curve for silent mode (UW) +- Changed default perf. profile to balanced (UW) +* Fri Mar 5 2021 C Sandberg 3.0.3-1 +- Added XP14 to perf. profile workaround +* Fri Jan 29 2021 C Sandberg 3.0.2-1 +- Fixed clevo keyboard init order +- Added Aura perf. profile workaround +* Mon Dec 21 2020 C Sandberg 3.0.1-1 +- Added device support (Trinity) +- Fixed uw fan ramp up issues to some extent (workaround) +* Wed Dec 9 2020 C Sandberg 3.0.0-1 +- Changed structure of clevo interfaces +- Added separate clevo-wmi module with existing functionality +- Added clevo-acpi module with implementation of the "new" clevo ACPI interface +- Added tuxedo-io module (former tuxedo-cc-wmi) into package +* Fri Nov 13 2020 C Sandberg 2.1.0-1 +- Added device support (XMG Fusion) +- Added uniwill lightbar driver (with led_classdev interface) +- Added uniwill keymapping brightness up/down +- Fixed uniwill touchpad toggle (some platforms) +- Fixed module cleanup crash +* Fri Sep 25 2020 C Sandberg 2.0.6-1 +- Added uw kbd color backlight support +* Thu Jun 18 2020 C Sandberg 2.0.5-1 +- Restructure to allow for more devices +- Added device support +- Added rudimentary device detection +* Tue May 26 2020 C Sandberg 2.0.4-1 +- Added rfkill key event +- Fix volume button events, ignore +* Tue May 19 2020 C Sandberg 2.0.3-1 +- General key event mapping support +- Events added for backlight and touchpad +- Fix not removing module on rpm update +* Tue Apr 14 2020 C Sandberg 2.0.2-0 +- Mark old named packages as conflicting and obsolete +- Fix not restoring state on resume +- Fix autoload issues +- Add standard config tuxedo_keyboard.conf to package +* Tue Mar 17 2020 C Sandberg 2.0.1-0 +- New packaging +* Wed Dec 18 2019 Richard Sailer 2.0.0-1 +- Initial DKMS package for back-lit keyboard 2nd generation diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1,10 @@ +Package: tuxedo-keyboard-dkms +Version: 2.0.1 +Section: oldlibs +Priority: optional +Depends: tuxedo-keyboard +Maintainer: TUXEDO Computers GmbH +Homepage: https://www.tuxedocomputers.com +Architecture: all +Description: Transitional package: tuxedo-keyboard-dkms -> tuxedo-keyboard + This is a transitional package, effectively renaming the package. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/tuxedo_keyboard.conf clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/tuxedo_keyboard.conf --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.11/tuxedo_keyboard.conf 1970-01-01 00:00:00.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.11/tuxedo_keyboard.conf 2023-10-07 05:35:12.000000000 +0000 @@ -0,0 +1 @@ +options tuxedo-keyboard kbd_backlight_mode=0 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.clang-format clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.clang-format --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.clang-format 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.clang-format 1970-01-01 00:00:00.000000000 +0000 @@ -1,531 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# clang-format configuration file. Intended for clang-format >= 4. -# -# For more information, see: -# -# Documentation/process/clang-format.rst -# https://clang.llvm.org/docs/ClangFormat.html -# https://clang.llvm.org/docs/ClangFormatStyleOptions.html -# ---- -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -#AlignEscapedNewlines: Left # Unknown to clang-format-4.0 -AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - #AfterExternBlock: false # Unknown to clang-format-5.0 - BeforeCatch: false - BeforeElse: false - IndentBraces: false - #SplitEmptyFunction: true # Unknown to clang-format-4.0 - #SplitEmptyRecord: true # Unknown to clang-format-4.0 - #SplitEmptyNamespace: true # Unknown to clang-format-4.0 -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0 -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: false -#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0 -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: false -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -#CompactNamespaces: false # Unknown to clang-format-4.0 -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 8 -ContinuationIndentWidth: 8 -Cpp11BracedListStyle: false -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -#FixNamespaceComments: false # Unknown to clang-format-4.0 - -# Taken from: -# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \ -# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ -# | sort | uniq -ForEachMacros: - - 'apei_estatus_for_each_section' - - 'ata_for_each_dev' - - 'ata_for_each_link' - - '__ata_qc_for_each' - - 'ata_qc_for_each' - - 'ata_qc_for_each_raw' - - 'ata_qc_for_each_with_internal' - - 'ax25_for_each' - - 'ax25_uid_for_each' - - '__bio_for_each_bvec' - - 'bio_for_each_bvec' - - 'bio_for_each_integrity_vec' - - '__bio_for_each_segment' - - 'bio_for_each_segment' - - 'bio_for_each_segment_all' - - 'bio_list_for_each' - - 'bip_for_each_vec' - - 'bitmap_for_each_clear_region' - - 'bitmap_for_each_set_region' - - 'blkg_for_each_descendant_post' - - 'blkg_for_each_descendant_pre' - - 'blk_queue_for_each_rl' - - 'bond_for_each_slave' - - 'bond_for_each_slave_rcu' - - 'bpf_for_each_spilled_reg' - - 'btree_for_each_safe128' - - 'btree_for_each_safe32' - - 'btree_for_each_safe64' - - 'btree_for_each_safel' - - 'card_for_each_dev' - - 'cgroup_taskset_for_each' - - 'cgroup_taskset_for_each_leader' - - 'cpufreq_for_each_entry' - - 'cpufreq_for_each_entry_idx' - - 'cpufreq_for_each_valid_entry' - - 'cpufreq_for_each_valid_entry_idx' - - 'css_for_each_child' - - 'css_for_each_descendant_post' - - 'css_for_each_descendant_pre' - - 'device_for_each_child_node' - - 'dma_fence_chain_for_each' - - 'drm_atomic_crtc_for_each_plane' - - 'drm_atomic_crtc_state_for_each_plane' - - 'drm_atomic_crtc_state_for_each_plane_state' - - 'drm_atomic_for_each_plane_damage' - - 'drm_client_for_each_connector_iter' - - 'drm_client_for_each_modeset' - - 'drm_connector_for_each_possible_encoder' - - 'drm_for_each_bridge_in_chain' - - 'drm_for_each_connector_iter' - - 'drm_for_each_crtc' - - 'drm_for_each_encoder' - - 'drm_for_each_encoder_mask' - - 'drm_for_each_fb' - - 'drm_for_each_legacy_plane' - - 'drm_for_each_plane' - - 'drm_for_each_plane_mask' - - 'drm_for_each_privobj' - - 'drm_mm_for_each_hole' - - 'drm_mm_for_each_node' - - 'drm_mm_for_each_node_in_range' - - 'drm_mm_for_each_node_safe' - - 'flow_action_for_each' - - 'for_each_active_dev_scope' - - 'for_each_active_drhd_unit' - - 'for_each_active_iommu' - - 'for_each_available_child_of_node' - - 'for_each_bio' - - 'for_each_board_func_rsrc' - - 'for_each_bvec' - - 'for_each_card_auxs' - - 'for_each_card_auxs_safe' - - 'for_each_card_components' - - 'for_each_card_dapms' - - 'for_each_card_pre_auxs' - - 'for_each_card_prelinks' - - 'for_each_card_rtds' - - 'for_each_card_rtds_safe' - - 'for_each_card_widgets' - - 'for_each_card_widgets_safe' - - 'for_each_cgroup_storage_type' - - 'for_each_child_of_node' - - 'for_each_clear_bit' - - 'for_each_clear_bit_from' - - 'for_each_cmsghdr' - - 'for_each_compatible_node' - - 'for_each_component_dais' - - 'for_each_component_dais_safe' - - 'for_each_comp_order' - - 'for_each_console' - - 'for_each_cpu' - - 'for_each_cpu_and' - - 'for_each_cpu_not' - - 'for_each_cpu_wrap' - - 'for_each_dapm_widgets' - - 'for_each_dev_addr' - - 'for_each_dev_scope' - - 'for_each_displayid_db' - - 'for_each_dma_cap_mask' - - 'for_each_dpcm_be' - - 'for_each_dpcm_be_rollback' - - 'for_each_dpcm_be_safe' - - 'for_each_dpcm_fe' - - 'for_each_drhd_unit' - - 'for_each_dss_dev' - - 'for_each_efi_memory_desc' - - 'for_each_efi_memory_desc_in_map' - - 'for_each_element' - - 'for_each_element_extid' - - 'for_each_element_id' - - 'for_each_endpoint_of_node' - - 'for_each_evictable_lru' - - 'for_each_fib6_node_rt_rcu' - - 'for_each_fib6_walker_rt' - - 'for_each_free_mem_pfn_range_in_zone' - - 'for_each_free_mem_pfn_range_in_zone_from' - - 'for_each_free_mem_range' - - 'for_each_free_mem_range_reverse' - - 'for_each_func_rsrc' - - 'for_each_hstate' - - 'for_each_if' - - 'for_each_iommu' - - 'for_each_ip_tunnel_rcu' - - 'for_each_irq_nr' - - 'for_each_link_codecs' - - 'for_each_link_cpus' - - 'for_each_link_platforms' - - 'for_each_lru' - - 'for_each_matching_node' - - 'for_each_matching_node_and_match' - - 'for_each_member' - - 'for_each_memblock' - - 'for_each_memblock_type' - - 'for_each_memcg_cache_index' - - 'for_each_mem_pfn_range' - - 'for_each_mem_range' - - 'for_each_mem_range_rev' - - 'for_each_migratetype_order' - - 'for_each_msi_entry' - - 'for_each_msi_entry_safe' - - 'for_each_net' - - 'for_each_net_continue_reverse' - - 'for_each_netdev' - - 'for_each_netdev_continue' - - 'for_each_netdev_continue_rcu' - - 'for_each_netdev_continue_reverse' - - 'for_each_netdev_feature' - - 'for_each_netdev_in_bond_rcu' - - 'for_each_netdev_rcu' - - 'for_each_netdev_reverse' - - 'for_each_netdev_safe' - - 'for_each_net_rcu' - - 'for_each_new_connector_in_state' - - 'for_each_new_crtc_in_state' - - 'for_each_new_mst_mgr_in_state' - - 'for_each_new_plane_in_state' - - 'for_each_new_private_obj_in_state' - - 'for_each_node' - - 'for_each_node_by_name' - - 'for_each_node_by_type' - - 'for_each_node_mask' - - 'for_each_node_state' - - 'for_each_node_with_cpus' - - 'for_each_node_with_property' - - 'for_each_of_allnodes' - - 'for_each_of_allnodes_from' - - 'for_each_of_cpu_node' - - 'for_each_of_pci_range' - - 'for_each_old_connector_in_state' - - 'for_each_old_crtc_in_state' - - 'for_each_old_mst_mgr_in_state' - - 'for_each_oldnew_connector_in_state' - - 'for_each_oldnew_crtc_in_state' - - 'for_each_oldnew_mst_mgr_in_state' - - 'for_each_oldnew_plane_in_state' - - 'for_each_oldnew_plane_in_state_reverse' - - 'for_each_oldnew_private_obj_in_state' - - 'for_each_old_plane_in_state' - - 'for_each_old_private_obj_in_state' - - 'for_each_online_cpu' - - 'for_each_online_node' - - 'for_each_online_pgdat' - - 'for_each_pci_bridge' - - 'for_each_pci_dev' - - 'for_each_pci_msi_entry' - - 'for_each_pcm_streams' - - 'for_each_populated_zone' - - 'for_each_possible_cpu' - - 'for_each_present_cpu' - - 'for_each_prime_number' - - 'for_each_prime_number_from' - - 'for_each_process' - - 'for_each_process_thread' - - 'for_each_property_of_node' - - 'for_each_registered_fb' - - 'for_each_reserved_mem_region' - - 'for_each_rtd_codec_dais' - - 'for_each_rtd_codec_dais_rollback' - - 'for_each_rtd_components' - - 'for_each_rtd_cpu_dais' - - 'for_each_rtd_cpu_dais_rollback' - - 'for_each_rtd_dais' - - 'for_each_set_bit' - - 'for_each_set_bit_from' - - 'for_each_set_clump8' - - 'for_each_sg' - - 'for_each_sg_dma_page' - - 'for_each_sg_page' - - 'for_each_sibling_event' - - 'for_each_subelement' - - 'for_each_subelement_extid' - - 'for_each_subelement_id' - - '__for_each_thread' - - 'for_each_thread' - - 'for_each_wakeup_source' - - 'for_each_zone' - - 'for_each_zone_zonelist' - - 'for_each_zone_zonelist_nodemask' - - 'fwnode_for_each_available_child_node' - - 'fwnode_for_each_child_node' - - 'fwnode_graph_for_each_endpoint' - - 'gadget_for_each_ep' - - 'genradix_for_each' - - 'genradix_for_each_from' - - 'hash_for_each' - - 'hash_for_each_possible' - - 'hash_for_each_possible_rcu' - - 'hash_for_each_possible_rcu_notrace' - - 'hash_for_each_possible_safe' - - 'hash_for_each_rcu' - - 'hash_for_each_safe' - - 'hctx_for_each_ctx' - - 'hlist_bl_for_each_entry' - - 'hlist_bl_for_each_entry_rcu' - - 'hlist_bl_for_each_entry_safe' - - 'hlist_for_each' - - 'hlist_for_each_entry' - - 'hlist_for_each_entry_continue' - - 'hlist_for_each_entry_continue_rcu' - - 'hlist_for_each_entry_continue_rcu_bh' - - 'hlist_for_each_entry_from' - - 'hlist_for_each_entry_from_rcu' - - 'hlist_for_each_entry_rcu' - - 'hlist_for_each_entry_rcu_bh' - - 'hlist_for_each_entry_rcu_notrace' - - 'hlist_for_each_entry_safe' - - '__hlist_for_each_rcu' - - 'hlist_for_each_safe' - - 'hlist_nulls_for_each_entry' - - 'hlist_nulls_for_each_entry_from' - - 'hlist_nulls_for_each_entry_rcu' - - 'hlist_nulls_for_each_entry_safe' - - 'i3c_bus_for_each_i2cdev' - - 'i3c_bus_for_each_i3cdev' - - 'ide_host_for_each_port' - - 'ide_port_for_each_dev' - - 'ide_port_for_each_present_dev' - - 'idr_for_each_entry' - - 'idr_for_each_entry_continue' - - 'idr_for_each_entry_continue_ul' - - 'idr_for_each_entry_ul' - - 'in_dev_for_each_ifa_rcu' - - 'in_dev_for_each_ifa_rtnl' - - 'inet_bind_bucket_for_each' - - 'inet_lhash2_for_each_icsk_rcu' - - 'key_for_each' - - 'key_for_each_safe' - - 'klp_for_each_func' - - 'klp_for_each_func_safe' - - 'klp_for_each_func_static' - - 'klp_for_each_object' - - 'klp_for_each_object_safe' - - 'klp_for_each_object_static' - - 'kunit_suite_for_each_test_case' - - 'kvm_for_each_memslot' - - 'kvm_for_each_vcpu' - - 'list_for_each' - - 'list_for_each_codec' - - 'list_for_each_codec_safe' - - 'list_for_each_continue' - - 'list_for_each_entry' - - 'list_for_each_entry_continue' - - 'list_for_each_entry_continue_rcu' - - 'list_for_each_entry_continue_reverse' - - 'list_for_each_entry_from' - - 'list_for_each_entry_from_rcu' - - 'list_for_each_entry_from_reverse' - - 'list_for_each_entry_lockless' - - 'list_for_each_entry_rcu' - - 'list_for_each_entry_reverse' - - 'list_for_each_entry_safe' - - 'list_for_each_entry_safe_continue' - - 'list_for_each_entry_safe_from' - - 'list_for_each_entry_safe_reverse' - - 'list_for_each_prev' - - 'list_for_each_prev_safe' - - 'list_for_each_safe' - - 'llist_for_each' - - 'llist_for_each_entry' - - 'llist_for_each_entry_safe' - - 'llist_for_each_safe' - - 'mci_for_each_dimm' - - 'media_device_for_each_entity' - - 'media_device_for_each_intf' - - 'media_device_for_each_link' - - 'media_device_for_each_pad' - - 'nanddev_io_for_each_page' - - 'netdev_for_each_lower_dev' - - 'netdev_for_each_lower_private' - - 'netdev_for_each_lower_private_rcu' - - 'netdev_for_each_mc_addr' - - 'netdev_for_each_uc_addr' - - 'netdev_for_each_upper_dev_rcu' - - 'netdev_hw_addr_list_for_each' - - 'nft_rule_for_each_expr' - - 'nla_for_each_attr' - - 'nla_for_each_nested' - - 'nlmsg_for_each_attr' - - 'nlmsg_for_each_msg' - - 'nr_neigh_for_each' - - 'nr_neigh_for_each_safe' - - 'nr_node_for_each' - - 'nr_node_for_each_safe' - - 'of_for_each_phandle' - - 'of_property_for_each_string' - - 'of_property_for_each_u32' - - 'pci_bus_for_each_resource' - - 'pcm_for_each_format' - - 'ping_portaddr_for_each_entry' - - 'plist_for_each' - - 'plist_for_each_continue' - - 'plist_for_each_entry' - - 'plist_for_each_entry_continue' - - 'plist_for_each_entry_safe' - - 'plist_for_each_safe' - - 'pnp_for_each_card' - - 'pnp_for_each_dev' - - 'protocol_for_each_card' - - 'protocol_for_each_dev' - - 'queue_for_each_hw_ctx' - - 'radix_tree_for_each_slot' - - 'radix_tree_for_each_tagged' - - 'rbtree_postorder_for_each_entry_safe' - - 'rdma_for_each_block' - - 'rdma_for_each_port' - - 'resource_list_for_each_entry' - - 'resource_list_for_each_entry_safe' - - 'rhl_for_each_entry_rcu' - - 'rhl_for_each_rcu' - - 'rht_for_each' - - 'rht_for_each_entry' - - 'rht_for_each_entry_from' - - 'rht_for_each_entry_rcu' - - 'rht_for_each_entry_rcu_from' - - 'rht_for_each_entry_safe' - - 'rht_for_each_from' - - 'rht_for_each_rcu' - - 'rht_for_each_rcu_from' - - '__rq_for_each_bio' - - 'rq_for_each_bvec' - - 'rq_for_each_segment' - - 'scsi_for_each_prot_sg' - - 'scsi_for_each_sg' - - 'sctp_for_each_hentry' - - 'sctp_skb_for_each' - - 'shdma_for_each_chan' - - '__shost_for_each_device' - - 'shost_for_each_device' - - 'sk_for_each' - - 'sk_for_each_bound' - - 'sk_for_each_entry_offset_rcu' - - 'sk_for_each_from' - - 'sk_for_each_rcu' - - 'sk_for_each_safe' - - 'sk_nulls_for_each' - - 'sk_nulls_for_each_from' - - 'sk_nulls_for_each_rcu' - - 'snd_array_for_each' - - 'snd_pcm_group_for_each_entry' - - 'snd_soc_dapm_widget_for_each_path' - - 'snd_soc_dapm_widget_for_each_path_safe' - - 'snd_soc_dapm_widget_for_each_sink_path' - - 'snd_soc_dapm_widget_for_each_source_path' - - 'tb_property_for_each' - - 'tcf_exts_for_each_action' - - 'udp_portaddr_for_each_entry' - - 'udp_portaddr_for_each_entry_rcu' - - 'usb_hub_for_each_child' - - 'v4l2_device_for_each_subdev' - - 'v4l2_m2m_for_each_dst_buf' - - 'v4l2_m2m_for_each_dst_buf_safe' - - 'v4l2_m2m_for_each_src_buf' - - 'v4l2_m2m_for_each_src_buf_safe' - - 'virtio_device_for_each_vq' - - 'xa_for_each' - - 'xa_for_each_marked' - - 'xa_for_each_range' - - 'xa_for_each_start' - - 'xas_for_each' - - 'xas_for_each_conflict' - - 'xas_for_each_marked' - - 'xbc_array_for_each_value' - - 'xbc_for_each_key_value' - - 'xbc_node_for_each_array_value' - - 'xbc_node_for_each_child' - - 'xbc_node_for_each_key_value' - - 'zorro_for_each_dev' - -#IncludeBlocks: Preserve # Unknown to clang-format-5.0 -IncludeCategories: - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '(Test)?$' -IndentCaseLabels: false -#IndentPPDirectives: None # Unknown to clang-format-5.0 -IndentWidth: 8 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 -ObjCBlockIndentWidth: 8 -ObjCSpaceAfterProperty: true -ObjCSpaceBeforeProtocolList: true - -# Taken from git's rules -#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0 -PenaltyBreakBeforeFirstCallParameter: 30 -PenaltyBreakComment: 10 -PenaltyBreakFirstLessLess: 0 -PenaltyBreakString: 10 -PenaltyExcessCharacter: 100 -PenaltyReturnTypeOnItsOwnLine: 60 - -PointerAlignment: Right -ReflowComments: false -SortIncludes: false -#SortUsingDeclarations: false # Unknown to clang-format-4.0 -SpaceAfterCStyleCast: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0 -#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0 -SpaceBeforeParens: ControlStatements -#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0 -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp03 -TabWidth: 8 -UseTab: Always -... diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/control clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/control --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/control 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Package: module-name -Version: x.x.x -Section: admin -Priority: optional -Depends: dkms (>= 1.95) -Conflicts: tuxedo-keyboard-dkms (<= 2.0.0), tuxedo-wmi-dkms (<= 1.5.1), tuxedo-xp-xc-touchpad-key-fix, tuxedo-touchpad-fix (<= 1.0.8), tuxedo-xp-xc-airplane-mode-fix (<= 0.6), tuxedo-cc-wmi -Replaces: tuxedo-keyboard-dkms (<= 2.0.0), tuxedo-wmi-dkms (<= 1.5.1), tuxedo-xp-xc-touchpad-key-fix, tuxedo-touchpad-fix (<= 1.0.8), tuxedo-xp-xc-airplane-mode-fix (<= 0.6), tuxedo-cc-wmi -Maintainer: TUXEDO Computers GmbH -Homepage: https://www.tuxedocomputers.com -Architecture: all -Description: Keyboard driver for TUXEDO notebooks. - Keyboard & keyboard backlight driver for TUXEDO notebooks. - Meant for DKMS framework. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/postinst clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/postinst --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/postinst 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/postinst 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -#!/bin/sh -# Copyright (c) 2020 TUXEDO Computers GmbH - -set -e - -module=module-name -version=x.x.x - - -NAME=${module} -PACKAGE_NAME=${NAME} - -# From dkms standard postinst -# Copyright (C) 2002-2005 Flavio Stanchina -# Copyright (C) 2005-2006 Aric Cyr -# Copyright (C) 2007 Mario Limonciello -# Copyright (C) 2009 Alberto Milone -DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,') -CVERSION=`dpkg-query -W -f='${Version}' $DEB_NAME | awk -F "-" '{print $1}' | cut -d\: -f2` -ARCH=`dpkg --print-architecture` - -dkms_configure () { - for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do - if [ -f "$POSTINST" ]; then - "$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2" - return $? - fi - echo "WARNING: $POSTINST does not exist." >&2 - done - echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2 - echo "built with legacy DKMS support." >&2 - echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2 - echo "support or upgrade DKMS to a more current version." >&2 - return 1 -} - -# End dkms standard postinst - -case "$1" in - configure) - # Run standard dkms build/install for all kernels with headers installed - dkms_configure - - # Attempt to (re-)load module immediately, fail silently if not possible at this stage - - # Also stop tccd service if running before - echo "Check tccd running status" - if systemctl is-active --quiet tccd.service; then - TCCD_RUNNING=true - else - TCCD_RUNNING=false - fi - - if $TCCD_RUNNING; then - echo "Stop tccd temporarily" - systemctl stop tccd 2>&1 || true - fi - - echo "(Re)load modules if possible" - rmmod tuxedo_io > /dev/null 2>&1 || true - rmmod uniwill_wmi > /dev/null 2>&1 || true - rmmod clevo_wmi > /dev/null 2>&1 || true - rmmod clevo_acpi > /dev/null 2>&1 || true - rmmod tuxedo_keyboard > /dev/null 2>&1 || true - - modprobe tuxedo_keyboard > /dev/null 2>&1 || true - modprobe uniwill_wmi > /dev/null 2>&1 || true - modprobe clevo_wmi > /dev/null 2>&1 || true - modprobe clevo_acpi > /dev/null 2>&1 || true - modprobe tuxedo_io > /dev/null 2>&1 || true - - # Restart tccd after reload if it was running - if $TCCD_RUNNING; then - echo "Start tccd again" - systemctl start tccd 2>&1 || true - fi - - # Install default config if none exist already - if [ ! -f "/etc/modprobe.d/tuxedo_keyboard.conf" ]; then - cp -f /usr/share/tuxedo-keyboard/tuxedo_keyboard.conf /etc/modprobe.d/tuxedo_keyboard.conf - fi - - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -exit 0 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/prerm clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/prerm --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/prerm 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/DEBIAN/prerm 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -#!/bin/sh - -module=module-name -version=x.x.x - -set -e - -case "$1" in - remove) - if [ "`dkms status -m $module`" ] - then - dkms remove -m $module -v $version --all - # Attempt to remove module, fail silently if module is already unloaded - rmmod -s $module > /dev/null 2>&1 || true - fi - rm -f /etc/modprobe.d/tuxedo_keyboard.conf || true - ;; - - upgrade|deconfigure) - if [ "`dkms status -m $module`" ] - then - dkms remove -m $module -v $version --all - # Attempt to remove module, fail silently if module is already unloaded - rmmod -s $module > /dev/null 2>&1 || true - fi - ;; - - failed-upgrade) - ;; - - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - - - -exit 0 - - Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/changelog.gz and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/changelog.gz differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/copyright clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/copyright --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/copyright 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/deb/module-name/usr/share/doc/module-name/copyright 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: tuxedo-keyboard -Upstream-Contact: TUXEDO Computers GmbH - -Files: * -Copyright: 2020 TUXEDO Computers GmbH -License: GPL-3+ - -License: GPL-3+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see . - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in '/usr/share/common-licenses/GPL-3'. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/dkms.conf clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/dkms.conf --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/dkms.conf 2023-05-24 22:41:29.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/dkms.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -PACKAGE_NAME=clevo-keyboard -PACKAGE_VERSION=3.2.5 - -DEST_MODULE_LOCATION[0]="/kernel/lib/" -BUILT_MODULE_NAME[0]="clevo_keyboard" -BUILT_MODULE_LOCATION[0]="src/" - -DEST_MODULE_LOCATION[1]="/kernel/lib/" -BUILT_MODULE_NAME[1]="clevo_wmi" -BUILT_MODULE_LOCATION[1]="src/" - -DEST_MODULE_LOCATION[2]="/kernel/lib/" -BUILT_MODULE_NAME[2]="clevo_acpi" -BUILT_MODULE_LOCATION[2]="src/" - -MAKE[0]="make KDIR=/lib/modules/${kernelver}/build" -CLEAN="make clean" -AUTOINSTALL="yes" diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/config clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/config --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/config 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/config 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true -[remote "origin"] - url = https://github.com/tuxedocomputers/tuxedo-keyboard.git - fetch = +refs/heads/*:refs/remotes/origin/* -[branch "master"] - remote = origin - merge = refs/heads/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/description clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/description --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/description 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/description 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -Unnamed repository; edit this file 'description' to name the repository. diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/HEAD 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/HEAD 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ref: refs/heads/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/applypatch-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/applypatch-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/applypatch-msg.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/applypatch-msg.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message taken by -# applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. The hook is -# allowed to edit the commit message file. -# -# To enable this hook, rename this file to "applypatch-msg". - -. git-sh-setup -commitmsg="$(git rev-parse --git-path hooks/commit-msg)" -test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} -: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/commit-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/commit-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/commit-msg.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#!/bin/sh -# -# An example hook script to check the commit log message. -# Called by "git commit" with one argument, the name of the file -# that has the commit message. The hook should exit with non-zero -# status after issuing an appropriate message if it wants to stop the -# commit. The hook is allowed to edit the commit message file. -# -# To enable this hook, rename this file to "commit-msg". - -# Uncomment the below to add a Signed-off-by line to the message. -# Doing this in a hook is a bad idea in general, but the prepare-commit-msg -# hook is more suited to it. -# -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" - -# This example catches duplicate Signed-off-by lines. - -test "" = "$(grep '^Signed-off-by: ' "$1" | - sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { - echo >&2 Duplicate Signed-off-by lines. - exit 1 -} diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/fsmonitor-watchman.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/fsmonitor-watchman.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/fsmonitor-watchman.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/fsmonitor-watchman.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use IPC::Open2; - -# An example hook script to integrate Watchman -# (https://facebook.github.io/watchman/) with git to speed up detecting -# new and modified files. -# -# The hook is passed a version (currently 2) and last update token -# formatted as a string and outputs to stdout a new update token and -# all files that have been modified since the update token. Paths must -# be relative to the root of the working tree and separated by a single NUL. -# -# To enable this hook, rename this file to "query-watchman" and set -# 'git config core.fsmonitor .git/hooks/query-watchman' -# -my ($version, $last_update_token) = @ARGV; - -# Uncomment for debugging -# print STDERR "$0 $version $last_update_token\n"; - -# Check the hook interface version -if ($version ne 2) { - die "Unsupported query-fsmonitor hook version '$version'.\n" . - "Falling back to scanning...\n"; -} - -my $git_work_tree = get_working_dir(); - -my $retry = 1; - -my $json_pkg; -eval { - require JSON::XS; - $json_pkg = "JSON::XS"; - 1; -} or do { - require JSON::PP; - $json_pkg = "JSON::PP"; -}; - -launch_watchman(); - -sub launch_watchman { - my $o = watchman_query(); - if (is_work_tree_watched($o)) { - output_result($o->{clock}, @{$o->{files}}); - } -} - -sub output_result { - my ($clockid, @files) = @_; - - # Uncomment for debugging watchman output - # open (my $fh, ">", ".git/watchman-output.out"); - # binmode $fh, ":utf8"; - # print $fh "$clockid\n@files\n"; - # close $fh; - - binmode STDOUT, ":utf8"; - print $clockid; - print "\0"; - local $, = "\0"; - print @files; -} - -sub watchman_clock { - my $response = qx/watchman clock "$git_work_tree"/; - die "Failed to get clock id on '$git_work_tree'.\n" . - "Falling back to scanning...\n" if $? != 0; - - return $json_pkg->new->utf8->decode($response); -} - -sub watchman_query { - my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') - or die "open2() failed: $!\n" . - "Falling back to scanning...\n"; - - # In the query expression below we're asking for names of files that - # changed since $last_update_token but not from the .git folder. - # - # To accomplish this, we're using the "since" generator to use the - # recency index to select candidate nodes and "fields" to limit the - # output to file names only. Then we're using the "expression" term to - # further constrain the results. - if (substr($last_update_token, 0, 1) eq "c") { - $last_update_token = "\"$last_update_token\""; - } - my $query = <<" END"; - ["query", "$git_work_tree", { - "since": $last_update_token, - "fields": ["name"], - "expression": ["not", ["dirname", ".git"]] - }] - END - - # Uncomment for debugging the watchman query - # open (my $fh, ">", ".git/watchman-query.json"); - # print $fh $query; - # close $fh; - - print CHLD_IN $query; - close CHLD_IN; - my $response = do {local $/; }; - - # Uncomment for debugging the watch response - # open ($fh, ">", ".git/watchman-response.json"); - # print $fh $response; - # close $fh; - - die "Watchman: command returned no output.\n" . - "Falling back to scanning...\n" if $response eq ""; - die "Watchman: command returned invalid output: $response\n" . - "Falling back to scanning...\n" unless $response =~ /^\{/; - - return $json_pkg->new->utf8->decode($response); -} - -sub is_work_tree_watched { - my ($output) = @_; - my $error = $output->{error}; - if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { - $retry--; - my $response = qx/watchman watch "$git_work_tree"/; - die "Failed to make watchman watch '$git_work_tree'.\n" . - "Falling back to scanning...\n" if $? != 0; - $output = $json_pkg->new->utf8->decode($response); - $error = $output->{error}; - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - # Uncomment for debugging watchman output - # open (my $fh, ">", ".git/watchman-output.out"); - # close $fh; - - # Watchman will always return all files on the first query so - # return the fast "everything is dirty" flag to git and do the - # Watchman query just to get it over with now so we won't pay - # the cost in git to look up each individual file. - my $o = watchman_clock(); - $error = $output->{error}; - - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - output_result($o->{clock}, ("/")); - $last_update_token = $o->{clock}; - - eval { launch_watchman() }; - return 0; - } - - die "Watchman: $error.\n" . - "Falling back to scanning...\n" if $error; - - return 1; -} - -sub get_working_dir { - my $working_dir; - if ($^O =~ 'msys' || $^O =~ 'cygwin') { - $working_dir = Win32::GetCwd(); - $working_dir =~ tr/\\/\//; - } else { - require Cwd; - $working_dir = Cwd::cwd(); - } - - return $working_dir; -} diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/post-update.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/post-update.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/post-update.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/post-update.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare a packed repository for use over -# dumb transports. -# -# To enable this hook, rename this file to "post-update". - -exec git update-server-info diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-applypatch.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-applypatch.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-applypatch.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-applypatch.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed -# by applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-applypatch". - -. git-sh-setup -precommit="$(git rev-parse --git-path hooks/pre-commit)" -test -x "$precommit" && exec "$precommit" ${1+"$@"} -: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-commit.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-commit.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-commit.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-commit.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-commit". - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(git hash-object -t tree /dev/null) -fi - -# If you want to allow non-ASCII filenames set this variable to true. -allownonascii=$(git config --type=bool hooks.allownonascii) - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ASCII filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - cat <<\EOF -Error: Attempt to add a non-ASCII file name. - -This can cause problems if you want to work with people on other platforms. - -To be portable it is advisable to rename the file. - -If you know what you are doing you can disable this check using: - - git config hooks.allownonascii true -EOF - exit 1 -fi - -# If there are whitespace errors, print the offending file names and fail. -exec git diff-index --check --cached $against -- diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-merge-commit.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-merge-commit.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-merge-commit.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-merge-commit.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git merge" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message to -# stderr if it wants to stop the merge commit. -# -# To enable this hook, rename this file to "pre-merge-commit". - -. git-sh-setup -test -x "$GIT_DIR/hooks/pre-commit" && - exec "$GIT_DIR/hooks/pre-commit" -: diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/prepare-commit-msg.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/prepare-commit-msg.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/prepare-commit-msg.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/prepare-commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#!/bin/sh -# -# An example hook script to prepare the commit log message. -# Called by "git commit" with the name of the file that has the -# commit message, followed by the description of the commit -# message's source. The hook's purpose is to edit the commit -# message file. If the hook fails with a non-zero status, -# the commit is aborted. -# -# To enable this hook, rename this file to "prepare-commit-msg". - -# This hook includes three examples. The first one removes the -# "# Please enter the commit message..." help message. -# -# The second includes the output of "git diff --name-status -r" -# into the message, just before the "git status" output. It is -# commented because it doesn't cope with --amend or with squashed -# commits. -# -# The third example adds a Signed-off-by line to the message, that can -# still be edited. This is rarely a good idea. - -COMMIT_MSG_FILE=$1 -COMMIT_SOURCE=$2 -SHA1=$3 - -/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" - -# case "$COMMIT_SOURCE,$SHA1" in -# ,|template,) -# /usr/bin/perl -i.bak -pe ' -# print "\n" . `git diff --cached --name-status -r` -# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; -# *) ;; -# esac - -# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" -# if test -z "$COMMIT_SOURCE" -# then -# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" -# fi diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-push.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-push.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-push.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-push.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#!/bin/sh - -# An example hook script to verify what is about to be pushed. Called by "git -# push" after it has checked the remote status, but before anything has been -# pushed. If this script exits with a non-zero status nothing will be pushed. -# -# This hook is called with the following parameters: -# -# $1 -- Name of the remote to which the push is being done -# $2 -- URL to which the push is being done -# -# If pushing without using a named remote those arguments will be equal. -# -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# -# -# -# This sample shows how to prevent push of commits where the log message starts -# with "WIP" (work in progress). - -remote="$1" -url="$2" - -zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" - exit 1 - fi - fi -done - -exit 0 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-rebase.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-rebase.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-rebase.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-rebase.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,169 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2006, 2008 Junio C Hamano -# -# The "pre-rebase" hook is run just before "git rebase" starts doing -# its job, and can prevent the command from running by exiting with -# non-zero status. -# -# The hook is called with the following parameters: -# -# $1 -- the upstream the series was forked from. -# $2 -- the branch being rebased (or empty when rebasing the current branch). -# -# This sample shows how to prevent topic branches that are already -# merged to 'next' branch from getting rebased, because allowing it -# would result in rebasing already published history. - -publish=next -basebranch="$1" -if test "$#" = 2 -then - topic="refs/heads/$2" -else - topic=`git symbolic-ref HEAD` || - exit 0 ;# we do not interrupt rebasing detached HEAD -fi - -case "$topic" in -refs/heads/??/*) - ;; -*) - exit 0 ;# we do not interrupt others. - ;; -esac - -# Now we are dealing with a topic branch being rebased -# on top of master. Is it OK to rebase it? - -# Does the topic really exist? -git show-ref -q "$topic" || { - echo >&2 "No such branch $topic" - exit 1 -} - -# Is topic fully merged to master? -not_in_master=`git rev-list --pretty=oneline ^master "$topic"` -if test -z "$not_in_master" -then - echo >&2 "$topic is fully merged to master; better remove it." - exit 1 ;# we could allow it, but there is no point. -fi - -# Is topic ever merged to next? If so you should not be rebasing it. -only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` -only_next_2=`git rev-list ^master ${publish} | sort` -if test "$only_next_1" = "$only_next_2" -then - not_in_topic=`git rev-list "^$topic" master` - if test -z "$not_in_topic" - then - echo >&2 "$topic is already up to date with master" - exit 1 ;# we could allow it, but there is no point. - else - exit 0 - fi -else - not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` - /usr/bin/perl -e ' - my $topic = $ARGV[0]; - my $msg = "* $topic has commits already merged to public branch:\n"; - my (%not_in_next) = map { - /^([0-9a-f]+) /; - ($1 => 1); - } split(/\n/, $ARGV[1]); - for my $elem (map { - /^([0-9a-f]+) (.*)$/; - [$1 => $2]; - } split(/\n/, $ARGV[2])) { - if (!exists $not_in_next{$elem->[0]}) { - if ($msg) { - print STDERR $msg; - undef $msg; - } - print STDERR " $elem->[1]\n"; - } - } - ' "$topic" "$not_in_next" "$not_in_master" - exit 1 -fi - -<<\DOC_END - -This sample hook safeguards topic branches that have been -published from being rewound. - -The workflow assumed here is: - - * Once a topic branch forks from "master", "master" is never - merged into it again (either directly or indirectly). - - * Once a topic branch is fully cooked and merged into "master", - it is deleted. If you need to build on top of it to correct - earlier mistakes, a new topic branch is created by forking at - the tip of the "master". This is not strictly necessary, but - it makes it easier to keep your history simple. - - * Whenever you need to test or publish your changes to topic - branches, merge them into "next" branch. - -The script, being an example, hardcodes the publish branch name -to be "next", but it is trivial to make it configurable via -$GIT_DIR/config mechanism. - -With this workflow, you would want to know: - -(1) ... if a topic branch has ever been merged to "next". Young - topic branches can have stupid mistakes you would rather - clean up before publishing, and things that have not been - merged into other branches can be easily rebased without - affecting other people. But once it is published, you would - not want to rewind it. - -(2) ... if a topic branch has been fully merged to "master". - Then you can delete it. More importantly, you should not - build on top of it -- other people may already want to - change things related to the topic as patches against your - "master", so if you need further changes, it is better to - fork the topic (perhaps with the same name) afresh from the - tip of "master". - -Let's look at this example: - - o---o---o---o---o---o---o---o---o---o "next" - / / / / - / a---a---b A / / - / / / / - / / c---c---c---c B / - / / / \ / - / / / b---b C \ / - / / / / \ / - ---o---o---o---o---o---o---o---o---o---o---o "master" - - -A, B and C are topic branches. - - * A has one fix since it was merged up to "next". - - * B has finished. It has been fully merged up to "master" and "next", - and is ready to be deleted. - - * C has not merged to "next" at all. - -We would want to allow C to be rebased, refuse A, and encourage -B to be deleted. - -To compute (1): - - git rev-list ^master ^topic next - git rev-list ^master next - - if these match, topic has not merged in next at all. - -To compute (2): - - git rev-list master..topic - - if this is empty, it is fully merged to "master". - -DOC_END diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-receive.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-receive.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/pre-receive.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/pre-receive.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#!/bin/sh -# -# An example hook script to make use of push options. -# The example simply echoes all push options that start with 'echoback=' -# and rejects all pushes when the "reject" push option is used. -# -# To enable this hook, rename this file to "pre-receive". - -if test -n "$GIT_PUSH_OPTION_COUNT" -then - i=0 - while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" - do - eval "value=\$GIT_PUSH_OPTION_$i" - case "$value" in - echoback=*) - echo "echo from the pre-receive-hook: ${value#*=}" >&2 - ;; - reject) - exit 1 - esac - i=$((i + 1)) - done -fi diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/push-to-checkout.sample clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/push-to-checkout.sample --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/hooks/push-to-checkout.sample 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/hooks/push-to-checkout.sample 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -#!/bin/sh - -# An example hook script to update a checked-out tree on a git push. -# -# This hook is invoked by git-receive-pack(1) when it reacts to git -# push and updates reference(s) in its repository, and when the push -# tries to update the branch that is currently checked out and the -# receive.denyCurrentBranch configuration variable is set to -# updateInstead. -# -# By default, such a push is refused if the working tree and the index -# of the remote repository has any difference from the currently -# checked out commit; when both the working tree and the index match -# the current commit, they are updated to match the newly pushed tip -# of the branch. This hook is to be used to override the default -# behaviour; however the code below reimplements the default behaviour -# as a starting point for convenient modification. -# -# The hook receives the commit with which the tip of the current -# branch is going to be updated: -commit=$1 - -# It can exit with a non-zero status to refuse the push (when it does -# so, it must not modify the index or the working tree). -die () { - echo >&2 "$*" - exit 1 -} - -# Or it can make any necessary changes to the working tree and to the -# index to bring them to the desired state when the tip of the current -# branch is updated to the new commit, and exit with a zero status. -# -# For example, the hook can simply run git read-tree -u -m HEAD "$1" -# in order to emulate git fetch that is run in the reverse direction -# with git push, as the two-tree form of git read-tree -u -m is -# essentially the same as git switch or git checkout that switches -# branches while keeping the local changes in the working tree that do -# not interfere with the difference between the branches. - -# The below is a more-or-less exact translation to shell of the C code -# for the default behaviour for git's push-to-checkout hook defined in -# the push_to_deploy() function in builtin/receive-pack.c. -# -# Note that the hook will be executed from the repository directory, -# not from the working tree, so if you want to perform operations on -# the working tree, you will have to adapt your code accordingly, e.g. -# by adding "cd .." or using relative paths. - -if ! git update-index -q --ignore-submodules --refresh -then - die "Up-to-date check failed" -fi - -if ! git diff-files --quiet --ignore-submodules -- -then - die "Working directory has unstaged changes" -fi - -# This is a rough translation of: -# -# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX -if git cat-file -e HEAD 2>/dev/null -then - head=HEAD -else - head=$(git hash-object -t tree --stdin &2 - echo " (if you want, you could supply GIT_DIR then run" >&2 - echo " $0 )" >&2 - exit 1 -fi - -if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then - echo "usage: $0 " >&2 - exit 1 -fi - -# --- Config -allowunannotated=$(git config --type=bool hooks.allowunannotated) -allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) -denycreatebranch=$(git config --type=bool hooks.denycreatebranch) -allowdeletetag=$(git config --type=bool hooks.allowdeletetag) -allowmodifytag=$(git config --type=bool hooks.allowmodifytag) - -# check for no description -projectdesc=$(sed -e '1q' "$GIT_DIR/description") -case "$projectdesc" in -"Unnamed repository"* | "") - echo "*** Project description file hasn't been set" >&2 - exit 1 - ;; -esac - -# --- Check types -# if $newrev is 0000...0000, it's a commit to delete a ref. -zero=$(git hash-object --stdin &2 - echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 - exit 1 - fi - ;; - refs/tags/*,delete) - # delete tag - if [ "$allowdeletetag" != "true" ]; then - echo "*** Deleting a tag is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/tags/*,tag) - # annotated tag - if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 - then - echo "*** Tag '$refname' already exists." >&2 - echo "*** Modifying a tag is not allowed in this repository." >&2 - exit 1 - fi - ;; - refs/heads/*,commit) - # branch - if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then - echo "*** Creating a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/heads/*,delete) - # delete branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/remotes/*,commit) - # tracking branch - ;; - refs/remotes/*,delete) - # delete tracking branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a tracking branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - *) - # Anything else (is there anything else?) - echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 - exit 1 - ;; -esac - -# --- Finished -exit 0 Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/index and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/index differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/info/exclude clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/info/exclude --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/info/exclude 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/info/exclude 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/HEAD 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/HEAD 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 08502a69045bd3152efef6af151597ea008ae779 caligaris 1684966733 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard.git diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/refs/heads/master clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/refs/heads/master --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/refs/heads/master 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 08502a69045bd3152efef6af151597ea008ae779 caligaris 1684966733 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard.git diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/refs/remotes/origin/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/refs/remotes/origin/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/logs/refs/remotes/origin/HEAD 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/logs/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 08502a69045bd3152efef6af151597ea008ae779 caligaris 1684966733 -0400 clone: from https://github.com/tuxedocomputers/tuxedo-keyboard.git Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/objects/pack/pack-99eef0f06b461b6eb3d8d493ca843e8286226673.idx and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/objects/pack/pack-99eef0f06b461b6eb3d8d493ca843e8286226673.idx differ Binary files /tmp/tmpl2wtbts7/PZCHAKoGds/clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/objects/pack/pack-99eef0f06b461b6eb3d8d493ca843e8286226673.pack and /tmp/tmpl2wtbts7/aS5fZ3ISA9/clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/objects/pack/pack-99eef0f06b461b6eb3d8d493ca843e8286226673.pack differ diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/packed-refs clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/packed-refs --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/packed-refs 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/packed-refs 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -# pack-refs with: peeled fully-peeled sorted -25ca08a9956865d67ef296f8a4f6b42f9ca97404 refs/remotes/origin/led_code_diagnostics -08502a69045bd3152efef6af151597ea008ae779 refs/remotes/origin/master -8ce032f5d57477b07fb227be7ca14ff286034152 refs/remotes/origin/release -94f5d5239852041cf6cbd507e15746148fad8434 refs/remotes/origin/relicensing-gplv2 -7f6018afa8c8973654657ad56abfe18900788dc3 refs/tags/v2.0.2 -^8c3387e840fdbcfba296e8842aa4e8bced10c8d1 -2c7a194ef5946c4ed1f02a2ddefbad592fc25928 refs/tags/v2.0.3 -^fd21208d669e23851e73ed91c5b4f4276c286c23 -729abfcc05bc34a2bd5c58d0c68f2e4e19d9e903 refs/tags/v2.0.4 -^609c5f19dbe1d8f42fc37022f41a86d7e5f789ec -3cdc7ba449c0309fe47fa270b69b6ef1b5e1dca8 refs/tags/v2.0.5 -^84442d0b2f3d3bff691ce8b96bb3baced4d692c0 -21a33a222520d8f6cf9fbd12917e751c4a9473d1 refs/tags/v2.0.6 -^fbd1cd8e8a4059d4d1d9c643ab495c9854c50002 -b60a7e87c9b90039ffbcd169991f3de6cbdf227a refs/tags/v2.1.0 -^878a528223f24b82f205156fc9f1c7aca13c87f9 -3a3f90022094f7e94c08e2822b5ee19f6e54289d refs/tags/v3.0.0 -^c25363c133b9528192d1c9ae74dd40ce2dae17be -4033303f22e5fbf72550d3cb14771262e1f1f52b refs/tags/v3.0.1 -^4f763e9e74ea4bcd8a5f6973844c6ec11a012174 -37d48651aad09c1965391f9581ec16242598fb62 refs/tags/v3.0.10 -^48666348c69e8dcf520e413cf61f1a33d16df9c0 -c52dddaeed29a08bc6acfddf4f7c3cd83e8086e1 refs/tags/v3.0.11 -^824933fc7029dc784362763d4e20bcc6167ea129 -0c03ca0ee49f8aa9e3a10ea6b5da4adcceb40bdd refs/tags/v3.0.2 -^4296f75372213c37a022f6ccff4340ea7063a223 -e0c7ea060c3a7f78374419a7a502ec87319de7e5 refs/tags/v3.0.3 -^852c28cec45d3970e5b844cbd780e67ec914428e -cf3f6453e2432bb8b4f5be7e2864a808cd2b50af refs/tags/v3.0.4 -^fd683d410b2c778c63d61a448e5a406e341f277c -8d4b34d501e7dce4137d65169dad1f1630331beb refs/tags/v3.0.5 -^8a965edb336210e86d3748706152d16b3760d563 -367193e7d3926d0efb9dbb93870e9836c539a589 refs/tags/v3.0.6 -^d7f358a7786074a9321e3ff953037fdc8f02c494 -e85b336763930aac084175c0de22300f35db4e9a refs/tags/v3.0.7 -^aae9f01feba6a1c13c2d8c23e42fd75da463a3e1 -d0d0e5adb8679e5ae40ecb9c7d3aba340c8f5c88 refs/tags/v3.0.8 -^914e50b1608aa795f7322822c0151708e9942515 -057e497009d020ab945e0260c63480674029a020 refs/tags/v3.0.9 -^e1c8e5bf3b457a3ed2c9903c374d3713e6998f94 -0eaf1ad802e4cf9f142d90d7adbfa0e8306b6300 refs/tags/v3.1.0 -^e8dc238ae139a259134088a64f6789fef446976e -3a0b98384e72404e7c9b174f64bb9f47e99827af refs/tags/v3.1.1 -^b46ca9ef44568c6c384929a73624bd9ba9158577 -17c1294c415e4ebff068a26bd9be01cd3de9f547 refs/tags/v3.1.2 -^88363ec0309fe4b490d1f9576c45bd5b4d12c552 -0cdd0b6d0316bf72e870ac8fead41f7b049c8d6b refs/tags/v3.1.3 -^cd907695b548d91d73ab9c34886f07aceb02ed57 -385b8ea2cf5826d8795ec29f2a24d2f38d138667 refs/tags/v3.1.4 -^c3e03cbd7c314e3462de364b569788be2da86f70 -8e2c4280dd963577c8bc9a0dd1283e397cde340b refs/tags/v3.2.0 -^4749901db2dcc3430bf6497086bb9fefbac7eeff -3207ca33301e7667afbbb86e1141441c594109d7 refs/tags/v3.2.1 -^131af916be7298ef3516c453fd17189c78c40554 -e40d67e13446bff5f12af87686bef74b73920238 refs/tags/v3.2.3 -^c202a4d671d9fe920a023d280a66a9f116e14759 -316bfb45395f638857ecca6d5c83b43128430d1a refs/tags/v3.2.5 -^08502a69045bd3152efef6af151597ea008ae779 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/refs/heads/master clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/refs/heads/master --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/refs/heads/master 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -08502a69045bd3152efef6af151597ea008ae779 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/refs/remotes/origin/HEAD clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/refs/remotes/origin/HEAD --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.git/refs/remotes/origin/HEAD 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.git/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ref: refs/remotes/origin/master diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.gitignore clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.gitignore --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.gitignore 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old - -*.mk - -.vscode/ -*.kdev4 - -# Packaging -rpm -deb/tuxedo-keyboard-* -*.deb -*.rpm diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.gitlab-ci.yml clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.gitlab-ci.yml --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/.gitlab-ci.yml 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -image: debian:latest - -variables: - DEBIAN_FRONTEND: noninteractive - PACKAGES_FOLDER_NAME: $CI_PROJECT_DIR/packages - -before_script: - - apt-get update -qq - - apt-get install -qq -y dpkg dpkg-dev make rpm tar > /dev/null 2>&1 - -stages: - - build_packages - -packaging: - stage: build_packages - only: - refs: - - release - script: - - make package - - mkdir $PACKAGES_FOLDER_NAME - - mv *.deb $PACKAGES_FOLDER_NAME/ - - mv *.rpm $PACKAGES_FOLDER_NAME/ - artifacts: - name: tuxedo-keyboard-${CI_COMMIT_REF_SLUG} - when: on_success - paths: - - $PACKAGES_FOLDER_NAME/* diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/keyboard-colors/green.conf clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/keyboard-colors/green.conf --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/keyboard-colors/green.conf 2021-09-07 23:22:33.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/keyboard-colors/green.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -options clevo-keyboard mode=0 brightness=20 color_left=0x00CED1 color_center=0x00CED1 color_right=0x00CED1 diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/keyboard-colors/white.conf clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/keyboard-colors/white.conf --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/keyboard-colors/white.conf 2021-09-07 23:22:06.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/keyboard-colors/white.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -options clevo-keyboard mode=0 brightness=20 color_left=0xFFFFFF color_center=0xFFFFFF color_right=0xFFFFFF diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/LICENSE clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/LICENSE --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/LICENSE 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/LICENSE 1970-01-01 00:00:00.000000000 +0000 @@ -1,675 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/Makefile clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/Makefile --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/Makefile 2023-05-24 22:42:04.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -# -# Copyright (c) 2018-2020 TUXEDO Computers GmbH -# -# This file is part of tuxedo-keyboard. -# -# tuxedo-keyboard is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see . -# -obj-m := ./src/clevo_keyboard.o \ - ./src/clevo_wmi.o \ - ./src/clevo_acpi.o - -PWD := $(shell pwd) -KDIR := /lib/modules/$(shell uname -r)/build - -all: - make -C $(KDIR) M=$(PWD) modules - -clean: - make -C $(KDIR) M=$(PWD) clean - -install: - make -C $(KDIR) M=$(PWD) modules_install - -# Package version and name from dkms.conf -VER := $(shell sed -n 's/^PACKAGE_VERSION=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null) -MODULE_NAME := $(shell sed -n 's/^PACKAGE_NAME=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null) - -dkmsinstall: - cp -R . /usr/src/$(MODULE_NAME)-$(VER) - dkms install -m $(MODULE_NAME) -v $(VER) - -dkmsremove: - dkms remove -m $(MODULE_NAME) -v $(VER) --all - rm -rf /usr/src/$(MODULE_NAME)-$(VER) - -# -------------- -# Packaging only -# --------------- - -DEB_PACKAGE_NAME := $(MODULE_NAME)-$(VER) - -# Deb package folder variables -DEB_PACKAGE_BASE := deb/$(DEB_PACKAGE_NAME) -DEB_PACKAGE_SRC := $(DEB_PACKAGE_BASE)/usr/src/$(DEB_PACKAGE_NAME) -DEB_PACKAGE_CTRL := $(DEB_PACKAGE_BASE)/DEBIAN - -package: package-deb package-rpm -package-clean: package-deb-clean package-rpm-clean - -package-deb: - # Create/complete folder structure according to current version - rm -rf $(DEB_PACKAGE_BASE) || true - cp -rf deb/module-name $(DEB_PACKAGE_BASE) - mv $(DEB_PACKAGE_BASE)/usr/share/doc/module-name $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME) - mkdir -p $(DEB_PACKAGE_BASE)/usr/src || true - mkdir -p $(DEB_PACKAGE_SRC) || true - mkdir -p $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME) || true - - # Replace name/version numbers in control/script files - sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(DEB_PACKAGE_CTRL)/control - sed -i 's/^Package:[^\n]*/Package: $(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/control - sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/postinst - sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/postinst - sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/prerm - sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/prerm - # Copy source - cp -rf dkms.conf $(DEB_PACKAGE_SRC) - cp -rf Makefile $(DEB_PACKAGE_SRC) - cp -rf src $(DEB_PACKAGE_SRC) - cp -rf src_pkg/dkms_postinst $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst - cp -rf tuxedo_keyboard.conf $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf - # Make sure files and folders have acceptable permissions - chmod -R 755 $(DEB_PACKAGE_CTRL) - chmod 644 $(DEB_PACKAGE_CTRL)/control - find deb/$(DEB_PACKAGE_NAME)/usr -type d -exec chmod 755 {} \; - find deb/$(DEB_PACKAGE_NAME)/usr -type f -exec chmod 644 {} \; - chmod 755 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst - chmod 644 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf - - gunzip $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog.gz - gzip -n9 $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog - - # Make deb package - dpkg-deb --root-owner-group -b $(DEB_PACKAGE_BASE) $(DEB_PACKAGE_NAME).deb - -package-deb-clean: - rm -rf deb/$(MODULE_NAME)-* > /dev/null 2>&1 || true - rm *.deb > /dev/null 2>&1 || true - -RPM_PACKAGE_NAME := $(MODULE_NAME)-$(VER) -RPM_PACKAGE_SRC := rpm/SOURCES/$(RPM_PACKAGE_NAME) -RPM_SPEC := rpm/SPECS/$(MODULE_NAME).spec -RELEASE := 1 - -package-rpm: - # Create folder source structure according to current version - rm -rf rpm || true - mkdir -p $(RPM_PACKAGE_SRC) - mkdir -p rpm/SPECS - # Copy spec template - cp -rf src_pkg/rpm_pkg.spec $(RPM_SPEC) - # Modify spec file with version etc. - sed -i 's/^%define module[^\n]*/%define module $(MODULE_NAME)/g' $(RPM_SPEC) - sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(RPM_SPEC) - sed -i 's/^Release:[^\n]*/Release: $(RELEASE)/g' $(RPM_SPEC) - # Copy source - cp -rf dkms.conf $(RPM_PACKAGE_SRC) - cp -rf Makefile $(RPM_PACKAGE_SRC) - cp -rf src $(RPM_PACKAGE_SRC) - cp -rf LICENSE $(RPM_PACKAGE_SRC) - cp -rf src_pkg/dkms_postinst $(RPM_PACKAGE_SRC)/postinst - cp -rf tuxedo_keyboard.conf $(RPM_PACKAGE_SRC) - # Compress/package source - cd rpm/SOURCES && tar cjvf $(RPM_PACKAGE_NAME).tar.bz2 $(RPM_PACKAGE_NAME) - # Make rpm package - rpmbuild --debug -bb --define "_topdir `pwd`/rpm" $(RPM_SPEC) - # Copy built package - cp rpm/RPMS/noarch/*.rpm . - -package-rpm-clean: - rm -rf rpm > /dev/null 2>&1 || true - rm *.rpm > /dev/null 2>&1 || true diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/README.md clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/README.md --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/README.md 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -# Table of Content -- Description -- Building and Install -- Using - -# Description -TUXEDO Computers kernel module drivers for keyboard, keyboard backlight & general hardware I/O using the SysFS interface (since version 3.2.0) - -Features -- Driver for Fn-keys -- SysFS control of brightness/color/mode for most TUXEDO keyboards - - [https://docs.kernel.org/leds/leds-class.html](https://docs.kernel.org/leds/leds-class.html) - - [https://docs.kernel.org/leds/leds-class-multicolor.html](https://docs.kernel.org/leds/leds-class-multicolor.html) -- Hardware I/O driver for TUXEDO Control Center - -Modules included in this package -- tuxedo-keyboard -- tuxedo-io -- clevo-wmi -- clevo-acpi -- uniwill-wmi - -# Building and Install - -## Dependencies: -- make -- gcc or clang -- linux-headers -- dkms (Only when using this module with DKMS functionality) - -## Warning when installing the module: - -Use either method only. Do not combine installation methods, such as starting with the build step below and proceeding to use the same build artifacts with the DKMS module. Otherwise the module built via dkms will fail to load with an `exec_format` error on newer kernels due to a mismatched version magic. - -This is why the DKMS build step begins with a `make clean` step. - -For convenience, on platforms where DKMS is in use, skip to the DKMS section directly. - -## Clone the Git Repo: - -```sh -git clone https://github.com/tuxedocomputers/tuxedo-keyboard.git - -cd tuxedo-keyboard - -git checkout release -``` - -## Build the Module: - -```sh -make clean && make -``` - -## The DKMS route: - -### Add as DKMS Module: - -Install the Module: -```sh -make clean - -sudo make dkmsinstall -``` - -Load the Module with modprobe: -```sh -modprobe tuxedo_keyboard -``` -or -```sh -sudo modprobe tuxedo_keyboard -``` - -You might also want to activate `tuxedo_io` module the same way if you are using [TCC](https://github.com/tuxedocomputers/tuxedo-control-center). - -### Uninstalling the DKMS module: - -Remove the DKMS module and source: -```sh -sudo make dkmsremove - -sudo rm /etc/modprobe.d/tuxedo_keyboard.conf -``` - -# Using - -## modprobe - -```sh -modprobe tuxedo_keyboard -``` - -## Load the Module on boot: - -If a module is relevant it will be loaded automatically on boot. If it is not loaded after a reboot, it most likely means that it is not needed. - -Add Module to /etc/modules -```sh -sudo su - -echo tuxedo_keyboard >> /etc/modules -``` diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_acpi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_acpi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_acpi.c 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_acpi.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ -/*! - * Copyright (c) 2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include -#include -#include -#include -#include "clevo_interfaces.h" - -#define DRIVER_NAME "clevo_acpi" - -struct clevo_acpi_driver_data_t { - struct acpi_device *adev; - struct clevo_interface_t *clevo_interface; -}; - -static struct clevo_acpi_driver_data_t *active_driver_data = NULL; - -static u32 clevo_acpi_evaluate(struct acpi_device *device, u8 cmd, u32 arg, union acpi_object **result) -{ - u32 status; - acpi_handle handle; - u64 dsm_rev_dummy = 0x00; // Dummy 0 value since not used - u64 dsm_func = cmd; - // Integer package data for argument - union acpi_object dsm_argv4_package_data[] = { - { - .integer.type = ACPI_TYPE_INTEGER, - .integer.value = arg - } - }; - - // Package argument - union acpi_object dsm_argv4 = { - .package.type = ACPI_TYPE_PACKAGE, - .package.count = 1, - .package.elements = dsm_argv4_package_data - }; - - union acpi_object *out_obj; - - guid_t clevo_acpi_dsm_uuid; - - status = guid_parse(CLEVO_ACPI_DSM_UUID, &clevo_acpi_dsm_uuid); - if (status < 0) - return -ENOENT; - - handle = acpi_device_handle(device); - if (handle == NULL) - return -ENODEV; - - out_obj = acpi_evaluate_dsm(handle, &clevo_acpi_dsm_uuid, dsm_rev_dummy, dsm_func, &dsm_argv4); - if (!out_obj) { - pr_err("failed to evaluate _DSM\n"); - status = -1; - } - else { - if (!IS_ERR_OR_NULL(result)) { - *result = out_obj; - } - } - - return status; -} - -u32 clevo_acpi_interface_method_call(u8 cmd, u32 arg, union acpi_object **result_value) -{ - u32 status = 0; - - if (!IS_ERR_OR_NULL(active_driver_data)) { - status = clevo_acpi_evaluate(active_driver_data->adev, cmd, arg, result_value); - } else { - pr_err("acpi method call exec, no driver data found\n"); - pr_err("..for method_call: %0#4x arg: %0#10x\n", cmd, arg); - status = -ENODATA; - } - // pr_debug("clevo_acpi method_call: %0#4x arg: %0#10x result: %0#10x\n", cmd, arg, !IS_ERR_OR_NULL(result_value) ? *result_value : 0); - - return status; -} - -struct clevo_interface_t clevo_acpi_interface = { - .string_id = CLEVO_INTERFACE_ACPI_STRID, - .method_call = clevo_acpi_interface_method_call, -}; - -static int clevo_acpi_add(struct acpi_device *device) -{ - struct clevo_acpi_driver_data_t *driver_data; - - driver_data = devm_kzalloc(&device->dev, sizeof(*driver_data), GFP_KERNEL); - if (!driver_data) - return -ENOMEM; - - driver_data->adev = device; - driver_data->clevo_interface = &clevo_acpi_interface; - - active_driver_data = driver_data; - - pr_debug("clevo_acpi driver add\n"); - - // Add this interface - clevo_keyboard_add_interface(&clevo_acpi_interface); - - pr_info("interface initialized\n"); - - return 0; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) -static int clevo_acpi_remove(struct acpi_device *device) -#else -static void clevo_acpi_remove(struct acpi_device *device) -#endif -{ - pr_debug("clevo_acpi driver remove\n"); - clevo_keyboard_remove_interface(&clevo_acpi_interface); - active_driver_data = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) - return 0; -#endif -} - -void clevo_acpi_notify(struct acpi_device *device, u32 event) -{ - u32 event_value; - union acpi_object *out_obj; - u32 status; - // struct clevo_acpi_driver_data_t *clevo_acpi_driver_data; - - status = clevo_acpi_evaluate(device, 0x01, 0, &out_obj); - if (!status) { - if (out_obj->type == ACPI_TYPE_INTEGER) { - event_value = (u32)out_obj->integer.value; - } else { - pr_err("return type not integer, use clevo_evaluate_method2\n"); - } - ACPI_FREE(out_obj); - } - pr_debug("clevo_acpi event: %0#6x, clevo event value: %0#6x\n", event, event_value); - - // clevo_acpi_driver_data = container_of(&device, struct clevo_acpi_driver_data_t, adev); - if (!IS_ERR_OR_NULL(clevo_acpi_interface.event_callb)) { - // Execute registered callback - clevo_acpi_interface.event_callb(event); - } -} - -#ifdef CONFIG_PM -static int driver_suspend_callb(struct device *dev) -{ - pr_debug("driver suspend\n"); - return 0; -} - -static int driver_resume_callb(struct device *dev) -{ - pr_debug("driver resume\n"); - return 0; -} - -static SIMPLE_DEV_PM_OPS(clevo_driver_pm_ops, driver_suspend_callb, driver_resume_callb); -#endif - -static const struct acpi_device_id clevo_acpi_device_ids[] = { - {CLEVO_ACPI_RESOURCE_HID, 0}, - {"", 0} -}; - -static struct acpi_driver clevo_acpi_driver = { - .name = DRIVER_NAME, - .class = DRIVER_NAME, - .owner = THIS_MODULE, - .ids = clevo_acpi_device_ids, - .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, - .ops = { - .add = clevo_acpi_add, - .remove = clevo_acpi_remove, - .notify = clevo_acpi_notify, - }, -#ifdef CONFIG_PM - .drv.pm = &clevo_driver_pm_ops -#endif -}; - -module_acpi_driver(clevo_acpi_driver); - -MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_DESCRIPTION("Driver for Clevo ACPI interface"); -MODULE_VERSION("0.1.0"); -MODULE_LICENSE("GPL"); - -MODULE_DEVICE_TABLE(acpi, clevo_acpi_device_ids); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_interfaces.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_interfaces.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_interfaces.h 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_interfaces.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/*! - * Copyright (c) 2020-2021 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef CLEVO_INTERFACES_H -#define CLEVO_INTERFACES_H - -#include -#include - -#define CLEVO_WMI_EVENT_GUID "ABBC0F6B-8EA1-11D1-00A0-C90629100000" -#define CLEVO_WMI_EMAIL_GUID "ABBC0F6C-8EA1-11D1-00A0-C90629100000" -#define CLEVO_WMI_METHOD_GUID "ABBC0F6D-8EA1-11D1-00A0-C90629100000" - -#define CLEVO_ACPI_RESOURCE_HID "CLV0001" -#define CLEVO_ACPI_DSM_UUID "93f224e4-fbdc-4bbf-add6-db71bdc0afad" - -// The clevo get commands expect no parameters -#define CLEVO_CMD_GET_FANINFO1 0x63 -#define CLEVO_CMD_GET_FANINFO2 0x64 -#define CLEVO_CMD_GET_FANINFO3 0x6e - -#define CLEVO_CMD_GET_WEBCAM_SW 0x06 -#define CLEVO_CMD_GET_FLIGHTMODE_SW 0x07 -#define CLEVO_CMD_GET_TOUCHPAD_SW 0x09 - -#define CLEVO_CMD_GET_EVENT 0x01 - -#define CLEVO_CMD_GET_SPECS 0x0D // Returns buffer -> only works with clevo_evaluate_method2 -#define CLEVO_CMD_GET_BIOS_FEATURES_1 0x52 -#define CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_WHITE_ONLY_KB 0x40000000 -#define CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_3_ZONE_RGB_KB 0x00400000 - -#define CLEVO_CMD_GET_BIOS_FEATURES_2 0x7A -#define CLEVO_CMD_GET_BIOS_FEATURES_2_SUB_WHITE_ONLY_KB_MAX_5 0x4000 - -// The clevo set commands expect a parameter -#define CLEVO_CMD_SET_FANSPEED_VALUE 0x68 -#define CLEVO_CMD_SET_FANSPEED_AUTO 0x69 - -#define CLEVO_CMD_SET_WEBCAM_SW 0x22 -#define CLEVO_CMD_SET_FLIGHTMODE_SW 0x20 -#define CLEVO_CMD_SET_TOUCHPAD_SW 0x2a - -#define CLEVO_CMD_SET_EVENTS_ENABLED 0x46 - -#define CLEVO_CMD_SET_KB_WHITE_LEDS 0x27 // Set brightness of single color keyboard backlights -#define CLEVO_CMD_SET_KB_RGB_LEDS 0x67 // Used to set color, brightness, blinking pattern, etc. -#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 0xF0000000 // 1-zone RGB and 3-zone RGB left -#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 0xF1000000 // 3-zone RGB center -#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 0xF2000000 // 3-Zone RGB right -#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_3 0xF3000000 // Unused on all known Clevo devices -#define CLEVO_CMD_SET_KB_LEDS_SUB_RGB_BRIGHTNESS 0xF4000000 - -#define CLEVO_CMD_OPT 0x79 -#define CLEVO_CMD_OPT_SUB_SET_PERF_PROF 0x19 - -struct clevo_interface_t { - char *string_id; - void (*event_callb)(u32); - u32 (*method_call)(u8, u32, union acpi_object **); -}; - -u32 clevo_keyboard_add_interface(struct clevo_interface_t *new_interface); -u32 clevo_keyboard_remove_interface(struct clevo_interface_t *interface); -u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result); -u32 clevo_evaluate_method2(u8 cmd, u32 arg, union acpi_object **result); -u32 clevo_get_active_interface_id(char **id_str); - -#define MODULE_ALIAS_CLEVO_WMI() \ - MODULE_ALIAS("wmi:" CLEVO_WMI_EVENT_GUID); \ - MODULE_ALIAS("wmi:" CLEVO_WMI_METHOD_GUID); - -#define CLEVO_INTERFACE_WMI_STRID "clevo_wmi" -#define CLEVO_INTERFACE_ACPI_STRID "clevo_acpi" - -#define MODULE_ALIAS_CLEVO_ACPI() \ - MODULE_ALIAS("acpi*:" CLEVO_ACPI_RESOURCE_HID ":*"); - -#define MODULE_ALIAS_CLEVO_INTERFACES() \ - MODULE_ALIAS_CLEVO_WMI(); \ - MODULE_ALIAS_CLEVO_ACPI(); - -#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard.c 2023-05-25 21:17:54.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,310 +0,0 @@ -/*! - * Copyright (c) 2018-2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#define pr_fmt(fmt) "clevo_keyboard" ": " fmt - -#include "clevo_keyboard_common.h" -#include "clevo_keyboard.h" -#include "uniwill_keyboard.h" -#include -#include -#include -#include - -MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_DESCRIPTION("TUXEDO Computers keyboard & keyboard backlight Driver"); -MODULE_LICENSE("GPL"); -MODULE_VERSION("3.2.5"); - -static DEFINE_MUTEX(tuxedo_keyboard_init_driver_lock); - -// static struct tuxedo_keyboard_driver *driver_list[] = { }; - -static int tuxedo_input_init(const struct key_entry key_map[]) -{ - int err; - - tuxedo_input_device = input_allocate_device(); - if (unlikely(!tuxedo_input_device)) { - TUXEDO_ERROR("Error allocating input device\n"); - return -ENOMEM; - } - - tuxedo_input_device->name = "Clevo Keyboard"; - tuxedo_input_device->phys = DRIVER_NAME "/input0"; - tuxedo_input_device->id.bustype = BUS_HOST; - tuxedo_input_device->dev.parent = &tuxedo_platform_device->dev; - - if (key_map != NULL) { - err = sparse_keymap_setup(tuxedo_input_device, key_map, NULL); - if (err) { - TUXEDO_ERROR("Failed to setup sparse keymap\n"); - goto err_free_input_device; - } - } - - err = input_register_device(tuxedo_input_device); - if (unlikely(err)) { - TUXEDO_ERROR("Error registering input device\n"); - goto err_free_input_device; - } - - return 0; - -err_free_input_device: - input_free_device(tuxedo_input_device); - - return err; -} - -struct platform_device *tuxedo_keyboard_init_driver(struct tuxedo_keyboard_driver *tk_driver) -{ - int err; - struct platform_device *new_platform_device = NULL; - - TUXEDO_DEBUG("init driver start\n"); - - mutex_lock(&tuxedo_keyboard_init_driver_lock); - - if (!IS_ERR_OR_NULL(tuxedo_platform_device)) { - // If already initialized, don't proceed - TUXEDO_DEBUG("platform device already initialized\n"); - goto init_driver_exit; - } else { - // Otherwise, attempt to initialize structures - TUXEDO_DEBUG("create platform bundle\n"); - new_platform_device = platform_create_bundle( - tk_driver->platform_driver, tk_driver->probe, NULL, 0, NULL, 0); - - tuxedo_platform_device = new_platform_device; - - if (IS_ERR_OR_NULL(tuxedo_platform_device)) { - // Normal case probe failed, no init - goto init_driver_exit; - } - - TUXEDO_DEBUG("initialize input device\n"); - if (tk_driver->key_map != NULL) { - err = tuxedo_input_init(tk_driver->key_map); - if (unlikely(err)) { - TUXEDO_ERROR("Could not register input device\n"); - tk_driver->input_device = NULL; - } else { - TUXEDO_DEBUG("input device registered\n"); - tk_driver->input_device = tuxedo_input_device; - } - } - - current_driver = tk_driver; - } - -init_driver_exit: - mutex_unlock(&tuxedo_keyboard_init_driver_lock); - return new_platform_device; -} -EXPORT_SYMBOL(tuxedo_keyboard_init_driver); - -static void __exit tuxedo_input_exit(void) -{ - if (unlikely(!tuxedo_input_device)) { - return; - } - - input_unregister_device(tuxedo_input_device); - { - tuxedo_input_device = NULL; - } -} - -void tuxedo_keyboard_remove_driver(struct tuxedo_keyboard_driver *tk_driver) -{ - bool specified_driver_differ_from_used = - tk_driver != NULL && - ( - strcmp( - tk_driver->platform_driver->driver.name, - current_driver->platform_driver->driver.name - ) != 0 - ); - - if (specified_driver_differ_from_used) - return; - - TUXEDO_DEBUG("tuxedo_input_exit()\n"); - tuxedo_input_exit(); - TUXEDO_DEBUG("platform_device_unregister()\n"); - if (!IS_ERR_OR_NULL(tuxedo_platform_device)) { - platform_device_unregister(tuxedo_platform_device); - tuxedo_platform_device = NULL; - } - TUXEDO_DEBUG("platform_driver_unregister()\n"); - if (!IS_ERR_OR_NULL(current_driver)) { - platform_driver_unregister(current_driver->platform_driver); - current_driver = NULL; - } - -} -EXPORT_SYMBOL(tuxedo_keyboard_remove_driver); - -// Defines that might be missing in older kernel headers -#define INTEL_FAM6_SAPPHIRERAPIDS_X 0x8F -#define INTEL_FAM6_EMERALDRAPIDS_X 0xCF -#define INTEL_FAM6_ALDERLAKE 0x97 -#define INTEL_FAM6_ALDERLAKE_L 0x9A -#define INTEL_FAM6_ALDERLAKE_N 0xBE -#define INTEL_FAM6_RAPTORLAKE 0xB7 -#define INTEL_FAM6_RAPTORLAKE_P 0xBA -#define INTEL_FAM6_RAPTORLAKE_S 0xBF - -static const struct x86_cpu_id skip_tuxedo_dmi_string_check_match[] __initconst = { - X86_MATCH_INTEL_FAM6_MODEL(CORE_YONAH, NULL), - X86_MATCH_INTEL_FAM6_MODEL(CORE2_MEROM, NULL), - X86_MATCH_INTEL_FAM6_MODEL(CORE2_MEROM_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(CORE2_PENRYN, NULL), - X86_MATCH_INTEL_FAM6_MODEL(CORE2_DUNNINGTON, NULL), - X86_MATCH_INTEL_FAM6_MODEL(NEHALEM, NULL), - X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_G, NULL), - X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EP, NULL), - X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EX, NULL), - X86_MATCH_INTEL_FAM6_MODEL(WESTMERE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EP, NULL), - X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EX, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(HASWELL, NULL), - X86_MATCH_INTEL_FAM6_MODEL(HASWELL_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(HASWELL_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(HASWELL_G, NULL), - X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, NULL), - X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_G, NULL), - X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_D, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(CANNONLAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_NNPI, NULL), - X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, NULL), - X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, NULL), // 12th Gen Xeon - //X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, NULL), // 13th Gen Xeon - X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL), // 12th Gen - X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL), // 12th Gen - X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), // 12th Gen Atom - //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), // 13th Gen - //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), // 13th Gen - //X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, NULL), // 13th Gen - X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL_MID, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_MID, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL_TABLET, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_D, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT_MID, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT_NP, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, NULL), - X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, NULL), - X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, NULL), - X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, NULL), - X86_MATCH_VENDOR_FAM_MODEL(INTEL, 5, INTEL_FAM5_QUARK_X1000, NULL), - X86_MATCH_VENDOR_FAM(AMD, 5, NULL), - X86_MATCH_VENDOR_FAM(AMD, 6, NULL), - X86_MATCH_VENDOR_FAM(AMD, 15, NULL), - X86_MATCH_VENDOR_FAM(AMD, 16, NULL), - X86_MATCH_VENDOR_FAM(AMD, 17, NULL), - X86_MATCH_VENDOR_FAM(AMD, 18, NULL), - X86_MATCH_VENDOR_FAM(AMD, 19, NULL), - X86_MATCH_VENDOR_FAM(AMD, 20, NULL), - X86_MATCH_VENDOR_FAM(AMD, 21, NULL), - X86_MATCH_VENDOR_FAM(AMD, 22, NULL), - X86_MATCH_VENDOR_FAM(AMD, 23, NULL), // Zen, Zen+, Zen 2 - X86_MATCH_VENDOR_FAM(AMD, 24, NULL), // Zen - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x01, NULL), // Zen 3 Epyc - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x08, NULL), // Zen 3 Threadripper - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x21, NULL), // Zen 3 Vermeer - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x40, NULL), // Zen 3+ Rembrandt - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x44, NULL), // Zen 3+ Rembrandt - X86_MATCH_VENDOR_FAM_MODEL(AMD, 25, 0x50, NULL), // Zen 3 Cezanne - { } -}; - -static const struct x86_cpu_id force_tuxedo_dmi_string_check_match[] __initconst = { - { } -}; - -static const struct dmi_system_id tuxedo_dmi_string_match[] __initconst = { - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), - }, - }, - { - .matches = { - DMI_MATCH(DMI_BOARD_VENDOR, "Notebook"), - }, - }, - { - .matches = { - DMI_MATCH(DMI_CHASSIS_VENDOR, "Notebook"), - }, - }, - { } -}; - -static int __init tuxedo_keyboard_init(void) -{ - TUXEDO_INFO("module init\n"); - - if (!(dmi_check_system(tuxedo_dmi_string_match) - || (x86_match_cpu(skip_tuxedo_dmi_string_check_match) - && !x86_match_cpu(force_tuxedo_dmi_string_check_match)))) { - return -ENODEV; - } - - return 0; -} - -static void __exit tuxedo_keyboard_exit(void) -{ - TUXEDO_INFO("module exit\n"); - - if (tuxedo_platform_device != NULL) - tuxedo_keyboard_remove_driver(NULL); -} - -module_init(tuxedo_keyboard_init); -module_exit(tuxedo_keyboard_exit); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard_common.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard_common.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard_common.h 2023-05-24 22:21:34.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard_common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/*! - * Copyright (c) 2018-2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef TUXEDO_KEYBOARD_COMMON_H -#define TUXEDO_KEYBOARD_COMMON_H - -#include -#include -#include -#include -#include -#include -#include - -/* :::: Module specific Constants and simple Macros :::: */ -#define __TUXEDO_PR(lvl, fmt, ...) do { pr_##lvl(fmt, ##__VA_ARGS__); } while (0) -#define TUXEDO_INFO(fmt, ...) __TUXEDO_PR(info, fmt, ##__VA_ARGS__) -#define TUXEDO_ERROR(fmt, ...) __TUXEDO_PR(err, fmt, ##__VA_ARGS__) -#define TUXEDO_DEBUG(fmt, ...) __TUXEDO_PR(debug, "[%s:%u] " fmt, __func__, __LINE__, ##__VA_ARGS__) - -#ifndef DRIVER_NAME -#define DRIVER_NAME "clevo_keyboard" -#endif - -struct tuxedo_keyboard_driver { - // Platform driver provided by driver - struct platform_driver *platform_driver; - // Probe method provided by driver - int (*probe)(struct platform_device *); - // Keymap provided by driver - struct key_entry *key_map; - // Input device reference filled in on module init after probe success - struct input_dev *input_device; -}; - -// Global module devices -static struct platform_device *tuxedo_platform_device = NULL; -static struct input_dev *tuxedo_input_device = NULL; - -// Currently chosen driver -static struct tuxedo_keyboard_driver *current_driver = NULL; - -struct platform_device *tuxedo_keyboard_init_driver(struct tuxedo_keyboard_driver *tk_driver); -void tuxedo_keyboard_remove_driver(struct tuxedo_keyboard_driver *tk_driver); - -/** - * Basically a copy of the existing report event but doesn't report unknown events - */ -bool sparse_keymap_report_known_event(struct input_dev *dev, unsigned int code, - unsigned int value, bool autorelease) -{ - const struct key_entry *ke = - sparse_keymap_entry_from_scancode(dev, code); - - if (ke) { - sparse_keymap_report_entry(dev, ke, value, autorelease); - return true; - } - - return false; -} - -struct color_t { - u32 code; - char* name; -}; - -struct color_list_t { - uint size; - struct color_t colors[]; -}; - -/** - * Commonly used standard colors - */ -static struct color_list_t color_list = { - .size = 8, - .colors = { - { .name = "BLACK", .code = 0x000000 }, // 0 - { .name = "RED", .code = 0xFF0000 }, // 1 - { .name = "GREEN", .code = 0x00FF00 }, // 2 - { .name = "BLUE", .code = 0x0000FF }, // 3 - { .name = "YELLOW", .code = 0xFFFF00 }, // 4 - { .name = "MAGENTA", .code = 0xFF00FF }, // 5 - { .name = "CYAN", .code = 0x00FFFF }, // 6 - { .name = "WHITE", .code = 0xFFFFFF }, // 7 - } -}; - -#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_keyboard.h 2023-05-24 22:21:51.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_keyboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,448 +0,0 @@ -/*! - * Copyright (c) 2018-2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef CLEVO_KEYBOARD_H -#define CLEVO_KEYBOARD_H - -#include "clevo_keyboard_common.h" -#include "clevo_interfaces.h" -#include "clevo_leds.h" - -// Clevo event codes -#define CLEVO_EVENT_KB_LEDS_DECREASE 0x81 -#define CLEVO_EVENT_KB_LEDS_INCREASE 0x82 -#define CLEVO_EVENT_KB_LEDS_CYCLE_MODE 0x83 -#define CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS 0x8A -#define CLEVO_EVENT_KB_LEDS_TOGGLE 0x9F - -#define CLEVO_EVENT_TOUCHPAD_TOGGLE 0x5D -#define CLEVO_EVENT_TOUCHPAD_OFF 0xFC -#define CLEVO_EVENT_TOUCHPAD_ON 0xFD - -#define CLEVO_EVENT_RFKILL1 0x85 -#define CLEVO_EVENT_RFKILL2 0x86 - -#define CLEVO_KB_MODE_DEFAULT 0 // "CUSTOM"/Static Color - -static struct clevo_interfaces_t { - struct clevo_interface_t *wmi; - struct clevo_interface_t *acpi; -} clevo_interfaces; - -static struct clevo_interface_t *active_clevo_interface; - -static DEFINE_MUTEX(clevo_keyboard_interface_modification_lock); - -static struct key_entry clevo_keymap[] = { - // Keyboard backlight (RGB versions) - { KE_KEY, CLEVO_EVENT_KB_LEDS_DECREASE, { KEY_KBDILLUMDOWN } }, - { KE_KEY, CLEVO_EVENT_KB_LEDS_INCREASE, { KEY_KBDILLUMUP } }, - { KE_KEY, CLEVO_EVENT_KB_LEDS_TOGGLE, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_MODE, { KEY_LIGHTS_TOGGLE } }, - // Single cycle key (white only versions) - { KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS, { KEY_KBDILLUMTOGGLE } }, - - // Touchpad - // The weirdly named touchpad toggle key that is implemented as KEY_F21 "everywhere" - // (instead of KEY_TOUCHPAD_TOGGLE or on/off) - // Most "new" devices just provide one toggle event - { KE_KEY, CLEVO_EVENT_TOUCHPAD_TOGGLE, { KEY_F21 } }, - // Some "old" devices produces on/off events - { KE_KEY, CLEVO_EVENT_TOUCHPAD_OFF, { KEY_F21 } }, - { KE_KEY, CLEVO_EVENT_TOUCHPAD_ON, { KEY_F21 } }, - // The alternative key events (currently not used) - // { KE_KEY, CLEVO_EVENT_TOUCHPAD_OFF, { KEY_TOUCHPAD_OFF } }, - // { KE_KEY, CLEVO_EVENT_TOUCHPAD_ON, { KEY_TOUCHPAD_ON } }, - // { KE_KEY, CLEVO_EVENT_TOUCHPAD_TOGGLE, { KEY_TOUCHPAD_TOGGLE } }, - - // Rfkill still needed by some devices - { KE_KEY, CLEVO_EVENT_RFKILL1, { KEY_RFKILL } }, - { KE_IGNORE, CLEVO_EVENT_RFKILL2, { KEY_RFKILL } }, // Older rfkill event - // Note: Volume events need to be ignored as to not interfere with built-in functionality - { KE_IGNORE, 0xfa, { KEY_UNKNOWN } }, // Appears by volume up/down - { KE_IGNORE, 0xfb, { KEY_UNKNOWN } }, // Appears by mute toggle - - { KE_END, 0 } -}; - -// Keyboard struct -static struct kbd_led_state_t { - u8 has_mode; - u8 mode; - u8 whole_kbd_color; -} kbd_led_state = { - .has_mode = 1, - .mode = CLEVO_KB_MODE_DEFAULT, - .whole_kbd_color = 7, -}; - -static struct kbd_backlight_mode_t { - u8 key; - u32 value; - const char *const name; -} kbd_backlight_modes[] = { - { .key = 0, .value = 0x00000000, .name = "CUSTOM"}, - { .key = 1, .value = 0x1002a000, .name = "BREATHE"}, - { .key = 2, .value = 0x33010000, .name = "CYCLE"}, - { .key = 3, .value = 0x80000000, .name = "DANCE"}, - { .key = 4, .value = 0xA0000000, .name = "FLASH"}, - { .key = 5, .value = 0x70000000, .name = "RANDOM_COLOR"}, - { .key = 6, .value = 0x90000000, .name = "TEMPO"}, - { .key = 7, .value = 0xB0000000, .name = "WAVE"} -}; - -u32 clevo_evaluate_method2(u8 cmd, u32 arg, union acpi_object **result) -{ - if (IS_ERR_OR_NULL(active_clevo_interface)) { - pr_err("clevo_keyboard: no active interface while attempting cmd %02x arg %08x\n", cmd, arg); - return -ENODEV; - } - return active_clevo_interface->method_call(cmd, arg, result); -} -EXPORT_SYMBOL(clevo_evaluate_method2); - -u32 clevo_evaluate_method(u8 cmd, u32 arg, u32 *result) -{ - u32 status = 0; - union acpi_object *out_obj; - - status = clevo_evaluate_method2(cmd, arg, &out_obj); - if (status) { - return status; - } - else { - if (out_obj->type == ACPI_TYPE_INTEGER) { - if (!IS_ERR_OR_NULL(result)) - *result = (u32) out_obj->integer.value; - } else { - pr_err("return type not integer, use clevo_evaluate_method2\n"); - status = -ENODATA; - } - ACPI_FREE(out_obj); - } - - return status; -} -EXPORT_SYMBOL(clevo_evaluate_method); - -u32 clevo_get_active_interface_id(char **id_str) -{ - if (IS_ERR_OR_NULL(active_clevo_interface)) - return -ENODEV; - - if (!IS_ERR_OR_NULL(id_str)) - *id_str = active_clevo_interface->string_id; - - return 0; -} -EXPORT_SYMBOL(clevo_get_active_interface_id); - -static int set_enabled_cmd(u8 state) -{ - u32 cmd = 0xE0000000; - TUXEDO_INFO("Set keyboard enabled to: %d\n", state); - - if (state == 0) { - cmd |= 0x003001; - } else { - cmd |= 0x07F001; - } - - return clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, cmd, NULL); -} - -static void set_next_color_whole_kb(void) -{ - /* "Calculate" new to-be color */ - u32 new_color_id; - u32 new_color_code; - - new_color_id = kbd_led_state.whole_kbd_color + 1; - if (new_color_id >= color_list.size) { - new_color_id = 1; // Skip black - } - new_color_code = color_list.colors[new_color_id].code; - - TUXEDO_INFO("set_next_color_whole_kb(): new_color_id: %i, new_color_code %X", - new_color_id, new_color_code); - - /* Set color on all four regions*/ - clevo_leds_set_color_extern(new_color_code); - kbd_led_state.whole_kbd_color = new_color_id; -} - -static void set_kbd_backlight_mode(u8 kbd_backlight_mode) -{ - TUXEDO_INFO("Set keyboard backlight mode on %s", kbd_backlight_modes[kbd_backlight_mode].name); - - if (!clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, kbd_backlight_modes[kbd_backlight_mode].value, NULL)) { - // method was succesfull so update ur internal state struct - kbd_led_state.mode = kbd_backlight_mode; - } -} - -// Sysfs Interface for the keyboard backlight mode -static ssize_t list_kbd_backlight_modes_fs(struct device *child, struct device_attribute *attr, - char *buffer) -{ - return sprintf(buffer, "%d\n", kbd_led_state.mode); -} - -static ssize_t set_kbd_backlight_mode_fs(struct device *child, - struct device_attribute *attr, - const char *buffer, size_t size) -{ - unsigned int kbd_backlight_mode; - - int err = kstrtouint(buffer, 0, &kbd_backlight_mode); - if (err) { - return err; - } - - kbd_backlight_mode = clamp_t(u8, kbd_backlight_mode, 0, ARRAY_SIZE(kbd_backlight_modes) - 1); - set_kbd_backlight_mode(kbd_backlight_mode); - - return size; -} - -// Sysfs attribute file permissions and method linking -static DEVICE_ATTR(kbd_backlight_mode, 0644, list_kbd_backlight_modes_fs, set_kbd_backlight_mode_fs); - -static int kbd_backlight_mode_id_validator(const char *value, - const struct kernel_param *kbd_backlight_mode_param) -{ - int kbd_backlight_mode = 0; - - if (kstrtoint(value, 10, &kbd_backlight_mode) != 0 - || kbd_backlight_mode < 0 - || kbd_backlight_mode > (ARRAY_SIZE(kbd_backlight_modes) - 1)) { - return -EINVAL; - } - - return param_set_int(value, kbd_backlight_mode_param); -} - -static const struct kernel_param_ops param_ops_mode_ops = { - .set = kbd_backlight_mode_id_validator, - .get = param_get_int, -}; - -static u8 param_kbd_backlight_mode = CLEVO_KB_MODE_DEFAULT; -module_param_cb(kbd_backlight_mode, ¶m_ops_mode_ops, ¶m_kbd_backlight_mode, S_IRUSR); -MODULE_PARM_DESC(kbd_backlight_mode, "Set the keyboard backlight mode"); - -static void clevo_keyboard_event_callb(u32 event) -{ - u32 key_event = event; - - TUXEDO_DEBUG("Clevo event: %0#6x\n", event); - - switch (key_event) { - case CLEVO_EVENT_KB_LEDS_CYCLE_MODE: - set_next_color_whole_kb(); - break; - default: - break; - } - - if (current_driver != NULL && current_driver->input_device != NULL) { - if (!sparse_keymap_report_known_event(current_driver->input_device, key_event, 1, true)) { - TUXEDO_DEBUG("Unknown key - %d (%0#6x)\n", key_event, key_event); - } - } -} - -static void clevo_keyboard_init_device_interface(struct platform_device *dev) -{ - // Setup sysfs - if (clevo_leds_get_backlight_type() == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - if (device_create_file(&dev->dev, &dev_attr_kbd_backlight_mode) != 0) { - TUXEDO_ERROR("Sysfs attribute file creation failed for blinking pattern\n"); - } - else { - kbd_led_state.has_mode = 1; - } - } -} - -/** - * strstr version of dmi_match - */ -static bool dmi_string_in(enum dmi_field f, const char *str) -{ - const char *info = dmi_get_system_info(f); - - if (info == NULL || str == NULL) - return info == str; - - return strstr(info, str) != NULL; -} - -static void clevo_keyboard_init(void) -{ - bool performance_profile_set_workaround; - - kbd_led_state.mode = param_kbd_backlight_mode; - set_kbd_backlight_mode(kbd_led_state.mode); - - clevo_evaluate_method(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); - set_enabled_cmd(1); - - // Workaround for firmware issue not setting selected performance profile. - // Explicitly set "performance" perf. profile on init regardless of what is chosen - // for these devices (Aura, XP14, IBS14v5) - performance_profile_set_workaround = false - || dmi_string_in(DMI_BOARD_NAME, "AURA1501") - || dmi_string_in(DMI_BOARD_NAME, "EDUBOOK1502") - || dmi_string_in(DMI_BOARD_NAME, "NL5xRU") - || dmi_string_in(DMI_BOARD_NAME, "NV4XMB,ME,MZ") - || dmi_string_in(DMI_BOARD_NAME, "L140CU") - || dmi_string_in(DMI_BOARD_NAME, "NS50MU") - || dmi_string_in(DMI_BOARD_NAME, "NS50_70MU") - || dmi_string_in(DMI_BOARD_NAME, "PCX0DX") - || dmi_string_in(DMI_BOARD_NAME, "PCx0Dx_GN20") - || dmi_string_in(DMI_BOARD_NAME, "L14xMU") - ; - if (performance_profile_set_workaround) { - TUXEDO_INFO("Performance profile 'performance' set workaround applied\n"); - clevo_evaluate_method(CLEVO_CMD_OPT, 0x19000002, NULL); - } -} - -static int clevo_keyboard_probe(struct platform_device *dev) -{ - clevo_leds_init(dev); - // clevo_keyboard_init_device_interface() must come after clevo_leds_init() - // to know keyboard backlight type - clevo_keyboard_init_device_interface(dev); - clevo_keyboard_init(); - - return 0; -} - -static void clevo_keyboard_remove_device_interface(struct platform_device *dev) -{ - if (kbd_led_state.has_mode == 1) { - device_remove_file(&dev->dev, &dev_attr_kbd_backlight_mode); - } -} - -static int clevo_keyboard_remove(struct platform_device *dev) -{ - clevo_keyboard_remove_device_interface(dev); - clevo_leds_remove(dev); - return 0; -} - -static int clevo_keyboard_suspend(struct platform_device *dev, pm_message_t state) -{ - // turning the keyboard off prevents default colours showing on resume - set_enabled_cmd(0); - return 0; -} - -static int clevo_keyboard_resume(struct platform_device *dev) -{ - clevo_evaluate_method(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); - clevo_leds_restore_state_extern(); // Sometimes clevo devices forget their last state after - // suspend, so let the kernel ensure it. - set_enabled_cmd(1); - return 0; -} - -static struct platform_driver platform_driver_clevo = { - .remove = clevo_keyboard_remove, - .suspend = clevo_keyboard_suspend, - .resume = clevo_keyboard_resume, - .driver = - { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -static struct tuxedo_keyboard_driver clevo_keyboard_driver = { - .platform_driver = &platform_driver_clevo, - .probe = clevo_keyboard_probe, - .key_map = clevo_keymap, -}; - -u32 clevo_keyboard_add_interface(struct clevo_interface_t *new_interface) -{ - mutex_lock(&clevo_keyboard_interface_modification_lock); - - if (strcmp(new_interface->string_id, CLEVO_INTERFACE_WMI_STRID) == 0) { - clevo_interfaces.wmi = new_interface; - clevo_interfaces.wmi->event_callb = clevo_keyboard_event_callb; - - // Only use wmi if there is no other current interface - if (ZERO_OR_NULL_PTR(active_clevo_interface)) { - pr_debug("enable wmi events\n"); - clevo_interfaces.wmi->method_call(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); - - active_clevo_interface = clevo_interfaces.wmi; - } - } else if (strcmp(new_interface->string_id, CLEVO_INTERFACE_ACPI_STRID) == 0) { - clevo_interfaces.acpi = new_interface; - clevo_interfaces.acpi->event_callb = clevo_keyboard_event_callb; - - pr_debug("enable acpi events (takes priority)\n"); - clevo_interfaces.acpi->method_call(CLEVO_CMD_SET_EVENTS_ENABLED, 0, NULL); - active_clevo_interface = clevo_interfaces.acpi; - } else { - // Not recognized interface - pr_err("unrecognized interface\n"); - mutex_unlock(&clevo_keyboard_interface_modification_lock); - return -EINVAL; - } - - mutex_unlock(&clevo_keyboard_interface_modification_lock); - - if (active_clevo_interface != NULL) - tuxedo_keyboard_init_driver(&clevo_keyboard_driver); - - return 0; -} -EXPORT_SYMBOL(clevo_keyboard_add_interface); - -u32 clevo_keyboard_remove_interface(struct clevo_interface_t *interface) -{ - mutex_lock(&clevo_keyboard_interface_modification_lock); - - if (strcmp(interface->string_id, CLEVO_INTERFACE_WMI_STRID) == 0) { - clevo_interfaces.wmi = NULL; - } else if (strcmp(interface->string_id, CLEVO_INTERFACE_ACPI_STRID) == 0) { - clevo_interfaces.acpi = NULL; - } else { - mutex_unlock(&clevo_keyboard_interface_modification_lock); - return -EINVAL; - } - - if (active_clevo_interface == interface) { - tuxedo_keyboard_remove_driver(&clevo_keyboard_driver); - active_clevo_interface = NULL; - } - - - mutex_unlock(&clevo_keyboard_interface_modification_lock); - - return 0; -} -EXPORT_SYMBOL(clevo_keyboard_remove_interface); - -#endif // CLEVO_KEYBOARD_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_leds.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_leds.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_leds.h 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_leds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,458 +0,0 @@ -/*! - * Copyright (c) 2018-2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ - -#ifndef CLEVO_LEDS_H -#define CLEVO_LEDS_H - -#include -#include -#include - -enum clevo_kb_backlight_types { - CLEVO_KB_BACKLIGHT_TYPE_NONE = 0x00, - CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR = 0x01, - CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB = 0x02, - CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB = 0x06, - CLEVO_KB_BACKLIGHT_TYPE_PER_KEY_RGB = 0xf3 -}; - -int clevo_leds_init(struct platform_device *dev); -int clevo_leds_remove(struct platform_device *dev); -enum clevo_kb_backlight_types clevo_leds_get_backlight_type(void); -void clevo_leds_restore_state_extern(void); -void clevo_leds_set_brightness_extern(enum led_brightness brightness); -void clevo_leds_set_color_extern(u32 color); - -// TODO The following should go into a seperate .c file, but for this to work more reworking is required in the tuxedo_keyboard structure. - -#include "clevo_leds.h" - -#include "clevo_interfaces.h" - -#include - -#define CLEVO_KBD_BRIGHTNESS_MAX 0xff -#define CLEVO_KBD_BRIGHTNESS_DEFAULT 0x00 - -#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX 0x02 // White only keyboards can only be off, half, or full brightness -#define CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT 0x00 - -#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5 0x05 // Devices <= Intel 7th gen had a different white control with 5 brightness values + off -#define CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5_DEFAULT 0x00 - -#define CLEVO_KB_COLOR_DEFAULT_RED 0xff -#define CLEVO_KB_COLOR_DEFAULT_GREEN 0xff -#define CLEVO_KB_COLOR_DEFAULT_BLUE 0xff -#define CLEVO_KB_COLOR_DEFAULT ((CLEVO_KB_COLOR_DEFAULT_RED << 16) + (CLEVO_KB_COLOR_DEFAULT_GREEN << 8) + CLEVO_KB_COLOR_DEFAULT_BLUE) - -static enum clevo_kb_backlight_types clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_NONE; -static bool leds_initialized = false; - -/** - * Color scaling quirk list - */ -static void color_scaling(enum clevo_kb_backlight_types *type, u8 *red, u8 *green, u8 *blue) -{ - if (*type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - *red = (180 * *red) / 255; - *blue = (200 * *blue) / 255; - } -} - -static int clevo_evaluate_set_white_brightness(u8 brightness) -{ - pr_debug("Set white brightness to %d\n", brightness); - - return clevo_evaluate_method (CLEVO_CMD_SET_KB_WHITE_LEDS, brightness, NULL); -} - -static int clevo_evaluate_set_rgb_brightness(u8 brightness) -{ - pr_debug("Set RGB brightness to %d\n", brightness); - - return clevo_evaluate_method (CLEVO_CMD_SET_KB_RGB_LEDS, CLEVO_CMD_SET_KB_LEDS_SUB_RGB_BRIGHTNESS | brightness, NULL); -} - -static int clevo_evaluate_set_rgb_color(u32 zone, u32 color) -{ - u32 cset = ((color & 0x0000FF) << 16) | ((color & 0xFF0000) >> 8) | ((color & 0x00FF00) >> 8); - u32 clevo_submethod_arg = zone | cset; - - pr_debug("Set Color 0x%08x for region 0x%08x\n", color, zone); - - return clevo_evaluate_method(CLEVO_CMD_SET_KB_RGB_LEDS, clevo_submethod_arg, NULL); -} - -static void clevo_leds_set_brightness(struct led_classdev *led_cdev __always_unused, enum led_brightness brightness) { - int ret = clevo_evaluate_set_white_brightness(brightness); - if (ret) { - pr_debug("clevo_leds_set_brightness(): clevo_evaluate_set_white_brightness() failed\n"); - return; - } - led_cdev->brightness = brightness; -} - -/*static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { - int ret; - u32 zone, color; - struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); - - ret = clevo_evaluate_set_rgb_brightness(CLEVO_KBD_BRIGHTNESS_MAX); - if (ret) { - pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_brightness() failed\n"); - return; - } - - zone = mcled_cdev->subled_info[0].channel; - - led_mc_calc_color_components(mcled_cdev, brightness); - color = (mcled_cdev->subled_info[0].brightness << 16) + - (mcled_cdev->subled_info[1].brightness << 8) + - mcled_cdev->subled_info[2].brightness; - - ret = clevo_evaluate_set_rgb_color(zone, color); - if (ret) { - pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_color() failed\n"); - return; - } - led_cdev->brightness = brightness; -}*/ - -// Temprary fix for KDE: KDE does only set one kbd_backlight brightness value, this version of the -// function uses clevos built in brightness setting to set the whole keyboard brightness at once. -// -> use clevo_evaluate_set_rgb_brightness() to set overall brightness via firmware instead of scaling -// the RGB values -// -> update all clevo_mcled_cdevs brightness levels to refect that the firmware method sets the -// the whole keyboard brightness and not just one zone -// This is a temporary fix until KDE handles multiple keyboard backlights correctly -static struct led_classdev_mc clevo_mcled_cdevs[3]; // forward declaration -static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { - int ret; - u32 zone, color; - u8 red, green, blue; - struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); - - ret = clevo_evaluate_set_rgb_brightness(brightness); - if (ret) { - pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_brightness() failed\n"); - return; - } - clevo_mcled_cdevs[0].led_cdev.brightness = brightness; - clevo_mcled_cdevs[1].led_cdev.brightness = brightness; - clevo_mcled_cdevs[2].led_cdev.brightness = brightness; - - zone = mcled_cdev->subled_info[0].channel; - - red = mcled_cdev->subled_info[0].intensity; - green = mcled_cdev->subled_info[1].intensity; - blue = mcled_cdev->subled_info[2].intensity; - - color_scaling(&clevo_kb_backlight_type, &red, &green, &blue); - - color = (red << 16) + - (green << 8) + - blue; - - ret = clevo_evaluate_set_rgb_color(zone, color); - if (ret) { - pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_rgb_color() failed\n"); - } -} - -static struct led_classdev clevo_led_cdev = { - .name = "white:" LED_FUNCTION_KBD_BACKLIGHT, - .max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX, - .brightness_set = &clevo_leds_set_brightness, - .brightness = CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT -}; - -static struct mc_subled clevo_mcled_cdevs_subleds[3][3] = { - { - { - .color_index = LED_COLOR_ID_RED, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_RED, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 - }, - { - .color_index = LED_COLOR_ID_GREEN, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 - }, - { - .color_index = LED_COLOR_ID_BLUE, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_0 - } - }, - { - { - .color_index = LED_COLOR_ID_RED, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_RED, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 - }, - { - .color_index = LED_COLOR_ID_GREEN, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 - }, - { - .color_index = LED_COLOR_ID_BLUE, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_1 - } - }, - { - { - .color_index = LED_COLOR_ID_RED, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_RED, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 - }, - { - .color_index = LED_COLOR_ID_GREEN, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_GREEN, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 - }, - { - .color_index = LED_COLOR_ID_BLUE, - .brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .intensity = CLEVO_KB_COLOR_DEFAULT_BLUE, - .channel = CLEVO_CMD_SET_KB_LEDS_SUB_RGB_ZONE_2 - } - } -}; - -static struct led_classdev_mc clevo_mcled_cdevs[3] = { - { - .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, - .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, - .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, - .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .num_colors = 3, - .subled_info = clevo_mcled_cdevs_subleds[0] - }, - { - .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, - .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, - .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, - .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .num_colors = 3, - .subled_info = clevo_mcled_cdevs_subleds[1] - }, - { - .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, - .led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_MAX, - .led_cdev.brightness_set = &clevo_leds_set_brightness_mc, - .led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_DEFAULT, - .num_colors = 3, - .subled_info = clevo_mcled_cdevs_subleds[2] - } -}; - -int clevo_leds_init(struct platform_device *dev) -{ - int ret; - u32 status; - union acpi_object *result; - u32 result_fallback; - - status = clevo_evaluate_method2(CLEVO_CMD_GET_SPECS, 0, &result); - if (!status) { - if (result->type == ACPI_TYPE_BUFFER) { - pr_debug("CLEVO_CMD_GET_SPECS result->buffer.pointer[0x0f]: 0x%02x\n", result->buffer.pointer[0x0f]); - clevo_kb_backlight_type = result->buffer.pointer[0x0f]; - } - else { - pr_err("CLEVO_CMD_GET_SPECS does not exist on this device or return value has wrong type, trying CLEVO_CMD_GET_BIOS_FEATURES\n"); - status = -EINVAL; - } - ACPI_FREE(result); - } - else { - pr_notice("CLEVO_CMD_GET_SPECS does not exist on this device or failed, trying CLEVO_CMD_GET_BIOS_FEATURES_1\n"); - } - - if (status || clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_NONE) { - // check for devices <= Intel 8th gen (only white only, 3 zone RGB, or no backlight on these devices) - status = clevo_evaluate_method(CLEVO_CMD_GET_BIOS_FEATURES_1, 0, &result_fallback); - if (!status) { - pr_debug("CLEVO_CMD_GET_BIOS_FEATURES_1 result_fallback: 0x%08x\n", result_fallback); - if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_3_ZONE_RGB_KB) { - clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB; - } - else if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_1_SUB_WHITE_ONLY_KB) { - clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR; - - status = clevo_evaluate_method(CLEVO_CMD_GET_BIOS_FEATURES_2, 0, &result_fallback); - if (!status) { - pr_debug("CLEVO_CMD_GET_BIOS_FEATURES_2 result_fallback: 0x%08x\n", result_fallback); - if (result_fallback & CLEVO_CMD_GET_BIOS_FEATURES_2_SUB_WHITE_ONLY_KB_MAX_5) { - clevo_led_cdev.max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5; - clevo_led_cdev.brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX_5_DEFAULT; - } - } - else { - pr_notice("CLEVO_CMD_GET_BIOS_FEATURES_2 does not exist on this device or failed\n"); - } - } - } - else { - pr_notice("CLEVO_CMD_GET_BIOS_FEATURES_1 does not exist on this device or failed\n"); - } - } - pr_debug("Keyboard backlight type: 0x%02x\n", clevo_kb_backlight_type); - - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) - clevo_leds_set_brightness_extern(clevo_led_cdev.brightness); - else - clevo_leds_set_color_extern(CLEVO_KB_COLOR_DEFAULT); - - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - pr_debug("Registering fixed color leds interface\n"); - ret = led_classdev_register(&dev->dev, &clevo_led_cdev); - if (ret) { - pr_err("Registering fixed color leds interface failed\n"); - return ret; - } - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - pr_debug("Registering single zone rgb leds interface\n"); - ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[0]); - if (ret) { - pr_err("Registering single zone rgb leds interface failed\n"); - return ret; - } - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - pr_debug("Registering three zone rgb leds interface\n"); - ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[0]); - if (ret) { - pr_err("Registering three zone rgb zone 0 leds interface failed\n"); - return ret; - } - ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[1]); - if (ret) { - pr_err("Registering three zone rgb zone 1 leds interface failed\n"); - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); - return ret; - } - ret = devm_led_classdev_multicolor_register(&dev->dev, &clevo_mcled_cdevs[2]); - if (ret) { - pr_err("Registering three zone rgb zone 2 leds interface failed\n"); - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[1]); - return ret; - } - } - - leds_initialized = true; - return 0; -} -EXPORT_SYMBOL(clevo_leds_init); - -int clevo_leds_remove(struct platform_device *dev) { - if (leds_initialized) { - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - led_classdev_unregister(&clevo_led_cdev); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[0]); - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[1]); - devm_led_classdev_multicolor_unregister(&dev->dev, &clevo_mcled_cdevs[2]); - } - } - - leds_initialized = false; - - return 0; -} -EXPORT_SYMBOL(clevo_leds_remove); - -enum clevo_kb_backlight_types clevo_leds_get_backlight_type(void) { - return clevo_kb_backlight_type; -} -EXPORT_SYMBOL(clevo_leds_get_backlight_type); - -void clevo_leds_restore_state_extern(void) { - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - clevo_led_cdev.brightness_set(&clevo_led_cdev, clevo_led_cdev.brightness); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); - clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, clevo_mcled_cdevs[1].led_cdev.brightness); - clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, clevo_mcled_cdevs[2].led_cdev.brightness); - } -} -EXPORT_SYMBOL(clevo_leds_restore_state_extern); - -void clevo_leds_set_brightness_extern(enum led_brightness brightness) { - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - clevo_led_cdev.brightness_set(&clevo_led_cdev, brightness); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, brightness); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, brightness); - clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, brightness); - clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, brightness); - } -} -EXPORT_SYMBOL(clevo_leds_set_brightness_extern); - -void clevo_leds_set_color_extern(u32 color) { - if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - clevo_mcled_cdevs[0].subled_info[0].intensity = (color >> 16) & 0xff; - clevo_mcled_cdevs[0].subled_info[1].intensity = (color >> 8) & 0xff; - clevo_mcled_cdevs[0].subled_info[2].intensity = color & 0xff; - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); - } - else if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_3_ZONE_RGB) { - clevo_mcled_cdevs[0].subled_info[0].intensity = (color >> 16) & 0xff; - clevo_mcled_cdevs[0].subled_info[1].intensity = (color >> 8) & 0xff; - clevo_mcled_cdevs[0].subled_info[2].intensity = color & 0xff; - clevo_mcled_cdevs[0].led_cdev.brightness_set(&clevo_mcled_cdevs[0].led_cdev, clevo_mcled_cdevs[0].led_cdev.brightness); - clevo_mcled_cdevs[1].subled_info[0].intensity = (color >> 16) & 0xff; - clevo_mcled_cdevs[1].subled_info[1].intensity = (color >> 8) & 0xff; - clevo_mcled_cdevs[1].subled_info[2].intensity = color & 0xff; - clevo_mcled_cdevs[1].led_cdev.brightness_set(&clevo_mcled_cdevs[1].led_cdev, clevo_mcled_cdevs[1].led_cdev.brightness); - clevo_mcled_cdevs[2].subled_info[0].intensity = (color >> 16) & 0xff; - clevo_mcled_cdevs[2].subled_info[1].intensity = (color >> 8) & 0xff; - clevo_mcled_cdevs[2].subled_info[2].intensity = color & 0xff; - clevo_mcled_cdevs[2].led_cdev.brightness_set(&clevo_mcled_cdevs[2].led_cdev, clevo_mcled_cdevs[2].led_cdev.brightness); - } -} -EXPORT_SYMBOL(clevo_leds_set_color_extern); - -MODULE_LICENSE("GPL"); - -#endif // CLEVO_LEDS_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_wmi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_wmi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/clevo_wmi.c 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/clevo_wmi.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ -/*! - * Copyright (c) 2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include -#include -#include -#include -#include "clevo_interfaces.h" - -static int clevo_wmi_evaluate(u32 wmi_method_id, u32 wmi_arg, union acpi_object **result) -{ - struct acpi_buffer acpi_buffer_in = { (acpi_size)sizeof(wmi_arg), - &wmi_arg }; - struct acpi_buffer acpi_buffer_out = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object *acpi_result; - acpi_status status_acpi; - u32 return_status = 0; - - status_acpi = - wmi_evaluate_method(CLEVO_WMI_METHOD_GUID, 0x00, wmi_method_id, - &acpi_buffer_in, &acpi_buffer_out); - - if (unlikely(ACPI_FAILURE(status_acpi))) { - pr_err("failed to evaluate wmi method\n"); - return -EIO; - } - - acpi_result = (union acpi_object *)acpi_buffer_out.pointer; - if (!acpi_result) { - pr_err("failed to evaluate WMI method\n"); - return_status = -1; - } - else { - if (!IS_ERR_OR_NULL(result)) { - *result = acpi_result; - } - } - - return return_status; -} - -u32 clevo_wmi_interface_method_call(u8 cmd, u32 arg, union acpi_object **result_value) -{ - return clevo_wmi_evaluate(cmd, arg, result_value); -} - -struct clevo_interface_t clevo_wmi_interface = { - .string_id = CLEVO_INTERFACE_WMI_STRID, - .method_call = clevo_wmi_interface_method_call, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) -static int clevo_wmi_probe(struct wmi_device *wdev) -#else -static int clevo_wmi_probe(struct wmi_device *wdev, const void *dummy_context) -#endif -{ - u32 status; - union acpi_object *out_obj; - - pr_debug("clevo_wmi driver probe\n"); - - if (!wmi_has_guid(CLEVO_WMI_EVENT_GUID)) { - pr_debug("probe: Clevo event guid missing\n"); - return -ENODEV; - } - - if (!wmi_has_guid(CLEVO_WMI_METHOD_GUID)) { - pr_debug("probe: Clevo method guid missing\n"); - return -ENODEV; - } - - // Since the WMI GUIDs aren't unique let's (at least) - // check the return of some "known existing general" method - status = clevo_wmi_evaluate(0x52, 0, &out_obj); - if (status < 0) { - pr_debug("probe: Clevo GUIDs present but method call failed\n"); - return -ENODEV; - } - if (out_obj->type != ACPI_TYPE_INTEGER || (out_obj->type == ACPI_TYPE_INTEGER && (u32)out_obj->integer.value == 0xffffffff)) { - pr_debug( - "probe: Clevo GUIDs present but method returned unexpected value\n"); - ACPI_FREE(out_obj); - return -ENODEV; - } - ACPI_FREE(out_obj); - - // Add this interface - clevo_keyboard_add_interface(&clevo_wmi_interface); - - pr_info("interface initialized\n"); - - return 0; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) -static int clevo_wmi_remove(struct wmi_device *wdev) -#else -static void clevo_wmi_remove(struct wmi_device *wdev) -#endif -{ - pr_debug("clevo_wmi driver remove\n"); - clevo_keyboard_remove_interface(&clevo_wmi_interface); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) - return 0; -#endif -} - -static void clevo_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy) -{ - u32 event_value; - union acpi_object *out_obj; - u32 status; - - status = clevo_wmi_evaluate(0x01, 0, &out_obj); - if (!status) { - if (out_obj->type == ACPI_TYPE_INTEGER) { - event_value = (u32)out_obj->integer.value; - } else { - pr_err("return type not integer, use clevo_evaluate_method2\n"); - } - ACPI_FREE(out_obj); - } - pr_debug("clevo_wmi notify\n"); - if (!IS_ERR_OR_NULL(clevo_wmi_interface.event_callb)) { - // Execute registered callback - clevo_wmi_interface.event_callb(event_value); - } -} - -static const struct wmi_device_id clevo_wmi_device_ids[] = { - // Listing one should be enough, for a driver that "takes care of all anyways" - // also prevents probe (and handling) per "device" - { .guid_string = CLEVO_WMI_EVENT_GUID }, - { } -}; - -static struct wmi_driver clevo_wmi_driver = { - .driver = { - .name = CLEVO_INTERFACE_WMI_STRID, - .owner = THIS_MODULE - }, - .id_table = clevo_wmi_device_ids, - .probe = clevo_wmi_probe, - .remove = clevo_wmi_remove, - .notify = clevo_wmi_notify, -}; - -module_wmi_driver(clevo_wmi_driver); - -MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_DESCRIPTION("Driver for Clevo WMI interface"); -MODULE_VERSION("0.1.0"); -MODULE_LICENSE("GPL"); - -MODULE_DEVICE_TABLE(wmi, clevo_wmi_device_ids); -MODULE_ALIAS_CLEVO_WMI(); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io.c 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,843 +0,0 @@ -/*! - * Copyright (c) 2019-2023 TUXEDO Computers GmbH - * - * This file is part of tuxedo-io. - * - * tuxedo-io is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../clevo_interfaces.h" -#include "../uniwill_interfaces.h" -#include "tuxedo_io_ioctl.h" - -MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); -MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_VERSION("0.3.5"); -MODULE_LICENSE("GPL"); - -MODULE_ALIAS_CLEVO_INTERFACES(); -MODULE_ALIAS("wmi:" CLEVO_WMI_METHOD_GUID); -MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BA); -MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BB); -MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC); - -// Initialized in module init, global for ioctl interface -static u32 id_check_clevo; -static u32 id_check_uniwill; - -static struct uniwill_device_features_t *uw_feats; - -/** - * strstr version of dmi_match - */ -static bool dmi_string_in(enum dmi_field f, const char *str) -{ - const char *info = dmi_get_system_info(f); - - if (info == NULL || str == NULL) - return info == str; - - return strstr(info, str) != NULL; -} - -static u32 clevo_identify(void) -{ - return clevo_get_active_interface_id(NULL) == 0 ? 1 : 0; -} - -/* - * TDP boundary definitions per device - */ -static int tdp_min_ph4tux[] = { 0x05, 0x05, 0x00 }; -static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; - -static int tdp_min_ph4trx[] = { 0x05, 0x05, 0x00 }; -static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; - -static int tdp_min_ph4tqx[] = { 0x05, 0x05, 0x00 }; -static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; - -static int tdp_min_ph4axx[] = { 0x05, 0x05, 0x00 }; -static int tdp_max_ph4axx[] = { 0x2d, 0x3c, 0x00 }; - -static int tdp_min_phxpxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_phxpxx[] = { 0x2a, 0x32, 0x5a }; - -static int tdp_min_pfxluxg[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_pfxluxg[] = { 0x23, 0x23, 0x28 }; - -static int tdp_min_gmxngxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxngxx[] = { 0x50, 0x50, 0x5f }; - -static int tdp_min_gmxmgxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0xc8 }; - -static int tdp_min_gmxtgxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0xc8 }; - -static int tdp_min_gmxzgxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxzgxx[] = { 0x50, 0x50, 0x5f }; - -static int tdp_min_gmxagxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxagxx[] = { 0x78, 0x78, 0xd7 }; - -static int tdp_min_gmxrgxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxrgxx[] = { 0x64, 0x64, 0x6e }; - -static int tdp_min_gmxpxxx[] = { 0x05, 0x05, 0x05 }; -static int tdp_max_gmxpxxx[] = { 0x82, 0x82, 0xc8 }; - -static int *tdp_min_defs = NULL; -static int *tdp_max_defs = NULL; - -void uw_id_tdp(void) -{ - if (uw_feats->model == UW_MODEL_PH4TUX) { - tdp_min_defs = tdp_min_ph4tux; - tdp_max_defs = tdp_max_ph4tux; - } else if (uw_feats->model == UW_MODEL_PH4TRX) { - tdp_min_defs = tdp_min_ph4trx; - tdp_max_defs = tdp_max_ph4trx; - } else if (uw_feats->model == UW_MODEL_PH4TQF) { - tdp_min_defs = tdp_min_ph4tqx; - tdp_max_defs = tdp_max_ph4tqx; - } else if (uw_feats->model == UW_MODEL_PH4AQF_ARX) { - tdp_min_defs = tdp_min_ph4axx; - tdp_max_defs = tdp_max_ph4axx; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - } else if (dmi_match(DMI_PRODUCT_SKU, "IBP1XI08MK1")) { - tdp_min_defs = tdp_min_phxpxx; - tdp_max_defs = tdp_max_phxpxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "PULSE1502")) { - tdp_min_defs = tdp_min_pfxluxg; - tdp_max_defs = tdp_max_pfxluxg; - } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { - tdp_min_defs = tdp_min_gmxngxx; - tdp_max_defs = tdp_max_gmxngxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { - tdp_min_defs = tdp_min_gmxmgxx; - tdp_max_defs = tdp_max_gmxmgxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { - tdp_min_defs = tdp_min_gmxtgxx; - tdp_max_defs = tdp_max_gmxtgxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { - tdp_min_defs = tdp_min_gmxzgxx; - tdp_max_defs = tdp_max_gmxzgxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04")) { - tdp_min_defs = tdp_min_gmxagxx; - tdp_max_defs = tdp_max_gmxagxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04")) { - tdp_min_defs = tdp_min_gmxrgxx; - tdp_max_defs = tdp_max_gmxrgxx; - } else if (dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI05")) { - tdp_min_defs = tdp_min_gmxpxxx; - tdp_max_defs = tdp_max_gmxpxxx; -#endif - } else { - tdp_min_defs = NULL; - tdp_max_defs = NULL; - } -} - -static u32 uniwill_identify(void) -{ - u32 result = uniwill_get_active_interface_id(NULL) == 0 ? 1 : 0; - if (result) { - uw_feats = uniwill_get_device_features(); - uw_id_tdp(); - } - return result; -} - -/*static int fop_open(struct inode *inode, struct file *file) -{ - return 0; -} - -static int fop_release(struct inode *inode, struct file *file) -{ - return 0; -}*/ - -static long clevo_ioctl_interface(struct file *file, unsigned int cmd, unsigned long arg) -{ - u32 result = 0, status; - u32 copy_result; - u32 argument = (u32) arg; - - u32 clevo_arg; - - const char str_no_if[] = ""; - char *str_clevo_if; - - switch (cmd) { - case R_CL_HW_IF_STR: - if (clevo_get_active_interface_id(&str_clevo_if) == 0) { - copy_result = copy_to_user((char *) arg, str_clevo_if, strlen(str_clevo_if) + 1); - } else { - copy_result = copy_to_user((char *) arg, str_no_if, strlen(str_no_if) + 1); - } - break; - case R_CL_FANINFO1: - status = clevo_evaluate_method(CLEVO_CMD_GET_FANINFO1, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - case R_CL_FANINFO2: - status = clevo_evaluate_method(CLEVO_CMD_GET_FANINFO2, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - case R_CL_FANINFO3: - status = clevo_evaluate_method(CLEVO_CMD_GET_FANINFO3, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - /*case R_CL_FANINFO4: - status = clevo_evaluate_method(CLEVO_CMD_GET_FANINFO4, 0); - copy_to_user((int32_t *) arg, &result, sizeof(result)); - break;*/ - case R_CL_WEBCAM_SW: - status = clevo_evaluate_method(CLEVO_CMD_GET_WEBCAM_SW, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - case R_CL_FLIGHTMODE_SW: - status = clevo_evaluate_method(CLEVO_CMD_GET_FLIGHTMODE_SW, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - case R_CL_TOUCHPAD_SW: - status = clevo_evaluate_method(CLEVO_CMD_GET_TOUCHPAD_SW, 0, &result); - copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); - break; - } - - switch (cmd) { - case W_CL_FANSPEED: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - clevo_evaluate_method(CLEVO_CMD_SET_FANSPEED_VALUE, argument, &result); - // Note: Delay needed to let hardware catch up with the written value. - // No known ready flag. If the value is read too soon, the old value - // will still be read out. - // (Theoretically needed for other methods as well.) - // Can it be lower? 50ms is too low - msleep(100); - break; - case W_CL_FANAUTO: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - clevo_evaluate_method(CLEVO_CMD_SET_FANSPEED_AUTO, argument, &result); - break; - case W_CL_WEBCAM_SW: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - status = clevo_evaluate_method(CLEVO_CMD_GET_WEBCAM_SW, 0, &result); - // Only set status if it isn't already the right value - // (workaround for old and/or buggy WMI interfaces that toggle on write) - if ((argument & 0x01) != (result & 0x01)) { - clevo_evaluate_method(CLEVO_CMD_SET_WEBCAM_SW, argument, &result); - } - break; - case W_CL_FLIGHTMODE_SW: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - clevo_evaluate_method(CLEVO_CMD_SET_FLIGHTMODE_SW, argument, &result); - break; - case W_CL_TOUCHPAD_SW: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - clevo_evaluate_method(CLEVO_CMD_SET_TOUCHPAD_SW, argument, &result); - break; - case W_CL_PERF_PROFILE: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - clevo_arg = (CLEVO_CMD_OPT_SUB_SET_PERF_PROF << 0x18) | (argument & 0xff); - clevo_evaluate_method(CLEVO_CMD_OPT, clevo_arg, &result); - break; - } - - return 0; -} - -static int set_full_fan_mode(bool enable) { - u8 mode_data; - - uniwill_read_ec_ram(0x0751, &mode_data); - - if (enable && !(mode_data & 0x40)) { - // If not "full fan mode" (i.e. 0x40 bit not set) switch to it (required for old fancontrol) - return uniwill_write_ec_ram(0x0751, mode_data | 0x40); - } - else if (mode_data & 0x40){ - // If "full fan mode" (i.e. 0x40 bit set) turn it off (required for new fancontrol) - return uniwill_write_ec_ram(0x0751, mode_data & ~0x40); - } - - return 0; -} - -static bool fans_initialized = false; - -static int uw_init_fan(void) { - int i; - - u16 addr_use_custom_fan_table_0 = 0x07c5; // use different tables for both fans (0x0f00-0x0f2f and 0x0f30-0x0f5f respectivly) - u16 addr_use_custom_fan_table_1 = 0x07c6; // enable 0x0fxx fantables - u8 offset_use_custom_fan_table_0 = 7; - u8 offset_use_custom_fan_table_1 = 2; - u8 value_use_custom_fan_table_0; - u8 value_use_custom_fan_table_1; - u16 addr_cpu_custom_fan_table_end_temp = 0x0f00; - u16 addr_cpu_custom_fan_table_start_temp = 0x0f10; - u16 addr_cpu_custom_fan_table_fan_speed = 0x0f20; - u16 addr_gpu_custom_fan_table_end_temp = 0x0f30; - u16 addr_gpu_custom_fan_table_start_temp = 0x0f40; - u16 addr_gpu_custom_fan_table_fan_speed = 0x0f50; - - if (!fans_initialized && uw_feats->uniwill_has_universal_ec_fan_control) { - set_full_fan_mode(false); - - uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); - if (!((value_use_custom_fan_table_0 >> offset_use_custom_fan_table_0) & 1)) { - uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 + (1 << offset_use_custom_fan_table_0), 3); - } - - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_end_temp, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_start_temp, 0x00, 3); - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_fan_speed, 0x00, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_end_temp, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_start_temp, 0x00, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_fan_speed, 0x00, 3); - for (i = 0x1; i <= 0xf; ++i) { - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_end_temp + i, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_start_temp + i, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_fan_speed + i, 0x00, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_end_temp + i, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_start_temp + i, 0xff, 3); - uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_fan_speed + i, 0x00, 3); - } - - uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); - if (!((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1)) { - uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 + (1 << offset_use_custom_fan_table_1), 3); - } - } - - fans_initialized = true; - - return 0; -} - -static u32 uw_set_fan(u32 fan_index, u8 fan_speed) -{ - u32 i; - u8 mode_data; - u16 addr_fan0 = 0x1804; - u16 addr_fan1 = 0x1809; - u16 addr_for_fan; - - u16 addr_cpu_custom_fan_table_fan_speed = 0x0f20; - u16 addr_gpu_custom_fan_table_fan_speed = 0x0f50; - - if (uw_feats->uniwill_has_universal_ec_fan_control) { - uw_init_fan(); - - if (fan_index == 0) - addr_for_fan = addr_cpu_custom_fan_table_fan_speed; - else if (fan_index == 1) - addr_for_fan = addr_gpu_custom_fan_table_fan_speed; - else - return -EINVAL; - - if (fan_speed == 0) { - // Avoid hard coded EC behaviour: Setting fan speed = 0x00 spins the fan up - // to 0x3c (30%) for 3 minutes before going to 0x00. Setting fan speed = 1 - // also causes the fan to stop since on 2020 or later TF devices the - // microcontroller in the fan itself is intelligent enough to not try to - // start up the motor when the speed is to slow. Older devices don't use - // this fan controll anyway, but the else case below. - fan_speed = 1; - } - - uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff); - } - else { // old workaround using full fan mode - if (fan_index == 0) - addr_for_fan = addr_fan0; - else if (fan_index == 1) - addr_for_fan = addr_fan1; - else - return -EINVAL; - - // Check current mode - uniwill_read_ec_ram(0x0751, &mode_data); - if (!(mode_data & 0x40)) { - // If not "full fan mode" (i.e. 0x40 bit set) switch to it (required for fancontrol) - set_full_fan_mode(true); - // Attempt to write both fans as quick as possible before complete ramp-up - pr_debug("prevent ramp-up start\n"); - for (i = 0; i < 10; ++i) { - uniwill_write_ec_ram(addr_fan0, fan_speed & 0xff); - uniwill_write_ec_ram(addr_fan1, fan_speed & 0xff); - msleep(10); - } - pr_debug("prevent ramp-up done\n"); - } else { - // Otherwise just set the chosen fan - uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff); - } - } - - return 0; -} - -static u32 uw_set_fan_auto(void) -{ - u8 mode_data; - - if (uw_feats->uniwill_has_universal_ec_fan_control) { - u16 addr_use_custom_fan_table_0 = 0x07c5; // use different tables for both fans (0x0f00-0x0f2f and 0x0f30-0x0f5f respectivly) - u16 addr_use_custom_fan_table_1 = 0x07c6; // enable 0x0fxx fantables - u8 offset_use_custom_fan_table_0 = 7; - u8 offset_use_custom_fan_table_1 = 2; - u8 value_use_custom_fan_table_0; - u8 value_use_custom_fan_table_1; - uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); - if ((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1) { - uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 - (1 << offset_use_custom_fan_table_1), 3); - } - uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); - if ((value_use_custom_fan_table_0 >> offset_use_custom_fan_table_0) & 1) { - uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 - (1 << offset_use_custom_fan_table_0), 3); - } - fans_initialized = false; - } - else { - // Get current mode - uniwill_read_ec_ram(0x0751, &mode_data); - // Switch off "full fan mode" (i.e. unset 0x40 bit) - uniwill_write_ec_ram(0x0751, mode_data & 0xbf); - } - - return 0; -} - -static int uw_get_tdp_min(u8 tdp_index) -{ - if (tdp_index > 2) - return -EINVAL; - - if (tdp_min_defs == NULL) - return -ENODEV; - - if (tdp_min_defs[tdp_index] <= 0) { - return -ENODEV; - } - - return tdp_min_defs[tdp_index]; -} - -static int uw_get_tdp_max(u8 tdp_index) -{ - if (tdp_index > 2) - return -EINVAL; - - if (tdp_max_defs == NULL) - return -ENODEV; - - if (tdp_max_defs[tdp_index] <= 0) { - return -ENODEV; - } - - return tdp_max_defs[tdp_index]; -} - -static int uw_get_tdp(u8 tdp_index) -{ - u8 tdp_data; - u16 tdp_base_addr = 0x0783; - u16 tdp_current_addr = tdp_base_addr + tdp_index; - int status; - - // Use min tdp to detect support for chosen tdp parameter - int min_tdp_status = uw_get_tdp_min(tdp_index); - if (min_tdp_status < 0) - return min_tdp_status; - - status = uniwill_read_ec_ram(tdp_current_addr, &tdp_data); - if (status < 0) - return status; - - return tdp_data; -} - -static int uw_set_tdp(u8 tdp_index, u8 tdp_data) -{ - int tdp_min, tdp_max; - u16 tdp_base_addr = 0x0783; - u16 tdp_current_addr = tdp_base_addr + tdp_index; - - // Use min tdp to detect support for chosen tdp parameter - int min_tdp_status = uw_get_tdp_min(tdp_index); - if (min_tdp_status < 0) - return min_tdp_status; - - tdp_min = uw_get_tdp_min(tdp_index); - tdp_max = uw_get_tdp_max(tdp_index); - if (tdp_data < tdp_min || tdp_data > tdp_max) - return -EINVAL; - - uniwill_write_ec_ram(tdp_current_addr, tdp_data); - - return 0; -} - -/** - * Set profile 1-3 to 0xa0, 0x00 or 0x10 depending on - * device support. - */ -static u32 uw_set_performance_profile_v1(u8 profile_index) -{ - u8 current_value = 0x00, next_value; - u8 clear_bits = 0xa0 | 0x10; - u32 result; - result = uniwill_read_ec_ram(0x0751, ¤t_value); - if (result >= 0) { - next_value = current_value & ~clear_bits; - switch (profile_index) { - case 0x01: - next_value |= 0xa0; - break; - case 0x02: - next_value |= 0x00; - break; - case 0x03: - next_value |= 0x10; - break; - default: - result = -EINVAL; - break; - } - - if (result != -EINVAL) { - result = uniwill_write_ec_ram(0x0751, next_value); - } - } - - return result; -} - -static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigned long arg) -{ - u32 result = 0; - u32 copy_result; - u32 argument; - u8 byte_data; - const char str_no_if[] = ""; - char *str_uniwill_if; - -#ifdef DEBUG - union uw_ec_read_return reg_read_return; - union uw_ec_write_return reg_write_return; - u32 uw_arg[10]; - u32 uw_result[10]; - int i; - for (i = 0; i < 10; ++i) { - uw_result[i] = 0xdeadbeef; - } -#endif - - switch (cmd) { - case R_UW_HW_IF_STR: - if (uniwill_get_active_interface_id(&str_uniwill_if) == 0) { - copy_result = copy_to_user((char *) arg, str_uniwill_if, strlen(str_uniwill_if) + 1); - } else { - copy_result = copy_to_user((char *) arg, str_no_if, strlen(str_no_if) + 1); - } - break; - case R_UW_MODEL_ID: - result = uw_feats->model; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FANSPEED: - uniwill_read_ec_ram(0x1804, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FANSPEED2: - uniwill_read_ec_ram(0x1809, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FAN_TEMP: - uniwill_read_ec_ram(0x043e, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FAN_TEMP2: - uniwill_read_ec_ram(0x044f, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_MODE: - uniwill_read_ec_ram(0x0751, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_MODE_ENABLE: - uniwill_read_ec_ram(0x0741, &byte_data); - result = byte_data; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FANS_OFF_AVAILABLE: - /*result = uw_feats->uniwill_has_universal_ec_fan_control ? 1 : 0; - if (result == 1) { - result = 0; - } - else if (result == 0) { - result = 1; - }*/ - result = 1; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_FANS_MIN_SPEED: - /*result = uw_feats->uniwill_has_universal_ec_fan_control? 1 : 0; - if (result == 1) { - result = 20; - } - else if (result == 0) { - result = 0; - }*/ - result = 20; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP0: - result = uw_get_tdp(0); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP1: - result = uw_get_tdp(1); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP2: - result = uw_get_tdp(2); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP0_MIN: - result = uw_get_tdp_min(0); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP1_MIN: - result = uw_get_tdp_min(1); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP2_MIN: - result = uw_get_tdp_min(2); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP0_MAX: - result = uw_get_tdp_max(0); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP1_MAX: - result = uw_get_tdp_max(1); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_TDP2_MAX: - result = uw_get_tdp_max(2); - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; - case R_UW_PROFS_AVAILABLE: - result = 0; - if (uw_feats->uniwill_profile_v1_two_profs) - result = 2; - else if (uw_feats->uniwill_profile_v1_three_profs || uw_feats->uniwill_profile_v1_three_profs_leds_only) - result = 3; - copy_result = copy_to_user((void *) arg, &result, sizeof(result)); - break; -#ifdef DEBUG - case R_TF_BC: - copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg)); - reg_read_return.dword = 0; - result = uniwill_read_ec_ram((uw_arg[1] << 8) | uw_arg[0], ®_read_return.bytes.data_low); - copy_result = copy_to_user((void *) arg, ®_read_return.dword, sizeof(reg_read_return.dword)); - // pr_info("R_TF_BC args [%0#2x, %0#2x, %0#2x, %0#2x]\n", uw_arg[0], uw_arg[1], uw_arg[2], uw_arg[3]); - /*if (uniwill_ec_direct) { - result = uw_ec_read_addr_direct(uw_arg[0], uw_arg[1], ®_read_return); - copy_result = copy_to_user((void *) arg, ®_read_return.dword, sizeof(reg_read_return.dword)); - } else { - result = uw_wmi_ec_evaluate(uw_arg[0], uw_arg[1], uw_arg[2], uw_arg[3], 1, uw_result); - copy_result = copy_to_user((void *) arg, &uw_result, sizeof(uw_result)); - }*/ - break; -#endif - } - - switch (cmd) { - case W_UW_FANSPEED: - // Get fan speed argument - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_fan(0, argument); - break; - case W_UW_FANSPEED2: - // Get fan speed argument - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_fan(1, argument); - break; - case W_UW_MODE: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uniwill_write_ec_ram(0x0751, argument & 0xff); - break; - case W_UW_MODE_ENABLE: - // Note: Is for the moment set and cleared on init/exit of module (uniwill mode) - /* - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uniwill_write_ec_ram(0x0741, argument & 0x01); - */ - break; - case W_UW_FANAUTO: - uw_set_fan_auto(); - break; - case W_UW_TDP0: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_tdp(0, argument); - break; - case W_UW_TDP1: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_tdp(1, argument); - break; - case W_UW_TDP2: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_tdp(2, argument); - break; - case W_UW_PERF_PROF: - copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); - uw_set_performance_profile_v1(argument); - break; -#ifdef DEBUG - case W_TF_BC: - reg_write_return.dword = 0; - copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg)); - uniwill_write_ec_ram((uw_arg[1] << 8) | uw_arg[0], uw_arg[2]); - copy_result = copy_to_user((void *) arg, ®_write_return.dword, sizeof(reg_write_return.dword)); - /*if (uniwill_ec_direct) { - result = uw_ec_write_addr_direct(uw_arg[0], uw_arg[1], uw_arg[2], uw_arg[3], ®_write_return); - copy_result = copy_to_user((void *) arg, ®_write_return.dword, sizeof(reg_write_return.dword)); - } else { - result = uw_wmi_ec_evaluate(uw_arg[0], uw_arg[1], uw_arg[2], uw_arg[3], 0, uw_result); - copy_result = copy_to_user((void *) arg, &uw_result, sizeof(uw_result)); - reg_write_return.dword = uw_result[0]; - }*/ - /*pr_info("data_high %0#2x\n", reg_write_return.bytes.data_high); - pr_info("data_low %0#2x\n", reg_write_return.bytes.data_low); - pr_info("addr_high %0#2x\n", reg_write_return.bytes.addr_high); - pr_info("addr_low %0#2x\n", reg_write_return.bytes.addr_low);*/ - break; -#endif - } - - return 0; -} - -static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - u32 status; - // u32 result = 0; - u32 copy_result; - - const char *module_version = THIS_MODULE->version; - switch (cmd) { - case R_MOD_VERSION: - copy_result = copy_to_user((char *) arg, module_version, strlen(module_version) + 1); - break; - // Hardware id checks, 1 = positive, 0 = negative - case R_HWCHECK_CL: - id_check_clevo = clevo_identify(); - copy_result = copy_to_user((void *) arg, (void *) &id_check_clevo, sizeof(id_check_clevo)); - break; - case R_HWCHECK_UW: - id_check_uniwill = uniwill_identify(); - copy_result = copy_to_user((void *) arg, (void *) &id_check_uniwill, sizeof(id_check_uniwill)); - break; - } - - status = clevo_ioctl_interface(file, cmd, arg); - if (status != 0) return status; - status = uniwill_ioctl_interface(file, cmd, arg); - if (status != 0) return status; - - return 0; -} - -static struct file_operations fops_dev = { - .owner = THIS_MODULE, - .unlocked_ioctl = fop_ioctl -// .open = fop_open, -// .release = fop_release -}; - -struct class *tuxedo_io_device_class; -dev_t tuxedo_io_device_handle; - -static struct cdev tuxedo_io_cdev; - -static int __init tuxedo_io_init(void) -{ - int err; - - // Hardware identification - id_check_clevo = clevo_identify(); - id_check_uniwill = uniwill_identify(); - -#ifdef DEBUG - pr_debug("DEBUG is defined\n"); - - if (id_check_clevo == 0 && id_check_uniwill == 0) { - pr_debug("No matching hardware found on module load\n"); - } -#endif - - err = alloc_chrdev_region(&tuxedo_io_device_handle, 0, 1, "tuxedo_io_cdev"); - if (err != 0) { - pr_err("Failed to allocate chrdev region\n"); - return err; - } - cdev_init(&tuxedo_io_cdev, &fops_dev); - err = (cdev_add(&tuxedo_io_cdev, tuxedo_io_device_handle, 1)); - if (err < 0) { - pr_err("Failed to add cdev\n"); - unregister_chrdev_region(tuxedo_io_device_handle, 1); - } - tuxedo_io_device_class = class_create(THIS_MODULE, "tuxedo_io"); - device_create(tuxedo_io_device_class, NULL, tuxedo_io_device_handle, NULL, "tuxedo_io"); - pr_debug("Module init successful\n"); - - return 0; -} - -static void __exit tuxedo_io_exit(void) -{ - device_destroy(tuxedo_io_device_class, tuxedo_io_device_handle); - class_destroy(tuxedo_io_device_class); - cdev_del(&tuxedo_io_cdev); - unregister_chrdev_region(tuxedo_io_device_handle, 1); - pr_debug("Module exit\n"); -} - -module_init(tuxedo_io_init); -module_exit(tuxedo_io_exit); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io_ioctl.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io_ioctl.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io_ioctl.h 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/tuxedo_io/tuxedo_io_ioctl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/*! - * Copyright (c) 2019-2022 TUXEDO Computers GmbH - * - * This file is part of tuxedo-io. - * - * tuxedo-io is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef TUXEDO_IO_IOCTL_H -#define TUXEDO_IO_IOCTL_H - -#define IOCTL_MAGIC 0xEC - -#define MAGIC_READ_CL IOCTL_MAGIC + 1 -#define MAGIC_WRITE_CL IOCTL_MAGIC + 2 - -#define MAGIC_READ_UW IOCTL_MAGIC + 3 -#define MAGIC_WRITE_UW IOCTL_MAGIC + 4 - - -// General -#define R_MOD_VERSION _IOR(IOCTL_MAGIC, 0x00, char*) - -#define R_HWCHECK_CL _IOR(IOCTL_MAGIC, 0x05, int32_t*) -#define R_HWCHECK_UW _IOR(IOCTL_MAGIC, 0x06, int32_t*) - -/** - * Clevo interface - */ - -// Read -#define R_CL_HW_IF_STR _IOR(MAGIC_READ_CL, 0x00, char*) -#define R_CL_FANINFO1 _IOR(MAGIC_READ_CL, 0x10, int32_t*) -#define R_CL_FANINFO2 _IOR(MAGIC_READ_CL, 0x11, int32_t*) -#define R_CL_FANINFO3 _IOR(MAGIC_READ_CL, 0x12, int32_t*) -// #define R_FANINFO4 _IOR(MAGIC_READ_CL, 0x04, int32_t*) - -#define R_CL_WEBCAM_SW _IOR(MAGIC_READ_CL, 0x13, int32_t*) -#define R_CL_FLIGHTMODE_SW _IOR(MAGIC_READ_CL, 0x14, int32_t*) -#define R_CL_TOUCHPAD_SW _IOR(MAGIC_READ_CL, 0x15, int32_t*) - -#ifdef DEBUG -#define R_TF_BC _IOW(MAGIC_READ_CL, 0x91, uint32_t*) -#endif - -// Write -#define W_CL_FANSPEED _IOW(MAGIC_WRITE_CL, 0x10, int32_t*) -#define W_CL_FANAUTO _IOW(MAGIC_WRITE_CL, 0x11, int32_t*) - -#define W_CL_WEBCAM_SW _IOW(MAGIC_WRITE_CL, 0x12, int32_t*) -#define W_CL_FLIGHTMODE_SW _IOW(MAGIC_WRITE_CL, 0x13, int32_t*) -#define W_CL_TOUCHPAD_SW _IOW(MAGIC_WRITE_CL, 0x14, int32_t*) -#define W_CL_PERF_PROFILE _IOW(MAGIC_WRITE_CL, 0x15, int32_t*) - -#ifdef DEBUG -#define W_TF_BC _IOW(MAGIC_WRITE_CL, 0x91, uint32_t*) -#endif - -/** - * Uniwill interface - */ - -// Read -#define R_UW_HW_IF_STR _IOR(MAGIC_READ_UW, 0x00, char*) -#define R_UW_MODEL_ID _IOR(MAGIC_READ_UW, 0x01, int32_t*) -#define R_UW_FANSPEED _IOR(MAGIC_READ_UW, 0x10, int32_t*) -#define R_UW_FANSPEED2 _IOR(MAGIC_READ_UW, 0x11, int32_t*) -#define R_UW_FAN_TEMP _IOR(MAGIC_READ_UW, 0x12, int32_t*) -#define R_UW_FAN_TEMP2 _IOR(MAGIC_READ_UW, 0x13, int32_t*) - -#define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*) -#define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*) -#define R_UW_FANS_OFF_AVAILABLE _IOR(MAGIC_READ_UW, 0x16, int32_t*) -#define R_UW_FANS_MIN_SPEED _IOR(MAGIC_READ_UW, 0x17, int32_t*) - -#define R_UW_TDP0 _IOR(MAGIC_READ_UW, 0x18, int32_t*) -#define R_UW_TDP1 _IOR(MAGIC_READ_UW, 0x19, int32_t*) -#define R_UW_TDP2 _IOR(MAGIC_READ_UW, 0x1a, int32_t*) -#define R_UW_TDP0_MIN _IOR(MAGIC_READ_UW, 0x1b, int32_t*) -#define R_UW_TDP1_MIN _IOR(MAGIC_READ_UW, 0x1c, int32_t*) -#define R_UW_TDP2_MIN _IOR(MAGIC_READ_UW, 0x1d, int32_t*) -#define R_UW_TDP0_MAX _IOR(MAGIC_READ_UW, 0x1e, int32_t*) -#define R_UW_TDP1_MAX _IOR(MAGIC_READ_UW, 0x1f, int32_t*) -#define R_UW_TDP2_MAX _IOR(MAGIC_READ_UW, 0x20, int32_t*) - -#define R_UW_PROFS_AVAILABLE _IOR(MAGIC_READ_UW, 0x21, int32_t*) - -// Write -#define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) -#define W_UW_FANSPEED2 _IOW(MAGIC_WRITE_UW, 0x11, int32_t*) -#define W_UW_MODE _IOW(MAGIC_WRITE_UW, 0x12, int32_t*) -#define W_UW_MODE_ENABLE _IOW(MAGIC_WRITE_UW, 0x13, int32_t*) -#define W_UW_FANAUTO _IO(MAGIC_WRITE_UW, 0x14) // undo all previous calls of W_UW_FANSPEED and W_UW_FANSPEED2 - -#define W_UW_TDP0 _IOW(MAGIC_WRITE_UW, 0x15, int32_t*) -#define W_UW_TDP1 _IOW(MAGIC_WRITE_UW, 0x16, int32_t*) -#define W_UW_TDP2 _IOW(MAGIC_WRITE_UW, 0x17, int32_t*) - -#define W_UW_PERF_PROF _IOW(MAGIC_WRITE_UW, 0x18, int32_t*) - -#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_interfaces.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_interfaces.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_interfaces.h 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_interfaces.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -/*! - * Copyright (c) 2021 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef UNIWILL_INTERFACES_H -#define UNIWILL_INTERFACES_H - -#include - -#define UNIWILL_WMI_MGMT_GUID_BA "ABBC0F6D-8EA1-11D1-00A0-C90629100000" -#define UNIWILL_WMI_MGMT_GUID_BB "ABBC0F6E-8EA1-11D1-00A0-C90629100000" -#define UNIWILL_WMI_MGMT_GUID_BC "ABBC0F6F-8EA1-11D1-00A0-C90629100000" - -#define UNIWILL_WMI_EVENT_GUID_0 "ABBC0F70-8EA1-11D1-00A0-C90629100000" -#define UNIWILL_WMI_EVENT_GUID_1 "ABBC0F71-8EA1-11D1-00A0-C90629100000" -#define UNIWILL_WMI_EVENT_GUID_2 "ABBC0F72-8EA1-11D1-00A0-C90629100000" - -#define MODULE_ALIAS_UNIWILL_WMI() \ - MODULE_ALIAS("wmi:" UNIWILL_WMI_EVENT_GUID_2); \ - MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC); - -#define UNIWILL_INTERFACE_WMI_STRID "uniwill_wmi" - -typedef int (uniwill_read_ec_ram_t)(u16, u8*); -typedef int (uniwill_write_ec_ram_t)(u16, u8); -typedef int (uniwill_write_ec_ram_with_retry_t)(u16, u8, int); -typedef void (uniwill_event_callb_t)(u32); - -// UW_EC_REG_* known relevant EC address exposing some information or function -// UW_EC_REG_*_BIT_* single bit from byte holding information, should be handled with bit-wise operations -// UW_EC_REG_*_VALUE_* discrete value of the whole byte with special meaning -// UW_EC_REG_*_SUBCMD_* writing this discrete value triggers special behaviour - -#define UW_EC_REG_KBD_BL_STATUS 0x078c -#define UW_EC_REG_KBD_BL_STATUS_BIT_WHITE_ONLY_KB 0x01 -#define UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET 0x10 - -#define UW_EC_REG_KBD_BL_MAX_BRIGHTNESS 0x1801 -#define UW_EC_REG_KBD_BL_WHITE_BRIGHTNESS 0x1802 -#define UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS 0x1803 -#define UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS 0x1805 -#define UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS 0x1808 - -#define UW_EC_REG_BAREBONE_ID 0x0740 -#define UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx 0x09 -#define UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx 0x0e -#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TRX1 0x12 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TUX1 0x13 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 0x14 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 0x15 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx 0x16 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx 0x17 -#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx 0x18 - -#define UW_EC_REG_FEATURES_0 0x0765 -#define UW_EC_REG_FEATURES_1 0x0766 -#define UW_EC_REG_FEATURES_1_BIT_1_ZONE_RGB_KB 0x04 - -struct uniwill_interface_t { - char *string_id; - uniwill_event_callb_t *event_callb; - uniwill_read_ec_ram_t *read_ec_ram; - uniwill_write_ec_ram_t *write_ec_ram; -}; - -int uniwill_add_interface(struct uniwill_interface_t *new_interface); -int uniwill_remove_interface(struct uniwill_interface_t *interface); -uniwill_read_ec_ram_t uniwill_read_ec_ram; -uniwill_write_ec_ram_t uniwill_write_ec_ram; -uniwill_write_ec_ram_with_retry_t uniwill_write_ec_ram_with_retry; -int uniwill_get_active_interface_id(char **id_str); - -#define UW_MODEL_PF5LUXG 0x09 -#define UW_MODEL_PH4TUX 0x13 -#define UW_MODEL_PH4TRX 0x12 -#define UW_MODEL_PH4TQF 0x14 -#define UW_MODEL_PH4AQF_ARX 0x17 - -struct uniwill_device_features_t { - u8 model; - /** - * Identification for uniwill_power_profile_v1 - * - * - Two profiles present in low power devices often called - * "power save" and "balanced". - * - Three profiles present mainly in devices with discrete - * graphics card often called "power save", "balanced" - * and "enthusiast" - */ - bool uniwill_profile_v1; - bool uniwill_profile_v1_two_profs; - bool uniwill_profile_v1_three_profs; - bool uniwill_profile_v1_three_profs_leds_only; - bool uniwill_has_charging_prio; - bool uniwill_has_charging_profile; - bool uniwill_has_universal_ec_fan_control; -}; - -struct uniwill_device_features_t *uniwill_get_device_features(void); - -union uw_ec_read_return { - u32 dword; - struct { - u8 data_low; - u8 data_high; - } bytes; -}; - -union uw_ec_write_return { - u32 dword; - struct { - u8 addr_low; - u8 addr_high; - u8 data_low; - u8 data_high; - } bytes; -}; - -#endif diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_keyboard.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_keyboard.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_keyboard.h 2023-05-24 22:20:06.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_keyboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1161 +0,0 @@ -/*! - * Copyright (c) 2020-2021 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#ifndef UNIWILL_KEYBOARD_H -#define UNIWILL_KEYBOARD_H - -#include "clevo_keyboard_common.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "uniwill_interfaces.h" -#include "uniwill_leds.h" - -#define UNIWILL_OSD_RADIOON 0x01A -#define UNIWILL_OSD_RADIOOFF 0x01B -#define UNIWILL_OSD_KB_LED_LEVEL0 0x03B -#define UNIWILL_OSD_KB_LED_LEVEL1 0x03C -#define UNIWILL_OSD_KB_LED_LEVEL2 0x03D -#define UNIWILL_OSD_KB_LED_LEVEL3 0x03E -#define UNIWILL_OSD_KB_LED_LEVEL4 0x03F -#define UNIWILL_OSD_DC_ADAPTER_CHANGE 0x0AB -#define UNIWILL_OSD_MODE_CHANGE_KEY_EVENT 0x0B0 - -#define UNIWILL_KEY_RFKILL 0x0A4 -#define UNIWILL_KEY_KBDILLUMDOWN 0x0B1 -#define UNIWILL_KEY_KBDILLUMUP 0x0B2 -#define UNIWILL_KEY_KBDILLUMTOGGLE 0x0B9 - -#define UNIWILL_OSD_TOUCHPADWORKAROUND 0xFFF - -static void uw_charging_priority_write_state(void); -static void uw_charging_profile_write_state(void); - -struct tuxedo_keyboard_driver uniwill_keyboard_driver; - -struct uniwill_device_features_t uniwill_device_features; - -static bool uw_feats_loaded = false; - -static u8 uniwill_kbd_bl_enable_state_on_start; - -static struct key_entry uniwill_wmi_keymap[] = { - // { KE_KEY, UNIWILL_OSD_RADIOON, { KEY_RFKILL } }, - // { KE_KEY, UNIWILL_OSD_RADIOOFF, { KEY_RFKILL } }, - // { KE_KEY, 0xb0, { KEY_F13 } }, - // Manual mode rfkill - { KE_KEY, UNIWILL_KEY_RFKILL, { KEY_RFKILL }}, - { KE_KEY, UNIWILL_OSD_TOUCHPADWORKAROUND, { KEY_F21 } }, - // Keyboard brightness - { KE_KEY, UNIWILL_KEY_KBDILLUMDOWN, { KEY_KBDILLUMDOWN } }, - { KE_KEY, UNIWILL_KEY_KBDILLUMUP, { KEY_KBDILLUMUP } }, - { KE_KEY, UNIWILL_KEY_KBDILLUMTOGGLE, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL0, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL1, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL2, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL3, { KEY_KBDILLUMTOGGLE } }, - { KE_KEY, UNIWILL_OSD_KB_LED_LEVEL4, { KEY_KBDILLUMTOGGLE } }, - // Only used to put ev bits - { KE_KEY, 0xffff, { KEY_F6 } }, - { KE_KEY, 0xffff, { KEY_LEFTALT } }, - { KE_KEY, 0xffff, { KEY_LEFTMETA } }, - { KE_END, 0 } -}; - -static struct uniwill_interfaces_t { - struct uniwill_interface_t *wmi; -} uniwill_interfaces = { .wmi = NULL }; - -uniwill_event_callb_t uniwill_event_callb; - -int uniwill_read_ec_ram(u16 address, u8 *data) -{ - int status; - - if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) - status = uniwill_interfaces.wmi->read_ec_ram(address, data); - else { - pr_err("no active interface while read addr 0x%04x\n", address); - status = -EIO; - } - - return status; -} -EXPORT_SYMBOL(uniwill_read_ec_ram); - -int uniwill_write_ec_ram(u16 address, u8 data) -{ - int status; - - if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) - status = uniwill_interfaces.wmi->write_ec_ram(address, data); - else { - pr_err("no active interface while write addr 0x%04x data 0x%02x\n", address, data); - status = -EIO; - } - - return status; -} -EXPORT_SYMBOL(uniwill_write_ec_ram); - -int uniwill_write_ec_ram_with_retry(u16 address, u8 data, int retries) -{ - u32 status; - int i; - u8 control_data; - - for (i = 0; i < retries; ++i) { - status = uniwill_write_ec_ram(address, data); - if (status != 0) { - msleep(50); - continue; - } - else { - status = uniwill_read_ec_ram(address, &control_data); - if (status != 0 || data != control_data) { - msleep(50); - continue; - } - break; - } - } - - return status; -} -EXPORT_SYMBOL(uniwill_write_ec_ram_with_retry); - -static DEFINE_MUTEX(uniwill_interface_modification_lock); - -int uniwill_add_interface(struct uniwill_interface_t *interface) -{ - mutex_lock(&uniwill_interface_modification_lock); - - if (strcmp(interface->string_id, UNIWILL_INTERFACE_WMI_STRID) == 0) - uniwill_interfaces.wmi = interface; - else { - TUXEDO_DEBUG("trying to add unknown interface\n"); - mutex_unlock(&uniwill_interface_modification_lock); - return -EINVAL; - } - interface->event_callb = uniwill_event_callb; - - mutex_unlock(&uniwill_interface_modification_lock); - - // Initialize driver if not already present - tuxedo_keyboard_init_driver(&uniwill_keyboard_driver); - - return 0; -} -EXPORT_SYMBOL(uniwill_add_interface); - -int uniwill_remove_interface(struct uniwill_interface_t *interface) -{ - mutex_lock(&uniwill_interface_modification_lock); - - if (strcmp(interface->string_id, UNIWILL_INTERFACE_WMI_STRID) == 0) { - // Remove driver if last interface is removed - tuxedo_keyboard_remove_driver(&uniwill_keyboard_driver); - - uniwill_interfaces.wmi = NULL; - } else { - mutex_unlock(&uniwill_interface_modification_lock); - return -EINVAL; - } - - mutex_unlock(&uniwill_interface_modification_lock); - - return 0; -} -EXPORT_SYMBOL(uniwill_remove_interface); - -int uniwill_get_active_interface_id(char **id_str) -{ - if (IS_ERR_OR_NULL(uniwill_interfaces.wmi)) - return -ENODEV; - - if (!IS_ERR_OR_NULL(id_str)) - *id_str = uniwill_interfaces.wmi->string_id; - - return 0; -} -EXPORT_SYMBOL(uniwill_get_active_interface_id); - -static void key_event_work(struct work_struct *work) -{ - sparse_keymap_report_known_event( - uniwill_keyboard_driver.input_device, - UNIWILL_OSD_TOUCHPADWORKAROUND, - 1, - true - ); -} - -// Previous key codes for detecting longer combination -static u32 prev_key = 0, prevprev_key = 0; -static DECLARE_WORK(uniwill_key_event_work, key_event_work); - -static int keyboard_notifier_callb(struct notifier_block *nb, unsigned long code, void *_param) -{ - struct keyboard_notifier_param *param = _param; - int ret = NOTIFY_OK; - - if (!param->down) { - - if (code == KBD_KEYCODE) { - switch (param->value) { - case 125: - // If the last keys up were 85 -> 29 -> 125 - // manually report KEY_F21 - if (prevprev_key == 85 && prev_key == 29) { - TUXEDO_DEBUG("Touchpad Toggle\n"); - schedule_work(&uniwill_key_event_work); - ret = NOTIFY_OK; - } - break; - } - prevprev_key = prev_key; - prev_key = param->value; - } - } - - return ret; -} - -static struct notifier_block keyboard_notifier_block = { - .notifier_call = keyboard_notifier_callb -}; - -static void uniwill_write_kbd_bl_enable(u8 enable) -{ - u8 backlight_data; - enable = enable & 0x01; - - uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &backlight_data); - backlight_data = backlight_data & ~(1 << 1); - backlight_data |= (!enable << 1); - uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, backlight_data); -} - -void uniwill_event_callb(u32 code) -{ - if (uniwill_keyboard_driver.input_device != NULL) - if (!sparse_keymap_report_known_event(uniwill_keyboard_driver.input_device, code, 1, true)) { - TUXEDO_DEBUG("Unknown code - %d (%0#6x)\n", code, code); - } - - // Special key combination when mode change key is pressed - if (code == UNIWILL_OSD_MODE_CHANGE_KEY_EVENT) { - input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTMETA, 1); - input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTALT, 1); - input_report_key(uniwill_keyboard_driver.input_device, KEY_F6, 1); - input_sync(uniwill_keyboard_driver.input_device); - input_report_key(uniwill_keyboard_driver.input_device, KEY_F6, 0); - input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTALT, 0); - input_report_key(uniwill_keyboard_driver.input_device, KEY_LEFTMETA, 0); - input_sync(uniwill_keyboard_driver.input_device); - } - - // Refresh keyboard state and charging prio on cable switch event - if (code == UNIWILL_OSD_DC_ADAPTER_CHANGE) { - uniwill_leds_restore_state_extern(); - - msleep(50); - uw_charging_priority_write_state(); - } -} - -static void uw_kbd_bl_init_set(struct platform_device *dev) -{ - uniwill_leds_init_late(dev); - uniwill_write_kbd_bl_enable(1); -} - -// Keep track of previous colors on start, init array with different non-colors -static u32 uw_prev_colors[] = {0x01000000, 0x02000000, 0x03000000}; -static u32 uw_prev_colors_size = 3; -static u32 uw_prev_colors_index = 0; - -// Timer for checking animation colors -static struct timer_list uw_kbd_bl_init_timer; -static volatile int uw_kbd_bl_check_count = 40; -static int uw_kbd_bl_init_check_interval_ms = 500; - -static int uniwill_read_kbd_bl_rgb(u8 *red, u8 *green, u8 *blue) -{ - int result = 0; - - result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS, red); - if (result) { - return result; - } - result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS, green); - if (result) { - return result; - } - result = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, blue); - if (result) { - return result; - } - - return result; -} - -static struct platform_device *uw_kbd_bl_init_ready_check_work_func_args_dev; - -static void uw_kbd_bl_init_ready_check_work_func(struct work_struct *work) -{ - u8 uw_cur_red, uw_cur_green, uw_cur_blue; - int i; - bool prev_colors_same; - uniwill_read_kbd_bl_rgb(&uw_cur_red, &uw_cur_green, &uw_cur_blue); - uw_prev_colors[uw_prev_colors_index] = (uw_cur_red << 0x10) | (uw_cur_green << 0x08) | uw_cur_blue; - uw_prev_colors_index = (uw_prev_colors_index + 1) % uw_prev_colors_size; - - prev_colors_same = true; - for (i = 1; i < uw_prev_colors_size; ++i) { - if (uw_prev_colors[i-1] != uw_prev_colors[i]) prev_colors_same = false; - } - - if (prev_colors_same) { - uw_kbd_bl_init_set(uw_kbd_bl_init_ready_check_work_func_args_dev); - del_timer(&uw_kbd_bl_init_timer); - } else { - if (uw_kbd_bl_check_count != 0) { - mod_timer(&uw_kbd_bl_init_timer, jiffies + msecs_to_jiffies(uw_kbd_bl_init_check_interval_ms)); - } else { - TUXEDO_INFO("uw kbd init timeout, failed to detect end of boot animation\n"); - del_timer(&uw_kbd_bl_init_timer); - } - } - - uw_kbd_bl_check_count -= 1; -} - -static DECLARE_WORK(uw_kbd_bl_init_ready_check_work, uw_kbd_bl_init_ready_check_work_func); - -static void uw_kbd_bl_init_ready_check(struct timer_list *t) -{ - schedule_work(&uw_kbd_bl_init_ready_check_work); -} - -static int uw_kbd_bl_init(struct platform_device *dev) -{ - int status = 0; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) - TUXEDO_ERROR("Warning: Kernel version less that 4.18, keyboard backlight might not be properly recognized."); -#endif - - uniwill_leds_init_early(dev); - - if (uniwill_leds_get_backlight_type() == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - // Start periodic checking of animation, set and enable bl when done - uw_kbd_bl_init_ready_check_work_func_args_dev = dev; - timer_setup(&uw_kbd_bl_init_timer, uw_kbd_bl_init_ready_check, 0); - mod_timer(&uw_kbd_bl_init_timer, jiffies + msecs_to_jiffies(uw_kbd_bl_init_check_interval_ms)); - } else { - // For non-RGB versions - // Enable keyboard backlight immediately (should it be disabled) - uniwill_write_kbd_bl_enable(1); - } - - return status; -} - -#define UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS 0x24 -#define UNIWILL_LIGHTBAR_LED_NAME_RGB_RED "lightbar_rgb:1:status" -#define UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN "lightbar_rgb:2:status" -#define UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE "lightbar_rgb:3:status" -#define UNIWILL_LIGHTBAR_LED_NAME_ANIMATION "lightbar_animation::status" - -static void uniwill_write_lightbar_rgb(u8 red, u8 green, u8 blue) -{ - if (red <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { - uniwill_write_ec_ram(0x0749, red); - } - if (green <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { - uniwill_write_ec_ram(0x074a, green); - } - if (blue <= UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS) { - uniwill_write_ec_ram(0x074b, blue); - } -} - -static void uniwill_read_lightbar_rgb(u8 *red, u8 *green, u8 *blue) -{ - uniwill_read_ec_ram(0x0749, red); - uniwill_read_ec_ram(0x074a, green); - uniwill_read_ec_ram(0x074b, blue); -} - -static void uniwill_write_lightbar_animation(bool animation_status) -{ - u8 value; - - uniwill_read_ec_ram(0x0748, &value); - if (animation_status) { - value |= 0x80; - } else { - value &= ~0x80; - } - uniwill_write_ec_ram(0x0748, value); -} - -static void uniwill_read_lightbar_animation(bool *animation_status) -{ - u8 lightbar_animation_data; - uniwill_read_ec_ram(0x0748, &lightbar_animation_data); - *animation_status = (lightbar_animation_data & 0x80) > 0; -} - -static int lightbar_set_blocking(struct led_classdev *led_cdev, enum led_brightness brightness) -{ - u8 red = 0xff, green = 0xff, blue = 0xff; - bool led_red = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_RED) != NULL; - bool led_green = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN) != NULL; - bool led_blue = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE) != NULL; - bool led_animation = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_ANIMATION) != NULL; - - if (led_red || led_green || led_blue) { - if (led_red) { - red = brightness; - } else if (led_green) { - green = brightness; - } else if (led_blue) { - blue = brightness; - } - uniwill_write_lightbar_rgb(red, green, blue); - // Also make sure the animation is off - uniwill_write_lightbar_animation(false); - } else if (led_animation) { - if (brightness == 1) { - uniwill_write_lightbar_animation(true); - } else { - uniwill_write_lightbar_animation(false); - } - } - return 0; -} - -static enum led_brightness lightbar_get(struct led_classdev *led_cdev) -{ - u8 red, green, blue; - bool animation_status; - bool led_red = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_RED) != NULL; - bool led_green = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN) != NULL; - bool led_blue = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE) != NULL; - bool led_animation = strstr(led_cdev->name, UNIWILL_LIGHTBAR_LED_NAME_ANIMATION) != NULL; - - if (led_red || led_green || led_blue) { - uniwill_read_lightbar_rgb(&red, &green, &blue); - if (led_red) { - return red; - } else if (led_green) { - return green; - } else if (led_blue) { - return blue; - } - } else if (led_animation) { - uniwill_read_lightbar_animation(&animation_status); - return animation_status ? 1 : 0; - } - - return 0; -} - -static bool uw_lightbar_loaded; -static struct led_classdev lightbar_led_classdevs[] = { - { - .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_RED, - .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, - .brightness_set_blocking = &lightbar_set_blocking, - .brightness_get = &lightbar_get - }, - { - .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_GREEN, - .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, - .brightness_set_blocking = &lightbar_set_blocking, - .brightness_get = &lightbar_get - }, - { - .name = UNIWILL_LIGHTBAR_LED_NAME_RGB_BLUE, - .max_brightness = UNIWILL_LIGHTBAR_LED_MAX_BRIGHTNESS, - .brightness_set_blocking = &lightbar_set_blocking, - .brightness_get = &lightbar_get - }, - { - .name = UNIWILL_LIGHTBAR_LED_NAME_ANIMATION, - .max_brightness = 1, - .brightness_set_blocking = &lightbar_set_blocking, - .brightness_get = &lightbar_get - } -}; - -static int uw_lightbar_init(struct platform_device *dev) -{ - int i, j, status; - - bool lightbar_supported = false - || dmi_match(DMI_BOARD_NAME, "LAPQC71A") - || dmi_match(DMI_BOARD_NAME, "LAPQC71B") - || dmi_match(DMI_BOARD_NAME, "TRINITY1501I") - || dmi_match(DMI_BOARD_NAME, "TRINITY1701I") - || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") - || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") - -#endif - ; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) - TUXEDO_ERROR( - "Warning: Kernel version less that 4.18, lightbar might not be properly recognized."); -#endif - - if (!lightbar_supported) - return -ENODEV; - - for (i = 0; i < ARRAY_SIZE(lightbar_led_classdevs); ++i) { - status = led_classdev_register(&dev->dev, &lightbar_led_classdevs[i]); - if (status < 0) { - for (j = 0; j < i; j++) - led_classdev_unregister(&lightbar_led_classdevs[j]); - return status; - } - } - - // Init default state - uniwill_write_lightbar_animation(false); - uniwill_write_lightbar_rgb(0, 0, 0); - - return 0; -} - -static int uw_lightbar_remove(struct platform_device *dev) -{ - int i; - for (i = 0; i < ARRAY_SIZE(lightbar_led_classdevs); ++i) { - led_classdev_unregister(&lightbar_led_classdevs[i]); - } - return 0; -} - -static bool uw_charging_prio_loaded = false; -static bool uw_charging_prio_last_written_value; - -static ssize_t uw_charging_prios_available_show(struct device *child, - struct device_attribute *attr, - char *buffer); -static ssize_t uw_charging_prio_show(struct device *child, - struct device_attribute *attr, char *buffer); -static ssize_t uw_charging_prio_store(struct device *child, - struct device_attribute *attr, - const char *buffer, size_t size); - -struct uw_charging_prio_attrs_t { - struct device_attribute charging_prios_available; - struct device_attribute charging_prio; -} uw_charging_prio_attrs = { - .charging_prios_available = __ATTR(charging_prios_available, 0444, uw_charging_prios_available_show, NULL), - .charging_prio = __ATTR(charging_prio, 0644, uw_charging_prio_show, uw_charging_prio_store) -}; - -static struct attribute *uw_charging_prio_attrs_list[] = { - &uw_charging_prio_attrs.charging_prios_available.attr, - &uw_charging_prio_attrs.charging_prio.attr, - NULL -}; - -static struct attribute_group uw_charging_prio_attr_group = { - .name = "charging_priority", - .attrs = uw_charging_prio_attrs_list -}; - -/* - * charging_prio values - * 0 => charging priority - * 1 => performance priority - */ -static int uw_set_charging_priority(u8 charging_priority) -{ - u8 previous_data, next_data; - int result; - - charging_priority = (charging_priority & 0x01) << 7; - - result = uniwill_read_ec_ram(0x07cc, &previous_data); - if (result != 0) - return result; - - next_data = (previous_data & ~(1 << 7)) | charging_priority; - result = uniwill_write_ec_ram(0x07cc, next_data); - if (result == 0) - uw_charging_prio_last_written_value = charging_priority; - - return result; -} - -static int uw_get_charging_priority(u8 *charging_priority) -{ - int result = uniwill_read_ec_ram(0x07cc, charging_priority); - *charging_priority = (*charging_priority >> 7) & 0x01; - return result; -} - -static int uw_has_charging_priority(bool *status) -{ - u8 data; - int result; - - bool not_supported_device = false - || dmi_match(DMI_BOARD_NAME, "PF5PU1G") - || dmi_match(DMI_BOARD_NAME, "LAPQC71A") - || dmi_match(DMI_BOARD_NAME, "LAPQC71B") - || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") - ; - - if (not_supported_device) { - *status = false; - return 0; - } - - result = uniwill_read_ec_ram(0x0742, &data); - if (result != 0) - return -EIO; - - if (data & (1 << 5)) - *status = true; - else - *status = false; - - return 0; -} - -static void uw_charging_priority_write_state(void) -{ - if (uw_charging_prio_loaded) - uw_set_charging_priority(uw_charging_prio_last_written_value); -} - -static void uw_charging_priority_init(struct platform_device *dev) -{ - u8 value; - struct uniwill_device_features_t *uw_feats = &uniwill_device_features; - - if (uw_feats->uniwill_has_charging_prio) - uw_charging_prio_loaded = sysfs_create_group(&dev->dev.kobj, &uw_charging_prio_attr_group) == 0; - - // Read for state init - if (uw_charging_prio_loaded) { - uw_get_charging_priority(&value); - uw_charging_prio_last_written_value = value; - } -} - -static bool uw_charging_profile_loaded = false; -static bool uw_charging_profile_last_written_value; - -static ssize_t uw_charging_profiles_available_show(struct device *child, - struct device_attribute *attr, - char *buffer); -static ssize_t uw_charging_profile_show(struct device *child, - struct device_attribute *attr, char *buffer); -static ssize_t uw_charging_profile_store(struct device *child, - struct device_attribute *attr, - const char *buffer, size_t size); - -struct uw_charging_profile_attrs_t { - struct device_attribute charging_profiles_available; - struct device_attribute charging_profile; -} uw_charging_profile_attrs = { - .charging_profiles_available = __ATTR(charging_profiles_available, 0444, uw_charging_profiles_available_show, NULL), - .charging_profile = __ATTR(charging_profile, 0644, uw_charging_profile_show, uw_charging_profile_store) -}; - -static struct attribute *uw_charging_profile_attrs_list[] = { - &uw_charging_profile_attrs.charging_profiles_available.attr, - &uw_charging_profile_attrs.charging_profile.attr, - NULL -}; - -static struct attribute_group uw_charging_profile_attr_group = { - .name = "charging_profile", - .attrs = uw_charging_profile_attrs_list -}; - -/* - * charging_profile values - * 0 => high capacity - * 1 => balanced - * 2 => stationary - */ -static int uw_set_charging_profile(u8 charging_profile) -{ - u8 previous_data, next_data; - int result; - - charging_profile = (charging_profile & 0x03) << 4; - - result = uniwill_read_ec_ram(0x07a6, &previous_data); - if (result != 0) - return result; - - next_data = (previous_data & ~(0x03 << 4)) | charging_profile; - result = uniwill_write_ec_ram(0x07a6, next_data); - - if (result == 0) - uw_charging_profile_last_written_value = charging_profile; - - return result; -} - -static int uw_get_charging_profile(u8 *charging_profile) -{ - int result = uniwill_read_ec_ram(0x07a6, charging_profile); - if (result == 0) - *charging_profile = (*charging_profile >> 4) & 0x03; - return result; -} - -static int uw_has_charging_profile(bool *status) -{ - u8 data; - int result; - - bool not_supported_device = false - || dmi_match(DMI_BOARD_NAME, "PF5PU1G") - || dmi_match(DMI_BOARD_NAME, "LAPQC71A") - || dmi_match(DMI_BOARD_NAME, "LAPQC71B") - || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") - ; - - if (not_supported_device) { - *status = false; - return 0; - } - - result = uniwill_read_ec_ram(0x078e, &data); - if (result != 0) - return -EIO; - - if (data & (1 << 3)) - *status = true; - else - *status = false; - - return 0; -} - -static void uw_charging_profile_write_state(void) -{ - if (uw_charging_profile_loaded) - uw_set_charging_profile(uw_charging_profile_last_written_value); -} - -static void uw_charging_profile_init(struct platform_device *dev) -{ - u8 value; - struct uniwill_device_features_t *uw_feats = &uniwill_device_features; - - if (uw_feats->uniwill_has_charging_profile) - uw_charging_profile_loaded = sysfs_create_group(&dev->dev.kobj, &uw_charging_profile_attr_group) == 0; - - // Read for state init - if (uw_charging_profile_loaded) { - uw_get_charging_profile(&value); - uw_charging_profile_last_written_value = value; - } -} - -struct char_to_u8_t { - char* descriptor; - u8 value; -}; - -static struct char_to_u8_t charging_profile_options[] = { - { .descriptor = "high_capacity", .value = 0x00 }, - { .descriptor = "balanced", .value = 0x01 }, - { .descriptor = "stationary", .value = 0x02 } -}; - -static ssize_t uw_charging_profiles_available_show(struct device *child, - struct device_attribute *attr, - char *buffer) -{ - int i, n; - n = ARRAY_SIZE(charging_profile_options); - for (i = 0; i < n; ++i) { - sprintf(buffer + strlen(buffer), "%s", - charging_profile_options[i].descriptor); - if (i < n - 1) - sprintf(buffer + strlen(buffer), " "); - else - sprintf(buffer + strlen(buffer), "\n"); - } - - return strlen(buffer); -} - -static ssize_t uw_charging_profile_show(struct device *child, - struct device_attribute *attr, char *buffer) -{ - u8 charging_profile_value; - int i, result; - - result = uw_get_charging_profile(&charging_profile_value); - if (result != 0) - return result; - - for (i = 0; i < ARRAY_SIZE(charging_profile_options); ++i) - if (charging_profile_options[i].value == charging_profile_value) { - sprintf(buffer, "%s\n", charging_profile_options[i].descriptor); - return strlen(buffer); - } - - pr_err("Read charging profile value not matched to a descriptor\n"); - - return -EIO; -} - -static ssize_t uw_charging_profile_store(struct device *child, - struct device_attribute *attr, - const char *buffer, size_t size) -{ - u8 charging_profile_value; - int i, result; - char *buffer_copy; - char *charging_profile_descriptor; - buffer_copy = kmalloc(size + 1, GFP_KERNEL); - strcpy(buffer_copy, buffer); - charging_profile_descriptor = strstrip(buffer_copy); - - for (i = 0; i < ARRAY_SIZE(charging_profile_options); ++i) - if (strcmp(charging_profile_options[i].descriptor, charging_profile_descriptor) == 0) { - charging_profile_value = charging_profile_options[i].value; - break; - } - - kfree(buffer_copy); - - if (i < ARRAY_SIZE(charging_profile_options)) { - // Option found try to set - result = uw_set_charging_profile(charging_profile_value); - if (result == 0) - return size; - else - return -EIO; - } else - // Invalid input, not matched to an option - return -EINVAL; -} - -static struct char_to_u8_t charging_prio_options[] = { - { .descriptor = "charge_battery", .value = 0x00 }, - { .descriptor = "performance", .value = 0x01 } -}; - -static ssize_t uw_charging_prios_available_show(struct device *child, - struct device_attribute *attr, - char *buffer) -{ - int i, n; - n = ARRAY_SIZE(charging_prio_options); - for (i = 0; i < n; ++i) { - sprintf(buffer + strlen(buffer), "%s", - charging_prio_options[i].descriptor); - if (i < n - 1) - sprintf(buffer + strlen(buffer), " "); - else - sprintf(buffer + strlen(buffer), "\n"); - } - - return strlen(buffer); -} - -static ssize_t uw_charging_prio_show(struct device *child, - struct device_attribute *attr, char *buffer) -{ - u8 charging_prio_value; - int i, result; - - result = uw_get_charging_priority(&charging_prio_value); - if (result != 0) - return result; - - for (i = 0; i < ARRAY_SIZE(charging_prio_options); ++i) - if (charging_prio_options[i].value == charging_prio_value) { - sprintf(buffer, "%s\n", charging_prio_options[i].descriptor); - return strlen(buffer); - } - - pr_err("Read charging prio value not matched to a descriptor\n"); - - return -EIO; -} - -static ssize_t uw_charging_prio_store(struct device *child, - struct device_attribute *attr, - const char *buffer, size_t size) -{ - u8 charging_prio_value; - int i, result; - char *buffer_copy; - char *charging_prio_descriptor; - buffer_copy = kmalloc(size + 1, GFP_KERNEL); - strcpy(buffer_copy, buffer); - charging_prio_descriptor = strstrip(buffer_copy); - - for (i = 0; i < ARRAY_SIZE(charging_prio_options); ++i) - if (strcmp(charging_prio_options[i].descriptor, charging_prio_descriptor) == 0) { - charging_prio_value = charging_prio_options[i].value; - break; - } - - kfree(buffer_copy); - - if (i < ARRAY_SIZE(charging_prio_options)) { - // Option found try to set - result = uw_set_charging_priority(charging_prio_value); - if (result == 0) - return size; - else - return -EIO; - } else - // Invalid input, not matched to an option - return -EINVAL; -} - -static int has_universal_ec_fan_control(void) { - int ret; - u8 data; - - struct uniwill_device_features_t *uw_feats = &uniwill_device_features; - - if (uw_feats->model == UW_MODEL_PH4TRX) { - // For some reason, on this particular device, the 2nd fan is not controlled via the - // "GPU" fan curve when the bit to separate both fancurves is set, but the old fan - // control works just fine. - return 0; - } - - ret = uniwill_read_ec_ram(0x078e, &data); - if (ret < 0) { - return ret; - } - return (data >> 6) & 1; -} - -struct uniwill_device_features_t *uniwill_get_device_features(void) -{ - struct uniwill_device_features_t *uw_feats = &uniwill_device_features; - u32 status; - int result; - bool feats_loaded; - - if (uw_feats_loaded) - return uw_feats; - - feats_loaded = true; - - status = uniwill_read_ec_ram(0x0740, &uw_feats->model); - if (status != 0) { - uw_feats->model = 0; - feats_loaded = false; - } - - uw_feats->uniwill_profile_v1_two_profs = false - || dmi_match(DMI_BOARD_NAME, "PF5PU1G") - || dmi_match(DMI_BOARD_NAME, "PULSE1401") - || dmi_match(DMI_BOARD_NAME, "PULSE1501") - ; - - uw_feats->uniwill_profile_v1_three_profs = false - // Devices with "classic" profile support - || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501I2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701A1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") - // Note: XMG Fusion removed for now, seem to have - // neither same power profile control nor TDP set - //|| dmi_match(DMI_BOARD_NAME, "LAPQC71A") - //|| dmi_match(DMI_BOARD_NAME, "LAPQC71B") - //|| dmi_match(DMI_PRODUCT_NAME, "A60 MUV") - ; - - uw_feats->uniwill_profile_v1_three_profs_leds_only = false - // Devices where profile mainly controls power profile LED status -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") - || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") -#endif - ; - - uw_feats->uniwill_profile_v1 = - uw_feats->uniwill_profile_v1_two_profs || - uw_feats->uniwill_profile_v1_three_profs; - - if (uw_has_charging_priority(&uw_feats->uniwill_has_charging_prio) != 0) - feats_loaded = false; - if (uw_has_charging_profile(&uw_feats->uniwill_has_charging_profile) != 0) - feats_loaded = false; - - result = has_universal_ec_fan_control(); - if (result < 0) { - feats_loaded = false; - } else { - uw_feats->uniwill_has_universal_ec_fan_control = (result == 1); - } - - - if (feats_loaded) - pr_debug("feats loaded\n"); - else - pr_debug("feats not yet loaded\n"); - - uw_feats_loaded = feats_loaded; - - return uw_feats; -} -EXPORT_SYMBOL(uniwill_get_device_features); - -static int uniwill_keyboard_probe(struct platform_device *dev) -{ - u32 i; - u8 data; - int status; - - struct uniwill_device_features_t *uw_feats = uniwill_get_device_features(); - - // FIXME Hard set balanced profile until we have implemented a way to - // switch it while tuxedo_io is loaded - // uw_ec_write_addr(0x51, 0x07, 0x00, 0x00, ®_write_return); - uniwill_write_ec_ram(0x0751, 0x00); - - if (uw_feats->uniwill_profile_v1) { - // Set manual-mode fan-curve in 0x0743 - 0x0747 - // Some kind of default fan-curve is stored in 0x0786 - 0x078a: Using it to initialize manual-mode fan-curve - for (i = 0; i < 5; ++i) { - uniwill_read_ec_ram(0x0786 + i, &data); - uniwill_write_ec_ram(0x0743 + i, data); - } - } - else { - // Activate NVIDIA Dynamic Boost - uniwill_write_ec_ram(0x0746, 0x19); - uniwill_write_ec_ram(0x0745, 0x23); - uniwill_write_ec_ram(0x0743, 0x03); - } - - // Enable manual mode - uniwill_write_ec_ram(0x0741, 0x01); - - // Zero second fan temp for detection - uniwill_write_ec_ram(0x044f, 0x00); - - status = register_keyboard_notifier(&keyboard_notifier_block); - - uw_kbd_bl_init(dev); - - status = uw_lightbar_init(dev); - uw_lightbar_loaded = (status >= 0); - - uw_charging_priority_init(dev); - uw_charging_profile_init(dev); - - return 0; -} - -static int uniwill_keyboard_remove(struct platform_device *dev) -{ - if (uw_charging_prio_loaded) - sysfs_remove_group(&dev->dev.kobj, &uw_charging_prio_attr_group); - - if (uw_charging_profile_loaded) - sysfs_remove_group(&dev->dev.kobj, &uw_charging_profile_attr_group); - - uniwill_leds_remove(dev); - - // Restore previous backlight enable state - if (uniwill_kbd_bl_enable_state_on_start != 0xff) { - uniwill_write_kbd_bl_enable(uniwill_kbd_bl_enable_state_on_start); - } - - unregister_keyboard_notifier(&keyboard_notifier_block); - - del_timer(&uw_kbd_bl_init_timer); - - if (uw_lightbar_loaded) - uw_lightbar_remove(dev); - - // Disable manual mode - uniwill_write_ec_ram(0x0741, 0x00); - - return 0; -} - -static int uniwill_keyboard_suspend(struct platform_device *dev, pm_message_t state) -{ - uniwill_write_kbd_bl_enable(0); - return 0; -} - -static int uniwill_keyboard_resume(struct platform_device *dev) -{ - uniwill_leds_restore_state_extern(); - uniwill_write_kbd_bl_enable(1); - return 0; -} - -static struct platform_driver platform_driver_uniwill = { - .remove = uniwill_keyboard_remove, - .suspend = uniwill_keyboard_suspend, - .resume = uniwill_keyboard_resume, - .driver = - { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -struct tuxedo_keyboard_driver uniwill_keyboard_driver = { - .platform_driver = &platform_driver_uniwill, - .probe = uniwill_keyboard_probe, - .key_map = uniwill_wmi_keymap, -}; - -#endif // UNIWILL_KEYBOARD_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_leds.h clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_leds.h --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_leds.h 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_leds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,331 +0,0 @@ -/*! - * Copyright (c) 2018-2020 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ - -#ifndef UNIWILL_LEDS_H -#define UNIWILL_LEDS_H - -#include -#include -#include -#include - -enum uniwill_kb_backlight_types { - UNIWILL_KB_BACKLIGHT_TYPE_NONE, - UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR, - UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB, - UNIWILL_KB_BACKLIGHT_TYPE_PER_KEY_RGB -}; - -#define UNIWILL_KBD_BRIGHTNESS_MAX 0xff -#define UNIWILL_KBD_BRIGHTNESS_DEFAULT 0x00 - -#define UNIWILL_KBD_BRIGHTNESS_WHITE_MAX 0x02 -#define UNIWILL_KBD_BRIGHTNESS_WHITE_DEFAULT 0x00 - -#define UNIWILL_KB_COLOR_DEFAULT_RED 0xff -#define UNIWILL_KB_COLOR_DEFAULT_GREEN 0xff -#define UNIWILL_KB_COLOR_DEFAULT_BLUE 0xff -#define UNIWILL_KB_COLOR_DEFAULT ((UNIWILL_KB_COLOR_DEFAULT_RED << 16) + (UNIWILL_KB_COLOR_DEFAULT_GREEN << 8) + UNIWILL_KB_COLOR_DEFAULT_BLUE) - -int uniwill_leds_init_early(struct platform_device *dev); -int uniwill_leds_init_late(struct platform_device *dev); -int uniwill_leds_remove(struct platform_device *dev); -enum uniwill_kb_backlight_types uniwill_leds_get_backlight_type(void); -void uniwill_leds_restore_state_extern(void); -void uniwill_leds_set_brightness_extern(enum led_brightness brightness); -void uniwill_leds_set_color_extern(u32 color); - -// TODO The following should go into a seperate .c file, but for this to work more reworking is required in the tuxedo_keyboard structure. - -#include "uniwill_leds.h" - -#include "uniwill_interfaces.h" - -#include - -static enum uniwill_kb_backlight_types uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_NONE; -static bool uw_leds_initialized = false; - -static int uniwill_write_kbd_bl_white(u8 brightness) -{ - u8 data; - - uniwill_read_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, &data); - // When keyboard backlight is off, new settings to 0x078c do not get applied automatically - // on Pulse Gen1/2 until next keypress or manual change to 0x1808 (immediate brightness - // value for some reason. - // Sidenote: IBP Gen6/7 has immediate brightness value on 0x1802 and not on 0x1808, but does - // not need this workaround. - if (!data && brightness) { - uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, 0x01); - } - - data = 0; - uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); - data &= 0x0f; // lower bits must be preserved - data |= UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET; - data |= brightness << 5; - return uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, data); -} - -static int uniwill_write_kbd_bl_rgb(u8 red, u8 green, u8 blue) -{ - int result = 0; - - result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS, red); - if (result) { - return result; - } - result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS, green); - if (result) { - return result; - } - result = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS, blue); - if (result) { - return result; - } - - pr_debug("Wrote kbd color [%0#4x, %0#4x, %0#4x]\n", red, green, blue); - - return result; -} - -static void uniwill_leds_set_brightness(struct led_classdev *led_cdev __always_unused, enum led_brightness brightness) { - int ret = uniwill_write_kbd_bl_white(brightness); - if (ret) { - pr_debug("uniwill_leds_set_brightness(): uniwill_write_kbd_bl_white() failed\n"); - return; - } - led_cdev->brightness = brightness; -} - -static void uniwill_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { - int ret; - struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); - - led_mc_calc_color_components(mcled_cdev, brightness); - - ret = uniwill_write_kbd_bl_rgb(mcled_cdev->subled_info[0].brightness, - mcled_cdev->subled_info[1].brightness, - mcled_cdev->subled_info[2].brightness); - if (ret) { - pr_debug("uniwill_leds_set_brightness_mc(): uniwill_write_kbd_bl_rgb() failed\n"); - return; - } - led_cdev->brightness = brightness; -} - -static struct led_classdev uniwill_led_cdev = { - .name = "white:" LED_FUNCTION_KBD_BACKLIGHT, - .max_brightness = UNIWILL_KBD_BRIGHTNESS_WHITE_MAX, - .brightness_set = &uniwill_leds_set_brightness, - .brightness = UNIWILL_KBD_BRIGHTNESS_WHITE_DEFAULT -}; - -static struct mc_subled uw_mcled_cdev_subleds[3] = { - { - .color_index = LED_COLOR_ID_RED, - .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, - .intensity = UNIWILL_KB_COLOR_DEFAULT_RED, - .channel = 0 - }, - { - .color_index = LED_COLOR_ID_GREEN, - .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, - .intensity = UNIWILL_KB_COLOR_DEFAULT_GREEN, - .channel = 0 - }, - { - .color_index = LED_COLOR_ID_BLUE, - .brightness = UNIWILL_KBD_BRIGHTNESS_MAX, - .intensity = UNIWILL_KB_COLOR_DEFAULT_BLUE, - .channel = 0 - } -}; - -static struct led_classdev_mc uniwill_mcled_cdev = { - .led_cdev.name = "rgb:" LED_FUNCTION_KBD_BACKLIGHT, - .led_cdev.max_brightness = UNIWILL_KBD_BRIGHTNESS_MAX, - .led_cdev.brightness_set = &uniwill_leds_set_brightness_mc, - .led_cdev.brightness = UNIWILL_KBD_BRIGHTNESS_DEFAULT, - .num_colors = 3, - .subled_info = uw_mcled_cdev_subleds -}; - -int uniwill_leds_init_early(struct platform_device *dev) -{ - // FIXME Use mutexes - int ret; - u8 data; - - ret = uniwill_read_ec_ram(UW_EC_REG_BAREBONE_ID, &data); - if (ret) { - pr_err("Reading barebone ID failed.\n"); - return ret; - } - pr_debug("EC Barebone ID: %#04x\n", data); - - if (data == UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx || - data == UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TRX1 || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TUX1 || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx) { - ret = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); - if (ret) { - pr_err("Reading keyboard backlight status failed.\n"); - return ret; - } - if (data & UW_EC_REG_KBD_BL_STATUS_BIT_WHITE_ONLY_KB) { - uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR; - } - } - else { - ret = uniwill_read_ec_ram(UW_EC_REG_FEATURES_1, &data); - if (ret) { - pr_err("Reading features 1 failed.\n"); - return ret; - } - if (data & UW_EC_REG_FEATURES_1_BIT_1_ZONE_RGB_KB) { - uniwill_kb_backlight_type = UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB; - } - } - pr_debug("Keyboard backlight type: 0x%02x\n", uniwill_kb_backlight_type); - - if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - pr_debug("Registering fixed color leds interface\n"); - ret = led_classdev_register(&dev->dev, &uniwill_led_cdev); - if (ret) { - pr_err("Registering fixed color leds interface failed\n"); - return ret; - } - } - else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - pr_debug("Registering single zone rgb leds interface\n"); - ret = devm_led_classdev_multicolor_register(&dev->dev, &uniwill_mcled_cdev); - if (ret) { - pr_err("Registering single zone rgb leds interface failed\n"); - return ret; - } - } - - uw_leds_initialized = true; - return 0; -} -EXPORT_SYMBOL(uniwill_leds_init_early); - -int uniwill_leds_init_late(struct platform_device *dev) -{ - // FIXME Use mutexes - int ret; - - ret = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_MAX_BRIGHTNESS, 0xff); - if (ret) { - pr_err("Setting max keyboard brightness value failed\n"); - uniwill_leds_remove(dev); - return ret; - } - - uniwill_leds_restore_state_extern(); - - return 0; -} -EXPORT_SYMBOL(uniwill_leds_init_late); - -int uniwill_leds_remove(struct platform_device *dev) -{ - // FIXME Use mutexes - int ret = 0; - - if (uw_leds_initialized) { - uw_leds_initialized = false; - - uniwill_leds_set_brightness_extern(0x00); - ret = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_MAX_BRIGHTNESS, 0xc8); - if (ret) { - pr_err("Resetting max keyboard brightness value failed\n"); - } - - if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - led_classdev_unregister(&uniwill_led_cdev); - } - else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - devm_led_classdev_multicolor_unregister(&dev->dev, &uniwill_mcled_cdev); - } - } - - return ret; -} -EXPORT_SYMBOL(uniwill_leds_remove); - -enum uniwill_kb_backlight_types uniwill_leds_get_backlight_type(void) { - return uniwill_kb_backlight_type; -} -EXPORT_SYMBOL(uniwill_leds_get_backlight_type); - -void uniwill_leds_restore_state_extern(void) { - u8 data; - - if (uw_leds_initialized) { - if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - uniwill_led_cdev.brightness_set(&uniwill_led_cdev, uniwill_led_cdev.brightness); - } - else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - // reset - uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); - data |= UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET; - uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, data); - - // write - uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, uniwill_mcled_cdev.led_cdev.brightness); - } - } -} -EXPORT_SYMBOL(uniwill_leds_restore_state_extern); - -void uniwill_leds_set_brightness_extern(enum led_brightness brightness) { - if (uw_leds_initialized) { - if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - uniwill_led_cdev.brightness_set(&uniwill_led_cdev, brightness); - } - else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, brightness); - } - } -} -EXPORT_SYMBOL(uniwill_leds_set_brightness_extern); - -void uniwill_leds_set_color_extern(u32 color) { - if (uw_leds_initialized) { - if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { - uniwill_mcled_cdev.subled_info[0].intensity = (color >> 16) & 0xff; - uniwill_mcled_cdev.subled_info[1].intensity = (color >> 8) & 0xff; - uniwill_mcled_cdev.subled_info[2].intensity = color & 0xff; - uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, uniwill_mcled_cdev.led_cdev.brightness); - } - } -} -EXPORT_SYMBOL(uniwill_leds_set_color_extern); - -MODULE_LICENSE("GPL"); - -#endif // UNIWILL_LEDS_H diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_wmi.c clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_wmi.c --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src/uniwill_wmi.c 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src/uniwill_wmi.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,397 +0,0 @@ -/*! - * Copyright (c) 2021 TUXEDO Computers GmbH - * - * This file is part of tuxedo-keyboard. - * - * tuxedo-keyboard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software. If not, see . - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include -#include -#include -#include -#include -#include "uniwill_interfaces.h" - -#define UNIWILL_EC_REG_LDAT 0x8a -#define UNIWILL_EC_REG_HDAT 0x8b -#define UNIWILL_EC_REG_FLAGS 0x8c -#define UNIWILL_EC_REG_CMDL 0x8d -#define UNIWILL_EC_REG_CMDH 0x8e - -#define UNIWILL_EC_BIT_RFLG 0 -#define UNIWILL_EC_BIT_WFLG 1 -#define UNIWILL_EC_BIT_BFLG 2 -#define UNIWILL_EC_BIT_CFLG 3 -#define UNIWILL_EC_BIT_DRDY 7 - -#define UW_EC_BUSY_WAIT_CYCLES 30 -#define UW_EC_BUSY_WAIT_DELAY 15 - -static bool uniwill_ec_direct = true; - -DEFINE_MUTEX(uniwill_ec_lock); - -static int uw_wmi_ec_evaluate(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, u8 read_flag, u32 *return_buffer) -{ - acpi_status status; - union acpi_object *out_acpi; - int e_result = 0; - - // Kernel buffer for input argument - u32 *wmi_arg = (u32 *) kmalloc(sizeof(u32)*10, GFP_KERNEL); - // Byte reference to the input buffer - u8 *wmi_arg_bytes = (u8 *) wmi_arg; - - u8 wmi_instance = 0x00; - u32 wmi_method_id = 0x04; - struct acpi_buffer wmi_in = { (acpi_size) sizeof(wmi_arg), wmi_arg}; - struct acpi_buffer wmi_out = { ACPI_ALLOCATE_BUFFER, NULL }; - - mutex_lock(&uniwill_ec_lock); - - // Zero input buffer - memset(wmi_arg, 0x00, 10 * sizeof(u32)); - - // Configure the input buffer - wmi_arg_bytes[0] = addr_low; - wmi_arg_bytes[1] = addr_high; - wmi_arg_bytes[2] = data_low; - wmi_arg_bytes[3] = data_high; - - if (read_flag != 0) { - wmi_arg_bytes[5] = 0x01; - } - - status = wmi_evaluate_method(UNIWILL_WMI_MGMT_GUID_BC, wmi_instance, wmi_method_id, &wmi_in, &wmi_out); - out_acpi = (union acpi_object *) wmi_out.pointer; - - if (out_acpi && out_acpi->type == ACPI_TYPE_BUFFER) { - memcpy(return_buffer, out_acpi->buffer.pointer, out_acpi->buffer.length); - } /* else if (out_acpi && out_acpi->type == ACPI_TYPE_INTEGER) { - e_result = (u32) out_acpi->integer.value; - }*/ - if (ACPI_FAILURE(status)) { - pr_err("uniwill_wmi.h: Error evaluating method\n"); - e_result = -EIO; - } - - kfree(out_acpi); - kfree(wmi_arg); - - mutex_unlock(&uniwill_ec_lock); - - return e_result; -} - -/** - * EC address read through WMI - */ -static int uw_ec_read_addr_wmi(u8 addr_low, u8 addr_high, union uw_ec_read_return *output) -{ - u32 uw_data[10]; - int ret = uw_wmi_ec_evaluate(addr_low, addr_high, 0x00, 0x00, 1, uw_data); - output->dword = uw_data[0]; - // pr_debug("addr: 0x%02x%02x value: %0#4x (high: %0#4x) result: %d\n", addr_high, addr_low, output->bytes.data_low, output->bytes.data_high, ret); - return ret; -} - -/** - * EC address write through WMI - */ -static int uw_ec_write_addr_wmi(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, union uw_ec_write_return *output) -{ - u32 uw_data[10]; - int ret = uw_wmi_ec_evaluate(addr_low, addr_high, data_low, data_high, 0, uw_data); - output->dword = uw_data[0]; - return ret; -} - -/** - * Direct EC address read - */ -static int uw_ec_read_addr_direct(u8 addr_low, u8 addr_high, union uw_ec_read_return *output) -{ - int result; - int count; - u8 tmp, flags; - bool ready; - bool bflag = false; - - mutex_lock(&uniwill_ec_lock); - - ec_read(UNIWILL_EC_REG_FLAGS, &flags); - if ((flags & (1 << UNIWILL_EC_BIT_BFLG)) > 0) { - pr_debug("read: BFLG set\n"); - bflag = true; - } - - flags |= (1 << UNIWILL_EC_BIT_BFLG); - ec_write(UNIWILL_EC_REG_FLAGS, flags); - - ec_write(UNIWILL_EC_REG_LDAT, addr_low); - ec_write(UNIWILL_EC_REG_HDAT, addr_high); - - flags &= ~(1 << UNIWILL_EC_BIT_DRDY); - flags |= (1 << UNIWILL_EC_BIT_RFLG); - ec_write(UNIWILL_EC_REG_FLAGS, flags); - - // Wait for ready flag - count = UW_EC_BUSY_WAIT_CYCLES; - ready = false; - while (!ready && count != 0) { - msleep(UW_EC_BUSY_WAIT_DELAY); - ec_read(UNIWILL_EC_REG_FLAGS, &tmp); - ready = (tmp & (1 << UNIWILL_EC_BIT_DRDY)) != 0; - count -= 1; - } - - if (count != 0) { - output->dword = 0; - ec_read(UNIWILL_EC_REG_CMDL, &tmp); - output->bytes.data_low = tmp; - ec_read(UNIWILL_EC_REG_CMDH, &tmp); - output->bytes.data_high = tmp; - result = 0; - } else { - pr_err("uw ec read timeout, addr: 0x%02x%02x\n", addr_high, addr_low); - output->dword = 0xfefefefe; - result = -EIO; - } - - ec_write(UNIWILL_EC_REG_FLAGS, 0x00); - - mutex_unlock(&uniwill_ec_lock); - - if (bflag) - pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, output->bytes.data_low, result); - - if ((UW_EC_BUSY_WAIT_CYCLES - count) > 1) - pr_debug("read wait count: %i", (UW_EC_BUSY_WAIT_CYCLES - count)); - - // pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, output->bytes.data_low, result); - - return result; -} - -static int uw_ec_write_addr_direct(u8 addr_low, u8 addr_high, u8 data_low, u8 data_high, union uw_ec_write_return *output) -{ - int result = 0; - int count; - u8 tmp, flags; - bool ready; - bool bflag = false; - - mutex_lock(&uniwill_ec_lock); - - ec_read(UNIWILL_EC_REG_FLAGS, &flags); - if ((flags & (1 << UNIWILL_EC_BIT_BFLG)) > 0) { - pr_debug("write: BFLG set\n"); - bflag = true; - } - - flags |= (1 << UNIWILL_EC_BIT_BFLG); - ec_write(UNIWILL_EC_REG_FLAGS, flags); - - ec_write(UNIWILL_EC_REG_LDAT, addr_low); - ec_write(UNIWILL_EC_REG_HDAT, addr_high); - ec_write(UNIWILL_EC_REG_CMDL, data_low); - ec_write(UNIWILL_EC_REG_CMDH, data_high); - - flags &= ~(1 << UNIWILL_EC_BIT_DRDY); - flags |= (1 << UNIWILL_EC_BIT_WFLG); - ec_write(UNIWILL_EC_REG_FLAGS, flags); - - // Wait for ready flag - count = UW_EC_BUSY_WAIT_CYCLES; - ready = false; - while (!ready && count != 0) { - msleep(UW_EC_BUSY_WAIT_DELAY); - ec_read(UNIWILL_EC_REG_FLAGS, &tmp); - ready = (tmp & (1 << UNIWILL_EC_BIT_DRDY)) != 0; - count -= 1; - } - - // Replicate wmi output depending on success - if (count != 0) { - output->bytes.addr_low = addr_low; - output->bytes.addr_high = addr_high; - output->bytes.data_low = data_low; - output->bytes.data_high = data_high; - result = 0; - } else { - pr_err("uw ec write timeout, addr: 0x%02x%02x, value: %0#4x\n", addr_high, addr_low, data_low); - output->dword = 0xfefefefe; - result = -EIO; - } - - ec_write(UNIWILL_EC_REG_FLAGS, 0x00); - - if (bflag) - pr_debug("addr: 0x%02x%02x value: %0#4x result: %d\n", addr_high, addr_low, data_low, result); - - if ((UW_EC_BUSY_WAIT_CYCLES - count) > 1) - pr_debug("write wait count: %i", (UW_EC_BUSY_WAIT_CYCLES - count)); - - mutex_unlock(&uniwill_ec_lock); - - return result; -} - -int uw_wmi_read_ec_ram(u16 addr, u8 *data) -{ - int result; - u8 addr_low, addr_high; - union uw_ec_read_return output; - - if (IS_ERR_OR_NULL(data)) - return -EINVAL; - - addr_low = addr & 0xff; - addr_high = (addr >> 8) & 0xff; - - if (uniwill_ec_direct) { - result = uw_ec_read_addr_direct(addr_low, addr_high, &output); - } else { - result = uw_ec_read_addr_wmi(addr_low, addr_high, &output); - } - - *data = output.bytes.data_low; - return result; -} - -int uw_wmi_write_ec_ram(u16 addr, u8 data) -{ - int result; - u8 addr_low, addr_high, data_low, data_high; - union uw_ec_write_return output; - - addr_low = addr & 0xff; - addr_high = (addr >> 8) & 0xff; - data_low = data; - data_high = 0x00; - - if (uniwill_ec_direct) - result = uw_ec_write_addr_direct(addr_low, addr_high, data_low, data_high, &output); - else - result = uw_ec_write_addr_wmi(addr_low, addr_high, data_low, data_high, &output); - - return result; -} - -struct uniwill_interface_t uniwill_wmi_interface = { - .string_id = UNIWILL_INTERFACE_WMI_STRID, - .read_ec_ram = uw_wmi_read_ec_ram, - .write_ec_ram = uw_wmi_write_ec_ram -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) -static int uniwill_wmi_probe(struct wmi_device *wdev) -#else -static int uniwill_wmi_probe(struct wmi_device *wdev, const void *dummy_context) -#endif -{ - int status; - - // Look for for GUIDs used on uniwill devices - status = - wmi_has_guid(UNIWILL_WMI_EVENT_GUID_0) && - wmi_has_guid(UNIWILL_WMI_EVENT_GUID_1) && - wmi_has_guid(UNIWILL_WMI_EVENT_GUID_2) && - wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BA) && - wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BB) && - wmi_has_guid(UNIWILL_WMI_MGMT_GUID_BC); - - if (!status) { - pr_debug("probe: At least one Uniwill GUID missing\n"); - return -ENODEV; - } - - uniwill_add_interface(&uniwill_wmi_interface); - - pr_info("interface initialized\n"); - - return 0; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) -static int uniwill_wmi_remove(struct wmi_device *wdev) -#else -static void uniwill_wmi_remove(struct wmi_device *wdev) -#endif -{ - pr_debug("uniwill_wmi driver remove\n"); - uniwill_remove_interface(&uniwill_wmi_interface); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) - return 0; -#endif -} - -static void uniwill_wmi_notify(struct wmi_device *wdev, union acpi_object *obj) -{ - u32 code; - - if (!IS_ERR_OR_NULL(uniwill_wmi_interface.event_callb)) { - if (obj) { - if (obj->type == ACPI_TYPE_INTEGER) { - code = obj->integer.value; - // Execute registered callback - uniwill_wmi_interface.event_callb(code); - } else { - pr_debug("unknown event type - %d (%0#6x)\n", obj->type, obj->type); - } - } else { - pr_debug("expected ACPI object doesn't exist\n"); - } - } else { - pr_debug("no registered callback\n"); - } -} - -static const struct wmi_device_id uniwill_wmi_device_ids[] = { - // Listing one should be enough, for a driver that "takes care of all anyways" - // also prevents probe (and handling) per "device" - { .guid_string = UNIWILL_WMI_EVENT_GUID_2 }, - { } -}; - -static struct wmi_driver uniwill_wmi_driver = { - .driver = { - .name = UNIWILL_INTERFACE_WMI_STRID, - .owner = THIS_MODULE - }, - .id_table = uniwill_wmi_device_ids, - .probe = uniwill_wmi_probe, - .remove = uniwill_wmi_remove, - .notify = uniwill_wmi_notify, -}; - -module_wmi_driver(uniwill_wmi_driver); - -MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_DESCRIPTION("Driver for Uniwill WMI interface"); -MODULE_VERSION("0.0.4"); -MODULE_LICENSE("GPL"); - -/* - * If set to true, the module will use the replicated WMI functions - * (direct ec_read/ec_write) to read and write to the EC RAM instead - * of the original. Since the original functions, in all observed cases, - * use excessive delays, they are not preferred. - */ -module_param_cb(ec_direct_io, ¶m_ops_bool, &uniwill_ec_direct, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); -MODULE_PARM_DESC(ec_direct_io, "Do not use WMI methods to read/write EC RAM (default: true)."); - -MODULE_DEVICE_TABLE(wmi, uniwill_wmi_device_ids); -MODULE_ALIAS_UNIWILL_WMI(); diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src_pkg/dkms_postinst clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src_pkg/dkms_postinst --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src_pkg/dkms_postinst 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src_pkg/dkms_postinst 1970-01-01 00:00:00.000000000 +0000 @@ -1,291 +0,0 @@ -#!/bin/sh -# Copyright (C) 2002-2005 Flavio Stanchina -# Copyright (C) 2005-2006 Aric Cyr -# Copyright (C) 2007 Mario Limonciello -# Copyright (C) 2009 Alberto Milone - -set -e - -uname_s=$(uname -s) - -_get_kernel_dir() { - KVER=$1 - case ${uname_s} in - Linux) DIR="/lib/modules/$KVER/build" ;; - GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;; - esac - echo $DIR -} - -_check_kernel_dir() { - DIR=$(_get_kernel_dir $1) - case ${uname_s} in - Linux) test -e $DIR/include ;; - GNU/kFreeBSD) test -e $DIR/kern && test -e $DIR/conf/kmod.mk ;; - *) return 1 ;; - esac - return $? -} - -# Check the existence of a kernel named as $1 -_is_kernel_name_correct() { - CORRECT="no" - KERNEL_NAME=$1 - - for kernel in /boot/config-*; do - KERNEL=${kernel#*-} - if [ "${KERNEL}" = "${KERNEL_NAME}" ]; then - CORRECT="yes" - break - fi - done - - echo $CORRECT -} - - -# Get the most recent kernel on Debian based systems. This keeps -# into account both the version and the ABI. If the current kernel -# is the most recent kernel then the function will print a null string. -_get_newest_kernel_debian() { - NEWEST_KERNEL= - NEWEST_VERSION= - NEWEST_ABI= - - for kernel in /boot/config-*; do - KERNEL=${kernel#*-} - KERNEL_VERSION=${KERNEL%%-*} - ABI=${KERNEL#*-} - ABI=${ABI%%-*} - - if [ -z "$NEWEST_KERNEL" ]; then - # The 1st time get a version which is bigger than $1 - COMPARE_TO=$1 - else - # Get the biggest version - COMPARE_TO="$NEWEST_VERSION-$NEWEST_ABI" - fi - - # if $kernel is greater than $COMPARE_TO - if [ `dpkg --compare-versions "$KERNEL_VERSION-$ABI" gt "$COMPARE_TO" && echo "yes" || \ - echo "no"` = "yes" ]; then - NEWEST_KERNEL=$KERNEL - NEWEST_VERSION=$KERNEL_VERSION - NEWEST_ABI=$ABI - fi - done - - echo "$NEWEST_KERNEL" -} - -# Get the most recent kernel in Rhel based systems. If the current kernel -# is the most recent kernel then the function will print a null string. -_get_newest_kernel_rhel() { - NEWEST_KERNEL= - - LAST_INSTALLED_KERNEL=$(rpm -q --whatprovides kernel --last | grep kernel -m1 | cut -f1 -d' ') - - LIK_FORMATTED_NAME=$(rpm -q $LAST_INSTALLED_KERNEL --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}\n") - - if [ `echo $LIK_FORMATTED_NAME | grep 2.6 >/dev/null` ]; then - # Fedora and Suse - NEWEST_KERNEL=$LIK_FORMATTED_NAME - else - # Hack for Mandriva where $LIK_FORMATTED_NAME is broken - LIK_NAME=$(rpm -q $LAST_INSTALLED_KERNEL --queryformat="%{NAME}\n") - LIK_TYPE=${LIK_NAME#kernel-} - LIK_TYPE=${LIK_TYPE%%-*} - LIK_STRIPPED=${LIK_NAME#kernel-} - LIK_STRIPPED=${LIK_STRIPPED#$LIK_TYPE-} - LIK_STRIPPED_BASE=${LIK_STRIPPED%%-*} - LIK_STRIPPED_END=${LIK_STRIPPED#$LIK_STRIPPED_BASE-} - LIK_FINAL=$LIK_STRIPPED_BASE-$LIK_TYPE-$LIK_STRIPPED_END - - NEWEST_KERNEL=$LIK_FINAL - fi - - echo $NEWEST_KERNEL -} - -# Get the newest kernel on Debian and Rhel based systems. -get_newest_kernel() { - NEWEST_KERNEL= - # Try Debian first as rpm can be installed in Debian based distros - if [ -e /usr/bin/dpkg ]; then - # If DEB based - CURRENT_KERNEL=$1 - CURRENT_VERSION=${CURRENT_KERNEL%%-*} - CURRENT_ABI=${CURRENT_KERNEL#*-} - CURRENT_FLAVOUR=${CURRENT_ABI#*-} - CURRENT_ABI=${CURRENT_ABI%%-*} - NEWEST_KERNEL=$(_get_newest_kernel_debian "$CURRENT_VERSION-$CURRENT_ABI") - - elif [ `which rpm >/dev/null` ]; then - # If RPM based - NEWEST_KERNEL=$(_get_newest_kernel_rhel) - fi - - # Make sure that kernel name that we extracted corresponds to an installed - # kernel - if [ -n "$NEWEST_KERNEL" ] && [ `_is_kernel_name_correct $NEWEST_KERNEL` = "no" ]; then - NEWEST_KERNEL= - fi - - echo $NEWEST_KERNEL -} - -NAME=$1 -VERSION=$2 -TARBALL_ROOT=$3 -ARCH=$4 -UPGRADE=$5 - -if [ -z "$NAME" ] || [ -z "$VERSION" ]; then - echo "Need NAME, and VERSION defined" - echo "ARCH is optional" - exit 1 -fi - -# read framework configuration options -if [ -r /etc/dkms/framework.conf ]; then - . /etc/dkms/framework.conf -fi - -KERNELS=$(ls /lib/modules/ 2>/dev/null || true) -CURRENT_KERNEL=$(uname -r) - -#We never want to keep an older version side by side to prevent conflicts -if [ -e "/var/lib/dkms/$NAME/$VERSION" ]; then - echo "Removing old $NAME-$VERSION DKMS files..." - dkms remove -m $NAME -v $VERSION --all -fi - -#Load new files, by source package and by tarball -if [ -f "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz" ]; then - if ! dkms ldtarball --archive "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz"; then - echo "" - echo "" - echo "Unable to load DKMS tarball $TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz." - echo "Common causes include: " - echo " - You must be using DKMS 2.1.0.0 or later to support binaries only" - echo " distribution specific archives." - echo " - Corrupt distribution specific archive" - echo "" - echo "" - exit 2 - fi -elif [ -d "/usr/src/$NAME-$VERSION" ]; then - echo "Loading new $NAME-$VERSION DKMS files..." - dkms add -m $NAME -v $VERSION > /dev/null -fi - -# On 1st installation, let us look for a directory -# in /lib/modules which matches `uname -r`. If none -# is found it is possible that buildd is being used -# and that uname -r is giving us the name of the -# kernel used by the buildd machine. -# -# If this is the case we try to build the kernel -# module for each kernel which has a directory in -# /lib/modules. Furthermore we will have to tell -# DKMS which architecture it should build the module -# for (e.g. if the buildd machine is using a -# 2.6.24-23-xen 64bit kernel). -# -# NOTE: if the headers are not installed then the -# module won't be built, as usual - -# Here we look for the most recent kernel so that we can -# build the module for it (in addition to doing it for the -# current kernel. -NEWEST_KERNEL=$(get_newest_kernel "$KERNELS") - -if [ -z "$autoinstall_all_kernels" ]; then - # If the current kernel is installed on the system or chroot - if [ `_is_kernel_name_correct $CURRENT_KERNEL` = "yes" ]; then - if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then - KERNELS="$CURRENT_KERNEL $NEWEST_KERNEL" - else - KERNELS=$CURRENT_KERNEL - fi - # The current kernel is not useful as it's not installed - else - echo "It is likely that $CURRENT_KERNEL belongs to a chroot's host" - - # Let's use only the newest kernel if this is not a first installation - # otherwise build for all kernels - if [ -n "$NEWEST_KERNEL" -a -n "$UPGRADE" ]; then - KERNELS="$NEWEST_KERNEL" - fi - fi -fi - -# Take care of displaying newline separated list -echo "Building for $KERNELS" | tr '\n' ',' \ - | sed -e 's/,/, /g; s/, $/\n/; s/, \([^,]\+\)$/ and \1/' - -if [ -n "$ARCH" ]; then - if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then - case $ARCH in - amd64) - ARCH="x86_64" - ;; - lpia|i?86) - ARCH="i686" - ;; - esac - fi - echo "Building for architecture $ARCH" - ARCH="-a $ARCH" -fi - -for KERNEL in $KERNELS; do - dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH` - if [ `echo $KERNEL | grep -c "BOOT"` -gt 0 ]; then - echo "" - echo "Module build and install for $KERNEL was skipped as " - echo "it is a BOOT variant" - continue - fi - - - #if the module isn't yet built, try to build it - if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then - if [ ! -L /var/lib/dkms/$NAME/$VERSION/source ]; then - echo "This package appears to be a binaries-only package" - echo " you will not be able to build against kernel $KERNEL" - echo " since the package source was not provided" - continue - fi - if _check_kernel_dir $KERNEL; then - echo "Building initial module for $KERNEL" - set +e - dkms build -m $NAME -v $VERSION -k $KERNEL $ARCH > /dev/null - case $? in - 9) - set -e - echo "Skipped." - continue - ;; - 0) - set -e - echo "Done." - ;; - *) - exit $? - ;; - esac - dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH` - else - echo "Module build for kernel $KERNEL was skipped since the" - echo "kernel headers for this kernel does not seem to be installed." - fi - fi - - #if the module is built (either pre-built or just now), install it - if [ `echo $dkms_status | grep -c ": built"` -eq 1 ] && - [ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then - dkms install -m $NAME -v $VERSION -k $KERNEL $ARCH - fi -done - diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src_pkg/rpm_pkg.spec clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src_pkg/rpm_pkg.spec --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/src_pkg/rpm_pkg.spec 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/src_pkg/rpm_pkg.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,250 +0,0 @@ -%define module module-name - -# -# spec file for package tuxedo-keyboard -# -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. -# -# All modifications and additions to the file contributed by third parties -# remain the property of their copyright owners, unless otherwise agreed -# upon. The license for this file, and modifications and additions to the -# file, is the same license as for the pristine package itself (unless the -# license for the pristine package is not an Open Source License, in which -# case the license is the MIT License). An "Open Source License" is a -# license that conforms to the Open Source Definition (Version 1.9) -# published by the Open Source Initiative. - -# Please submit bugfixes or comments via http://bugs.opensuse.org/ -# - - -Summary: Kernel module for TUXEDO keyboards -Name: %{module} -Version: x.x.x -Release: x -License: GPLv3+ -Group: Hardware/Other -BuildArch: noarch -Url: https://www.tuxedocomputers.com -Source: %{module}-%{version}.tar.bz2 -Provides: tuxedo_keyboard = %{version}-%{release} -Obsoletes: tuxedo_keyboard < %{version}-%{release} -Obsoletes: tuxedo-xp-xc-touchpad-key-fix -Obsoletes: tuxedo-touchpad-fix <= 1.0.1 -Obsoletes: tuxedo-cc-wmi -Requires: dkms >= 1.95 -BuildRoot: %{_tmppath} -Packager: TUXEDO Computers GmbH - -%description -Keyboard & keyboard backlight driver for TUXEDO notebooks -meant for DKMS framework. - -%prep -%setup -n %{module}-%{version} -q - -%install -rm -rf %{buildroot} -mkdir -p %{buildroot}/usr/src/%{module}-%{version}/ -cp dkms.conf Makefile %{buildroot}/usr/src/%{module}-%{version} -cp -R src/ %{buildroot}/usr/src/%{module}-%{version} -mkdir -p %{buildroot}/usr/share/ -mkdir -p %{buildroot}/usr/share/%{module}/ -cp postinst %{buildroot}/usr/share/%{module} -cp tuxedo_keyboard.conf %{buildroot}/usr/share/%{module} - -%clean -rm -rf %{buildroot} - -%files -%defattr(0644,root,root,0755) -%attr(0755,root,root) /usr/src/%{module}-%{version}/ -%attr(0644,root,root) /usr/src/%{module}-%{version}/* -%attr(0755,root,root) /usr/src/%{module}-%{version}/src/ -%attr(0644,root,root) /usr/src/%{module}-%{version}/src/* -%attr(0755,root,root) /usr/src/%{module}-%{version}/src/tuxedo_io/ -%attr(0644,root,root) /usr/src/%{module}-%{version}/src/tuxedo_io/* -%attr(0755,root,root) /usr/share/%{module}/ -%attr(0755,root,root) /usr/share/%{module}/postinst -%attr(0644,root,root) /usr/share/%{module}/tuxedo_keyboard.conf -%license LICENSE - -%post -for POSTINST in /usr/lib/dkms/common.postinst /usr/share/%{module}/postinst; do - if [ -f $POSTINST ]; then - $POSTINST %{module} %{version} /usr/share/%{module} - RET=$? - - # Attempt to (re-)load module immediately, fail silently if not possible at this stage - - # Also stop tccd service if running before - echo "Check tccd running status" - if systemctl is-active --quiet tccd.service; then - TCCD_RUNNING=true - else - TCCD_RUNNING=false - fi - - if $TCCD_RUNNING; then - echo "Stop tccd temporarily" - systemctl stop tccd 2>&1 || true - fi - - % Explicitly unload old tuxedo_cc_wmi if loaded at this point - rmmod tuxedo_cc_wmi > /dev/null 2>&1 || true - - echo "(Re)load modules if possible" - - rmmod tuxedo_io > /dev/null 2>&1 || true - rmmod uniwill_wmi > /dev/null 2>&1 || true - rmmod clevo_wmi > /dev/null 2>&1 || true - rmmod clevo_acpi > /dev/null 2>&1 || true - rmmod tuxedo_keyboard > /dev/null 2>&1 || true - - modprobe tuxedo_keyboard > /dev/null 2>&1 || true - modprobe uniwill_wmi > /dev/null 2>&1 || true - modprobe clevo_wmi > /dev/null 2>&1 || true - modprobe clevo_acpi > /dev/null 2>&1 || true - modprobe tuxedo_io > /dev/null 2>&1 || true - - # Install default config if none exist already - if [ ! -f "/etc/modprobe.d/tuxedo_keyboard.conf" ]; then - cp -f /usr/share/tuxedo-keyboard/tuxedo_keyboard.conf /etc/modprobe.d/tuxedo_keyboard.conf - fi - - # Restart tccd after reload if it was running - if $TCCD_RUNNING; then - echo "Start tccd again" - systemctl start tccd 2>&1 || true - fi - - exit $RET - fi - echo "WARNING: $POSTINST does not exist." -done - -echo -e "ERROR: DKMS version is too old and %{module} was not" -echo -e "built with legacy DKMS support." -echo -e "You must either rebuild %{module} with legacy postinst" -echo -e "support or upgrade DKMS to a more current version." -exit 1 - - -%preun -echo -e -echo -e "Uninstall of %{module} module (version %{version}-%{release}) beginning:" -dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade -if [ $1 != 1 ];then - /usr/sbin/rmmod %{module} > /dev/null 2>&1 || true - rm -f /etc/modprobe.d/tuxedo_keyboard.conf || true -fi -exit 0 - - -%changelog -* Mon May 19 2023 C Sandberg 3.2.5-1 -- IBP Gen8 keyboard backlight support -- IBP Gen8 TDP support -- Color scaling for certain one-zone RGB keyboards -- Fix for certain white kbd bl devices (like Pulse) not setting brightness - to zero on init -* Thu Apr 20 2023 C Sandberg 3.2.3-1 -- Fix missing state write on resume for some devices which woke up with "default blue" keyboard backlight -- Add TDP device definitions for Stellaris Intel Gen5 -- Add device check on newer cpu gens -* Mon Mar 27 2023 C Sandberg 3.2.1-1 -- Fix "lost fan control" in some circumstances (on eg. IBPGen7) -* Wed Mar 22 2023 C Sandberg 3.2.0-1 -- KBD BL: Interface rewrite, now generally exported through /sys/class/leds :kbd_backlight -- KBD BL: New interface impl. for white backlight keyboards (also :kbd_backlight) -- Note: Old interface is hereby deprecated (and removed) -* Fri Feb 17 2023 C Sandberg 3.1.4-1 -- Fix upcoming 6.2 kernel build issue (from github Buddy-Matt) -- Re-write last set charging priority on barrel plug connect -- UW interface performance tweaks (should help with lagging keyboard issues on certain devices) -* Wed Jan 11 2023 C Sandberg 3.1.3-1 -- Fix IBP14Gen6 second fan not spinning (alternative fan ctl approach) -- Fix some error-lookalike messages in kernel log (aka prevent uw feature - id when interface not available) -* Mon Dec 19 2022 C Sandberg 3.1.2-1 -- Enables dynamic boost (max offset) for certain devices needing sw ctl -- Adds charging profile interface for devices supporting charging profiles -- Adds charging priority interface for devices supporting USB-C PD charging - priority setting -* Mon Oct 17 2022 C Sandberg 3.1.1-1 -- Reenable fans-off for some devices that got it turned of as a temporary workaround -- Fix default fan curve not being reenabled when tccd is stopped -* Mon Oct 10 2022 C Sandberg 3.1.0-1 -- Add power profiles and tdp functionality (uw) -* Thu Oct 06 2022 C Sandberg 3.0.11-1 -- Introduce alternative fan control (uw) -- Fan control parameters from driver "has fan off" and "min fan speed" -- Fixes missing/broken fan control on newer devices -* Thu Apr 28 2022 C Sandberg 3.0.10-1 -- Add Stellaris Intel gen 4 lightbar support -- Default lightbar to off -* Mon Oct 10 2021 C Sandberg 3.0.9-1 -- Add IBS15v6 & IBS17v6 new module name to perf. prof workaround -- Interface modularization (uw) -- Fix Pulse14/15 gen 1 keyboard backlight ctrl dissapearing -* Fri Jul 9 2021 C Sandberg 3.0.8-1 -- Add IBS14v6 to perf. prof workaround -* Thu Jun 24 2021 C Sandberg 3.0.7-1 -- Add new Polaris devices gen 2 & gen 3 keyb bl support -- Add Stellaris (gen3) lightbar support -- Fix kernel 5.13 build issue (from github BlackIkeEagle) -- Add another Fusion lightbar ID (from github ArlindoFNeto) -* Mon Jun 07 2021 C Sandberg 3.0.6-1 -- Add tuxedo-io performance profile set (cl) -* Fri Apr 23 2021 C Sandberg 3.0.5-1 -- Add NS50MU to perf. profile workaround -- Add EDUBOOK1502 to perf. profile workaround -- Add XP gen 11 & 12 to perf. profile workaround -- Clean-up cl driver state init (should fix some init color issues) -* Fri Mar 19 2021 C Sandberg 3.0.4-1 -- Fixed various possible race conditions on driver init -- Added IBS14v5 to perf. profile workaround -- Added new Aura board name to perf. profile workaround -- Fixed non-initialized firmware fan curve for silent mode (UW) -- Changed default perf. profile to balanced (UW) -* Fri Mar 5 2021 C Sandberg 3.0.3-1 -- Added XP14 to perf. profile workaround -* Fri Jan 29 2021 C Sandberg 3.0.2-1 -- Fixed clevo keyboard init order -- Added Aura perf. profile workaround -* Mon Dec 21 2020 C Sandberg 3.0.1-1 -- Added device support (Trinity) -- Fixed uw fan ramp up issues to some extent (workaround) -* Wed Dec 9 2020 C Sandberg 3.0.0-1 -- Changed structure of clevo interfaces -- Added separate clevo-wmi module with existing functionality -- Added clevo-acpi module with implementation of the "new" clevo ACPI interface -- Added tuxedo-io module (former tuxedo-cc-wmi) into package -* Fri Nov 13 2020 C Sandberg 2.1.0-1 -- Added device support (XMG Fusion) -- Added uniwill lightbar driver (with led_classdev interface) -- Added uniwill keymapping brightness up/down -- Fixed uniwill touchpad toggle (some platforms) -- Fixed module cleanup crash -* Fri Sep 25 2020 C Sandberg 2.0.6-1 -- Added uw kbd color backlight support -* Thu Jun 18 2020 C Sandberg 2.0.5-1 -- Restructure to allow for more devices -- Added device support -- Added rudimentary device detection -* Tue May 26 2020 C Sandberg 2.0.4-1 -- Added rfkill key event -- Fix volume button events, ignore -* Tue May 19 2020 C Sandberg 2.0.3-1 -- General key event mapping support -- Events added for backlight and touchpad -- Fix not removing module on rpm update -* Tue Apr 14 2020 C Sandberg 2.0.2-0 -- Mark old named packages as conflicting and obsolete -- Fix not restoring state on resume -- Fix autoload issues -- Add standard config tuxedo_keyboard.conf to package -* Tue Mar 17 2020 C Sandberg 2.0.1-0 -- New packaging -* Wed Dec 18 2019 Richard Sailer 2.0.0-1 -- Initial DKMS package for back-lit keyboard 2nd generation diff -Nru clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control --- clevo-keyboard-0.4.2/clevo-keyboard/3.2.5/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control 2023-05-24 22:18:53.000000000 +0000 +++ clevo-keyboard-0.4.4/clevo-keyboard/3.2.5/trans_pkg_from_dkms/deb/tuxedo-keyboard-dkms/DEBIAN/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Package: tuxedo-keyboard-dkms -Version: 2.0.1 -Section: oldlibs -Priority: optional -Depends: tuxedo-keyboard -Maintainer: TUXEDO Computers GmbH -Homepage: https://www.tuxedocomputers.com -Architecture: all -Description: Transitional package: tuxedo-keyboard-dkms -> tuxedo-keyboard - This is a transitional package, effectively renaming the package. diff -Nru clevo-keyboard-0.4.2/debian/changelog clevo-keyboard-0.4.4/debian/changelog --- clevo-keyboard-0.4.2/debian/changelog 2023-07-05 08:01:52.000000000 +0000 +++ clevo-keyboard-0.4.4/debian/changelog 2023-10-07 08:01:52.000000000 +0000 @@ -1,5 +1,5 @@ -clevo-keyboard (0.4.2-7) jammy; urgency=low +clevo-keyboard (0.4.4-1) jammy; urgency=low - * Upgraded to version 3.2.6 + * Upgraded to version 3.2.11 - -- Juno Wed, 5 Jul 2023 08:01:52 +0000 + -- Juno Sat, 7 Oct 2023 08:01:52 +0000 diff -Nru clevo-keyboard-0.4.2/debian/postinst clevo-keyboard-0.4.4/debian/postinst --- clevo-keyboard-0.4.2/debian/postinst 2023-07-05 08:01:52.000000000 +0000 +++ clevo-keyboard-0.4.4/debian/postinst 2023-10-07 06:06:56.000000000 +0000 @@ -1,32 +1,13 @@ #!/bin/bash product_model="$(sed -e 's/^\s*//g' -e 's/\s*$//g' "/sys/devices/virtual/dmi/id/product_name" | tr ' ,/-' '_')" -chassis="$(hostnamectl | awk 'FNR==3 {print $2}')" if [ -d /usr/share/clevo-keyboard ]; then cd /usr/share/clevo-keyboard; - case "$product_model" in - *) - cd 3.2.6; - make clean; - make dkmsinstall - modprobe clevo_acpi - modprobe clevo_wmi - modprobe clevo_keyboard - ;; -esac + cd 3.2.11; + make clean; + make dkmsinstall; + modprobe clevo_acpi; + modprobe clevo_wmi; + modprobe clevo_keyboard fi - - -#Add clevo-keyboard group -#if [ $(getent group clevo-keyboard) ]; then -# echo "clevo-keyboard group exists. Skipping." -#else -# echo "clevo-keyboard group does not exist. Adding it."; -# groupadd clevo-keyboard; -#fi - -#Add all users to clevo-keyboard group -#for ID in $(members sudo | cut -d ':' -f1); \ -#do (adduser $ID clevo-keyboard);done - diff -Nru clevo-keyboard-0.4.2/debian/preinst clevo-keyboard-0.4.4/debian/preinst --- clevo-keyboard-0.4.2/debian/preinst 2023-07-05 08:01:52.000000000 +0000 +++ clevo-keyboard-0.4.4/debian/preinst 2023-10-07 06:07:27.000000000 +0000 @@ -1,8 +1,5 @@ #!/bin/sh -#module=clevo-keyboard -#version="$(ls -l /var/lib/dkms/clevo-keyboard | grep ^d | awk '{print $9}')" - if [ -f /etc/modprobe.d/clevo_keyboard.conf ]; then rm /etc/modprobe.d/clevo_keyboard.conf; fi @@ -12,26 +9,4 @@ rmmod clevo_acpi > /dev/null 2>&1 || true rmmod clevo_keyboard > /dev/null 2>&1 || true - -#set -e - -#case "$1" in -# remove|upgrade|deconfigure) -# if [ "dkms status -m $module" ]; then -# dkms remove -m $module -v $version --all -# # Attempt to remove module, fail silently if module is already unloaded -# rmmod -s $module > /dev/null 2>&1 || true -# rm -R /usr/src/$module-* -# fi -# ;; -# -# failed-upgrade) -# ;; -# -# *) -# echo "prerm called with unknown argument \`$1'" >&2 -# exit 1 -# ;; -#esac - exit 0