structure and first prototype link successful
This commit is contained in:
805
.clang-format
Normal file
805
.clang-format
Normal file
@@ -0,0 +1,805 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# clang-format configuration file. Intended for clang-format >= 11.
|
||||
#
|
||||
# For more information, see:
|
||||
#
|
||||
# Documentation/dev-tools/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
|
||||
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
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
|
||||
# Taken from:
|
||||
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \
|
||||
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
|
||||
# | LC_ALL=C sort -u
|
||||
ForEachMacros:
|
||||
- '__ata_qc_for_each'
|
||||
- '__bio_for_each_bvec'
|
||||
- '__bio_for_each_segment'
|
||||
- '__evlist__for_each_entry'
|
||||
- '__evlist__for_each_entry_continue'
|
||||
- '__evlist__for_each_entry_from'
|
||||
- '__evlist__for_each_entry_reverse'
|
||||
- '__evlist__for_each_entry_safe'
|
||||
- '__for_each_mem_range'
|
||||
- '__for_each_mem_range_rev'
|
||||
- '__for_each_thread'
|
||||
- '__hlist_for_each_rcu'
|
||||
- '__map__for_each_symbol_by_name'
|
||||
- '__pci_bus_for_each_res0'
|
||||
- '__pci_bus_for_each_res1'
|
||||
- '__pci_dev_for_each_res0'
|
||||
- '__pci_dev_for_each_res1'
|
||||
- '__perf_evlist__for_each_entry'
|
||||
- '__perf_evlist__for_each_entry_reverse'
|
||||
- '__perf_evlist__for_each_entry_safe'
|
||||
- '__rq_for_each_bio'
|
||||
- '__shost_for_each_device'
|
||||
- '__sym_for_each'
|
||||
- '_for_each_counter'
|
||||
- 'apei_estatus_for_each_section'
|
||||
- 'ata_for_each_dev'
|
||||
- 'ata_for_each_link'
|
||||
- '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_all'
|
||||
- 'bio_for_each_folio_all'
|
||||
- 'bio_for_each_integrity_vec'
|
||||
- 'bio_for_each_segment'
|
||||
- 'bio_for_each_segment_all'
|
||||
- 'bio_list_for_each'
|
||||
- 'bip_for_each_vec'
|
||||
- 'bond_for_each_slave'
|
||||
- 'bond_for_each_slave_rcu'
|
||||
- 'bpf_for_each'
|
||||
- 'bpf_for_each_reg_in_vstate'
|
||||
- 'bpf_for_each_reg_in_vstate_mask'
|
||||
- 'bpf_for_each_spilled_reg'
|
||||
- 'bpf_object__for_each_map'
|
||||
- 'bpf_object__for_each_program'
|
||||
- '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'
|
||||
- 'cpu_aggr_map__for_each_idx'
|
||||
- 'cpufreq_for_each_efficient_entry_idx'
|
||||
- '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'
|
||||
- 'damon_for_each_region'
|
||||
- 'damon_for_each_region_from'
|
||||
- 'damon_for_each_region_safe'
|
||||
- 'damon_for_each_scheme'
|
||||
- 'damon_for_each_scheme_safe'
|
||||
- 'damon_for_each_target'
|
||||
- 'damon_for_each_target_safe'
|
||||
- 'damos_for_each_core_filter'
|
||||
- 'damos_for_each_core_filter_safe'
|
||||
- 'damos_for_each_ops_filter'
|
||||
- 'damos_for_each_ops_filter_safe'
|
||||
- 'damos_for_each_quota_goal'
|
||||
- 'damos_for_each_quota_goal_safe'
|
||||
- 'data__for_each_file'
|
||||
- 'data__for_each_file_new'
|
||||
- 'data__for_each_file_start'
|
||||
- 'def_for_each_cpu'
|
||||
- 'device_for_each_child_node'
|
||||
- 'device_for_each_child_node_scoped'
|
||||
- 'dma_fence_array_for_each'
|
||||
- 'dma_fence_chain_for_each'
|
||||
- 'dma_fence_unwrap_for_each'
|
||||
- 'dma_resv_for_each_fence'
|
||||
- 'dma_resv_for_each_fence_unlocked'
|
||||
- 'do_for_each_ftrace_op'
|
||||
- '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_exec_for_each_locked_object'
|
||||
- 'drm_exec_for_each_locked_object_reverse'
|
||||
- 'drm_for_each_bridge_in_chain_scoped'
|
||||
- 'drm_for_each_connector_iter'
|
||||
- 'drm_for_each_crtc'
|
||||
- 'drm_for_each_crtc_reverse'
|
||||
- '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_gem_for_each_gpuvm_bo'
|
||||
- 'drm_gem_for_each_gpuvm_bo_safe'
|
||||
- 'drm_gpusvm_for_each_range'
|
||||
- 'drm_gpuva_for_each_op'
|
||||
- 'drm_gpuva_for_each_op_from_reverse'
|
||||
- 'drm_gpuva_for_each_op_reverse'
|
||||
- 'drm_gpuva_for_each_op_safe'
|
||||
- 'drm_gpuvm_bo_for_each_va'
|
||||
- 'drm_gpuvm_bo_for_each_va_safe'
|
||||
- 'drm_gpuvm_for_each_va'
|
||||
- 'drm_gpuvm_for_each_va_range'
|
||||
- 'drm_gpuvm_for_each_va_range_safe'
|
||||
- 'drm_gpuvm_for_each_va_safe'
|
||||
- 'drm_mm_for_each_hole'
|
||||
- 'drm_mm_for_each_node'
|
||||
- 'drm_mm_for_each_node_in_range'
|
||||
- 'drm_mm_for_each_node_safe'
|
||||
- 'dsa_switch_for_each_available_port'
|
||||
- 'dsa_switch_for_each_cpu_port'
|
||||
- 'dsa_switch_for_each_cpu_port_continue_reverse'
|
||||
- 'dsa_switch_for_each_port'
|
||||
- 'dsa_switch_for_each_port_continue_reverse'
|
||||
- 'dsa_switch_for_each_port_safe'
|
||||
- 'dsa_switch_for_each_user_port'
|
||||
- 'dsa_switch_for_each_user_port_continue_reverse'
|
||||
- 'dsa_tree_for_each_cpu_port'
|
||||
- 'dsa_tree_for_each_user_port'
|
||||
- 'dsa_tree_for_each_user_port_continue_reverse'
|
||||
- 'dso__for_each_symbol'
|
||||
- 'elf_hash_for_each_possible'
|
||||
- 'elf_symtab__for_each_symbol'
|
||||
- 'evlist__for_each_cpu'
|
||||
- 'evlist__for_each_entry'
|
||||
- 'evlist__for_each_entry_continue'
|
||||
- 'evlist__for_each_entry_from'
|
||||
- 'evlist__for_each_entry_reverse'
|
||||
- 'evlist__for_each_entry_safe'
|
||||
- 'flow_action_for_each'
|
||||
- 'for_each_acpi_consumer_dev'
|
||||
- 'for_each_acpi_dev_match'
|
||||
- 'for_each_active_dev_scope'
|
||||
- 'for_each_active_drhd_unit'
|
||||
- 'for_each_active_iommu'
|
||||
- 'for_each_active_irq'
|
||||
- 'for_each_active_route'
|
||||
- 'for_each_aggr_pgid'
|
||||
- 'for_each_alloc_capable_rdt_resource'
|
||||
- 'for_each_and_bit'
|
||||
- 'for_each_andnot_bit'
|
||||
- 'for_each_available_child_of_node'
|
||||
- 'for_each_available_child_of_node_scoped'
|
||||
- 'for_each_bench'
|
||||
- 'for_each_bio'
|
||||
- 'for_each_board_func_rsrc'
|
||||
- 'for_each_btf_ext_rec'
|
||||
- 'for_each_btf_ext_sec'
|
||||
- 'for_each_bvec'
|
||||
- 'for_each_capable_rdt_resource'
|
||||
- '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_child_of_node_scoped'
|
||||
- 'for_each_child_of_node_with_prefix'
|
||||
- 'for_each_clear_bit'
|
||||
- 'for_each_clear_bit_from'
|
||||
- 'for_each_clear_bitrange'
|
||||
- 'for_each_clear_bitrange_from'
|
||||
- 'for_each_cmd'
|
||||
- 'for_each_cmsghdr'
|
||||
- 'for_each_collection'
|
||||
- 'for_each_comp_order'
|
||||
- 'for_each_compatible_node'
|
||||
- 'for_each_component_dais'
|
||||
- 'for_each_component_dais_safe'
|
||||
- 'for_each_conduit'
|
||||
- 'for_each_console'
|
||||
- 'for_each_console_srcu'
|
||||
- 'for_each_cpu'
|
||||
- 'for_each_cpu_and'
|
||||
- 'for_each_cpu_andnot'
|
||||
- 'for_each_cpu_from'
|
||||
- 'for_each_cpu_or'
|
||||
- 'for_each_cpu_wrap'
|
||||
- 'for_each_dapm_widgets'
|
||||
- 'for_each_dedup_cand'
|
||||
- 'for_each_dev_addr'
|
||||
- 'for_each_dev_scope'
|
||||
- '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_enabled_cpu'
|
||||
- 'for_each_endpoint_of_node'
|
||||
- 'for_each_event'
|
||||
- 'for_each_event_tps'
|
||||
- 'for_each_evictable_lru'
|
||||
- 'for_each_fib6_node_rt_rcu'
|
||||
- 'for_each_fib6_walker_rt'
|
||||
- 'for_each_file_lock'
|
||||
- 'for_each_free_mem_range'
|
||||
- 'for_each_free_mem_range_reverse'
|
||||
- 'for_each_func_rsrc'
|
||||
- 'for_each_gpiochip_node'
|
||||
- 'for_each_group_evsel'
|
||||
- 'for_each_group_evsel_head'
|
||||
- 'for_each_group_member'
|
||||
- 'for_each_group_member_head'
|
||||
- 'for_each_hstate'
|
||||
- 'for_each_hwgpio'
|
||||
- 'for_each_hwgpio_in_range'
|
||||
- 'for_each_if'
|
||||
- 'for_each_inject_fn'
|
||||
- 'for_each_insn'
|
||||
- 'for_each_insn_op_loc'
|
||||
- 'for_each_insn_prefix'
|
||||
- 'for_each_intid'
|
||||
- 'for_each_iommu'
|
||||
- 'for_each_ip_tunnel_rcu'
|
||||
- 'for_each_irq_desc'
|
||||
- 'for_each_irq_nr'
|
||||
- 'for_each_lang'
|
||||
- 'for_each_link_ch_maps'
|
||||
- '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_media_entity_data_link'
|
||||
- 'for_each_mem_pfn_range'
|
||||
- 'for_each_mem_range'
|
||||
- 'for_each_mem_range_rev'
|
||||
- 'for_each_mem_region'
|
||||
- 'for_each_member'
|
||||
- 'for_each_memory'
|
||||
- 'for_each_migratetype_order'
|
||||
- 'for_each_missing_reg'
|
||||
- 'for_each_mle_subelement'
|
||||
- 'for_each_mod_mem_type'
|
||||
- 'for_each_mon_capable_rdt_resource'
|
||||
- 'for_each_mp_bvec'
|
||||
- 'for_each_net'
|
||||
- 'for_each_net_continue_reverse'
|
||||
- 'for_each_net_rcu'
|
||||
- 'for_each_netdev'
|
||||
- 'for_each_netdev_continue'
|
||||
- 'for_each_netdev_continue_rcu'
|
||||
- 'for_each_netdev_continue_reverse'
|
||||
- 'for_each_netdev_dump'
|
||||
- 'for_each_netdev_feature'
|
||||
- 'for_each_netdev_in_bond_rcu'
|
||||
- 'for_each_netdev_rcu'
|
||||
- 'for_each_netdev_reverse'
|
||||
- 'for_each_netdev_safe'
|
||||
- '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_plane_in_state_reverse'
|
||||
- 'for_each_new_private_obj_in_state'
|
||||
- 'for_each_new_reg'
|
||||
- 'for_each_nhlt_endpoint'
|
||||
- 'for_each_nhlt_endpoint_fmtcfg'
|
||||
- 'for_each_nhlt_fmtcfg'
|
||||
- 'for_each_node'
|
||||
- 'for_each_node_by_name'
|
||||
- 'for_each_node_by_type'
|
||||
- 'for_each_node_mask'
|
||||
- 'for_each_node_numadist'
|
||||
- 'for_each_node_state'
|
||||
- 'for_each_node_with_cpus'
|
||||
- 'for_each_node_with_property'
|
||||
- 'for_each_nonreserved_multicast_dest_pgid'
|
||||
- 'for_each_numa_hop_mask'
|
||||
- 'for_each_of_allnodes'
|
||||
- 'for_each_of_allnodes_from'
|
||||
- 'for_each_of_cpu_node'
|
||||
- 'for_each_of_graph_port'
|
||||
- 'for_each_of_graph_port_endpoint'
|
||||
- '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_old_plane_in_state'
|
||||
- 'for_each_old_private_obj_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_online_cpu'
|
||||
- 'for_each_online_cpu_wrap'
|
||||
- 'for_each_online_node'
|
||||
- 'for_each_online_pgdat'
|
||||
- 'for_each_or_bit'
|
||||
- 'for_each_page_ext'
|
||||
- 'for_each_path'
|
||||
- 'for_each_pci_bridge'
|
||||
- 'for_each_pci_dev'
|
||||
- 'for_each_pcm_streams'
|
||||
- 'for_each_physmem_range'
|
||||
- 'for_each_populated_zone'
|
||||
- 'for_each_possible_cpu'
|
||||
- 'for_each_possible_cpu_wrap'
|
||||
- 'for_each_present_blessed_reg'
|
||||
- 'for_each_present_cpu'
|
||||
- 'for_each_present_section_nr'
|
||||
- 'for_each_prime_number'
|
||||
- 'for_each_prime_number_from'
|
||||
- 'for_each_probe_cache_entry'
|
||||
- 'for_each_process'
|
||||
- 'for_each_process_thread'
|
||||
- 'for_each_prop_codec_conf'
|
||||
- 'for_each_prop_dai_codec'
|
||||
- 'for_each_prop_dai_cpu'
|
||||
- 'for_each_prop_dlc_codecs'
|
||||
- 'for_each_prop_dlc_cpus'
|
||||
- 'for_each_prop_dlc_platforms'
|
||||
- 'for_each_property_of_node'
|
||||
- 'for_each_pt_level_entry'
|
||||
- 'for_each_rdt_resource'
|
||||
- 'for_each_reg'
|
||||
- 'for_each_reg_filtered'
|
||||
- 'for_each_reloc'
|
||||
- 'for_each_reloc_from'
|
||||
- 'for_each_requested_gpio'
|
||||
- 'for_each_requested_gpio_in_range'
|
||||
- 'for_each_reserved_child_of_node'
|
||||
- 'for_each_reserved_mem_range'
|
||||
- 'for_each_reserved_mem_region'
|
||||
- 'for_each_rtd_ch_maps'
|
||||
- 'for_each_rtd_codec_dais'
|
||||
- 'for_each_rtd_components'
|
||||
- 'for_each_rtd_cpu_dais'
|
||||
- 'for_each_rtd_dais'
|
||||
- 'for_each_rtd_dais_reverse'
|
||||
- 'for_each_sband_iftype_data'
|
||||
- 'for_each_script'
|
||||
- 'for_each_sec'
|
||||
- 'for_each_set_bit'
|
||||
- 'for_each_set_bit_from'
|
||||
- 'for_each_set_bit_wrap'
|
||||
- 'for_each_set_bitrange'
|
||||
- 'for_each_set_bitrange_from'
|
||||
- 'for_each_set_clump8'
|
||||
- 'for_each_sg'
|
||||
- 'for_each_sg_dma_page'
|
||||
- 'for_each_sg_page'
|
||||
- 'for_each_sgtable_dma_page'
|
||||
- 'for_each_sgtable_dma_sg'
|
||||
- 'for_each_sgtable_page'
|
||||
- 'for_each_sgtable_sg'
|
||||
- 'for_each_sibling_event'
|
||||
- 'for_each_sta_active_link'
|
||||
- 'for_each_subelement'
|
||||
- 'for_each_subelement_extid'
|
||||
- 'for_each_subelement_id'
|
||||
- 'for_each_sublist'
|
||||
- 'for_each_subsystem'
|
||||
- 'for_each_suite'
|
||||
- 'for_each_supported_activate_fn'
|
||||
- 'for_each_supported_inject_fn'
|
||||
- 'for_each_sym'
|
||||
- 'for_each_thread'
|
||||
- 'for_each_token'
|
||||
- 'for_each_unicast_dest_pgid'
|
||||
- 'for_each_valid_link'
|
||||
- 'for_each_vif_active_link'
|
||||
- 'for_each_vma'
|
||||
- 'for_each_vma_range'
|
||||
- 'for_each_vsi'
|
||||
- 'for_each_wakeup_source'
|
||||
- 'for_each_zone'
|
||||
- 'for_each_zone_zonelist'
|
||||
- 'for_each_zone_zonelist_nodemask'
|
||||
- 'func_for_each_insn'
|
||||
- 'fwnode_for_each_available_child_node'
|
||||
- 'fwnode_for_each_child_node'
|
||||
- 'fwnode_for_each_parent_node'
|
||||
- 'fwnode_graph_for_each_endpoint'
|
||||
- 'gadget_for_each_ep'
|
||||
- 'genradix_for_each'
|
||||
- 'genradix_for_each_from'
|
||||
- 'genradix_for_each_reverse'
|
||||
- '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'
|
||||
- 'hashmap__for_each_entry'
|
||||
- 'hashmap__for_each_entry_safe'
|
||||
- 'hashmap__for_each_key_entry'
|
||||
- 'hashmap__for_each_key_entry_safe'
|
||||
- 'hctx_for_each_ctx'
|
||||
- 'hists__for_each_format'
|
||||
- 'hists__for_each_sort_list'
|
||||
- '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_entry_srcu'
|
||||
- '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'
|
||||
- 'idr_for_each_entry'
|
||||
- 'idr_for_each_entry_continue'
|
||||
- 'idr_for_each_entry_continue_ul'
|
||||
- 'idr_for_each_entry_ul'
|
||||
- 'iio_for_each_active_channel'
|
||||
- 'in_dev_for_each_ifa_rcu'
|
||||
- 'in_dev_for_each_ifa_rtnl'
|
||||
- 'in_dev_for_each_ifa_rtnl_net'
|
||||
- 'inet_bind_bucket_for_each'
|
||||
- 'interval_tree_for_each_span'
|
||||
- 'intlist__for_each_entry'
|
||||
- 'intlist__for_each_entry_safe'
|
||||
- 'kcore_copy__for_each_phdr'
|
||||
- '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_memslot_in_gfn_range'
|
||||
- 'kvm_for_each_vcpu'
|
||||
- 'libbpf_nla_for_each_attr'
|
||||
- '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_entry_srcu'
|
||||
- 'list_for_each_from'
|
||||
- 'list_for_each_prev'
|
||||
- 'list_for_each_prev_safe'
|
||||
- 'list_for_each_rcu'
|
||||
- 'list_for_each_safe'
|
||||
- 'llist_for_each'
|
||||
- 'llist_for_each_entry'
|
||||
- 'llist_for_each_entry_safe'
|
||||
- 'llist_for_each_safe'
|
||||
- 'lwq_for_each_safe'
|
||||
- 'map__for_each_symbol'
|
||||
- 'map__for_each_symbol_by_name'
|
||||
- 'mas_for_each'
|
||||
- 'mas_for_each_rev'
|
||||
- 'mci_for_each_dimm'
|
||||
- 'media_device_for_each_entity'
|
||||
- 'media_device_for_each_intf'
|
||||
- 'media_device_for_each_link'
|
||||
- 'media_device_for_each_pad'
|
||||
- 'media_entity_for_each_pad'
|
||||
- 'media_pipeline_for_each_entity'
|
||||
- 'media_pipeline_for_each_pad'
|
||||
- 'mlx5_lag_for_each_peer_mdev'
|
||||
- 'mptcp_for_each_subflow'
|
||||
- 'msi_domain_for_each_desc'
|
||||
- 'msi_for_each_desc'
|
||||
- 'mt_for_each'
|
||||
- 'nanddev_io_for_each_block'
|
||||
- 'nanddev_io_for_each_page'
|
||||
- 'neigh_for_each_in_bucket'
|
||||
- 'neigh_for_each_in_bucket_rcu'
|
||||
- 'neigh_for_each_in_bucket_safe'
|
||||
- 'netdev_for_each_lower_dev'
|
||||
- 'netdev_for_each_lower_private'
|
||||
- 'netdev_for_each_lower_private_rcu'
|
||||
- 'netdev_for_each_mc_addr'
|
||||
- 'netdev_for_each_synced_mc_addr'
|
||||
- 'netdev_for_each_synced_uc_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_attr_type'
|
||||
- 'nla_for_each_nested'
|
||||
- 'nla_for_each_nested_type'
|
||||
- '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'
|
||||
- 'pci_dev_for_each_resource'
|
||||
- 'pcl_for_each_chunk'
|
||||
- 'pcl_for_each_segment'
|
||||
- 'pcm_for_each_format'
|
||||
- 'perf_config_items__for_each_entry'
|
||||
- 'perf_config_sections__for_each_entry'
|
||||
- 'perf_config_set__for_each_entry'
|
||||
- 'perf_cpu_map__for_each_cpu'
|
||||
- 'perf_cpu_map__for_each_cpu_skip_any'
|
||||
- 'perf_cpu_map__for_each_idx'
|
||||
- 'perf_evlist__for_each_entry'
|
||||
- 'perf_evlist__for_each_entry_reverse'
|
||||
- 'perf_evlist__for_each_entry_safe'
|
||||
- 'perf_evlist__for_each_evsel'
|
||||
- 'perf_evlist__for_each_mmap'
|
||||
- 'perf_evsel_for_each_per_thread_period_safe'
|
||||
- 'perf_hpp_list__for_each_format'
|
||||
- 'perf_hpp_list__for_each_format_safe'
|
||||
- 'perf_hpp_list__for_each_sort_list'
|
||||
- 'perf_hpp_list__for_each_sort_list_safe'
|
||||
- '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'
|
||||
- 'rb_for_each'
|
||||
- 'rbtree_postorder_for_each_entry_safe'
|
||||
- 'rdma_for_each_block'
|
||||
- 'rdma_for_each_port'
|
||||
- 'rdma_umem_for_each_dma_block'
|
||||
- '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_bvec'
|
||||
- 'rq_for_each_segment'
|
||||
- 'rq_list_for_each'
|
||||
- 'rq_list_for_each_safe'
|
||||
- 'sample_read_group__for_each'
|
||||
- 'scsi_for_each_prot_sg'
|
||||
- 'scsi_for_each_sg'
|
||||
- 'sctp_for_each_hentry'
|
||||
- 'sctp_skb_for_each'
|
||||
- 'sec_for_each_insn'
|
||||
- 'sec_for_each_insn_continue'
|
||||
- 'sec_for_each_insn_from'
|
||||
- 'sec_for_each_sym'
|
||||
- 'shdma_for_each_chan'
|
||||
- 'shost_for_each_device'
|
||||
- 'sk_for_each'
|
||||
- 'sk_for_each_bound'
|
||||
- 'sk_for_each_bound_safe'
|
||||
- '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'
|
||||
- 'sparsebit_for_each_set_range'
|
||||
- 'strlist__for_each_entry'
|
||||
- 'strlist__for_each_entry_safe'
|
||||
- 'sym_for_each_insn'
|
||||
- 'sym_for_each_insn_continue_reverse'
|
||||
- 'symbols__for_each_entry'
|
||||
- 'tb_property_for_each'
|
||||
- 'tcf_act_for_each_action'
|
||||
- 'tcf_exts_for_each_action'
|
||||
- 'test_suite__for_each_test_case'
|
||||
- 'tool_pmu__for_each_event'
|
||||
- 'ttm_bo_lru_for_each_reserved_guarded'
|
||||
- 'ttm_resource_manager_for_each_res'
|
||||
- 'udp_lrpa_for_each_entry_rcu'
|
||||
- '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'
|
||||
- 'vkms_config_for_each_connector'
|
||||
- 'vkms_config_for_each_crtc'
|
||||
- 'vkms_config_for_each_encoder'
|
||||
- 'vkms_config_for_each_plane'
|
||||
- 'vkms_config_connector_for_each_possible_encoder'
|
||||
- 'vkms_config_encoder_for_each_possible_crtc'
|
||||
- 'vkms_config_plane_for_each_possible_crtc'
|
||||
- 'while_for_each_ftrace_op'
|
||||
- 'workloads__for_each'
|
||||
- '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'
|
||||
- 'xbc_node_for_each_subkey'
|
||||
- 'ynl_attr_for_each'
|
||||
- 'ynl_attr_for_each_nested'
|
||||
- 'ynl_attr_for_each_payload'
|
||||
- 'zorro_for_each_dev'
|
||||
- 'zpci_bus_for_each'
|
||||
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
|
||||
# Taken from git's rules
|
||||
PenaltyBreakAssignment: 10
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp03
|
||||
TabWidth: 8
|
||||
UseTab: Always
|
||||
...
|
||||
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
BIN
.module-common.o
Normal file
BIN
.module-common.o
Normal file
Binary file not shown.
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
MODULE_NAME := ch349_driver
|
||||
obj-m := $(MODULE_NAME).o
|
||||
|
||||
SRC_DIR := src
|
||||
BUILD_DIR := build
|
||||
|
||||
KDIR := /lib/modules/$(shell uname -r)/build
|
||||
|
||||
$(MODULE_NAME)-objs := $(SRC_DIR)/ch349_driver.o
|
||||
|
||||
ccflags-y := -std=gnu11 -Wno-declaration-after-statement
|
||||
|
||||
.PHONY: all clean install uninstall
|
||||
|
||||
all:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
$(MAKE) -C $(KDIR) M=$(PWD) modules
|
||||
@mv $(MODULE_NAME).ko $(BUILD_DIR)/ 2>/dev/null || true
|
||||
@rm -f $(MODULE_NAME).o $(MODULE_NAME).mod.o $(MODULE_NAME).mod.c $(MODULE_NAME).mod
|
||||
@rm -f $(SRC_DIR)/*.o $(SRC_DIR)/.*.cmd $(SRC_DIR)/*.mod.c
|
||||
@rm -f modules.order Module.symvers .*.cmd
|
||||
@rm -rf .tmp_versions
|
||||
@echo "Module compiled: $(BUILD_DIR)/$(MODULE_NAME).ko"
|
||||
|
||||
clean:
|
||||
@rm -rf $(BUILD_DIR)
|
||||
@rm -f $(MODULE_NAME).o $(MODULE_NAME).ko $(MODULE_NAME).mod.o $(MODULE_NAME).mod.c $(MODULE_NAME).mod
|
||||
@rm -f $(SRC_DIR)/*.o $(SRC_DIR)/.*.cmd $(SRC_DIR)/*.mod.c
|
||||
@rm -f modules.order Module.symvers .*.cmd *.o *.ko
|
||||
@rm -rf .tmp_versions
|
||||
@echo "Cleaned"
|
||||
|
||||
install: all
|
||||
sudo insmod $(BUILD_DIR)/$(MODULE_NAME).ko
|
||||
@echo "Module loaded"
|
||||
|
||||
uninstall:
|
||||
sudo rmmod $(MODULE_NAME)
|
||||
@echo "Module unloaded"
|
||||
|
||||
# Pour générer compile_commands.json avec bear sans casser le build
|
||||
bear:
|
||||
bear -- $(MAKE) clean all
|
||||
52
README.md
52
README.md
@@ -1,2 +1,50 @@
|
||||
super projet resplendissant
|
||||
https://cdn.promelec.ru/upload/items/2025/09/18/CH397_.pdf
|
||||
# journal de bord
|
||||
|
||||
## super document partage
|
||||
|
||||
etat initial du device :
|
||||
lorsqu'on le branche, lsmod retourne cette ligne :
|
||||
|
||||
```
|
||||
usbnet 61440 1 cdc_ether
|
||||
```
|
||||
|
||||
qui est le driver charge nativement par le kernel.
|
||||
|
||||
il existe un moyen de "blacklist" ce-dit driver :
|
||||
|
||||
creer un fichier :
|
||||
|
||||
```
|
||||
echo "blacklist cdc_ether" | sudo tee /etc/modprobe.d/blacklist.conf
|
||||
```
|
||||
|
||||
puis mettre a jour le initramfs :
|
||||
|
||||
```
|
||||
sudo update-initramfs -u
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
- Enregistrer une interface réseau
|
||||
- Implémenter les opérations réseau
|
||||
- Gérer la réception de trames
|
||||
- Soumettre des URBs (USB Request Blocks) pour lire en continu sur l'endpt. IN
|
||||
- Parser les trames ethernet reçues
|
||||
- Les passer au network stack avec netif_rx(skb)
|
||||
- Gérer l'émission de trames
|
||||
- Récupérer l'adresse MAC
|
||||
- Gérer les contrôles CDC
|
||||
- Link up/down notifications via endpoint interrupt (0x81)
|
||||
- Vitesse de connexion (10/100 Mbps)
|
||||
- Statistiques réseau
|
||||
- Gestion d'énergie et erreurs
|
||||
- Gérer les déconnexions brutales
|
||||
- Suspend/Resume propres
|
||||
- Récupération d'erreurs USB
|
||||
|
||||
## Utile
|
||||
|
||||
<https://cdn.promelec.ru/upload/items/2025/09/18/CH397_.pdf>
|
||||
|
||||
|
||||
BIN
build/ch349_driver.ko
Normal file
BIN
build/ch349_driver.ko
Normal file
Binary file not shown.
307
compile_commands.json
Normal file
307
compile_commands.json
Normal file
@@ -0,0 +1,307 @@
|
||||
[
|
||||
{
|
||||
"file": "src/ch349_driver.c",
|
||||
"arguments": [
|
||||
"gcc",
|
||||
"-Wp,-MMD,src/.ch349_driver.o.d",
|
||||
"-nostdinc",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/generated/uapi",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler-version.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/kconfig.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler_types.h",
|
||||
"-D__KERNEL__",
|
||||
"-std=gnu11",
|
||||
"-fshort-wchar",
|
||||
"-funsigned-char",
|
||||
"-fno-common",
|
||||
"-fno-PIE",
|
||||
"-fno-strict-aliasing",
|
||||
"-mno-sse",
|
||||
"-mno-mmx",
|
||||
"-mno-sse2",
|
||||
"-mno-3dnow",
|
||||
"-mno-avx",
|
||||
"-mno-sse4a",
|
||||
"-fcf-protection=branch",
|
||||
"-fno-jump-tables",
|
||||
"-m64",
|
||||
"-falign-jumps=1",
|
||||
"-falign-loops=1",
|
||||
"-mno-80387",
|
||||
"-mno-fp-ret-in-387",
|
||||
"-mskip-rax-setup",
|
||||
"-march=x86-64",
|
||||
"-mtune=generic",
|
||||
"-mno-red-zone",
|
||||
"-mcmodel=kernel",
|
||||
"-mstack-protector-guard-reg=gs",
|
||||
"-mstack-protector-guard-symbol=__ref_stack_chk_guard",
|
||||
"-Wno-sign-compare",
|
||||
"-fno-asynchronous-unwind-tables",
|
||||
"-mindirect-branch-cs-prefix",
|
||||
"-mfunction-return=thunk-extern",
|
||||
"-fno-jump-tables",
|
||||
"-mharden-sls=all",
|
||||
"-fpatchable-function-entry=16,16",
|
||||
"-fno-delete-null-pointer-checks",
|
||||
"-O2",
|
||||
"-Wno-declaration-after-statement",
|
||||
"-DMODULE",
|
||||
"-DKBUILD_BASENAME=\"ch349_driver\"",
|
||||
"-DKBUILD_MODNAME=\"ch349_driver\"",
|
||||
"-D__KBUILD_MODNAME=kmod_ch349_driver",
|
||||
"-c",
|
||||
"-o",
|
||||
"src/ch349_driver.o",
|
||||
"src/ch349_driver.c"
|
||||
],
|
||||
"directory": "/home/bob/Projects/rj45toUSB_adapter/driver",
|
||||
"output": "src/ch349_driver.o"
|
||||
},
|
||||
{
|
||||
"file": "ch349_driver.mod.c",
|
||||
"arguments": [
|
||||
"gcc",
|
||||
"-Wp,-MMD,./.ch349_driver.mod.o.d",
|
||||
"-nostdinc",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/generated/uapi",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler-version.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/kconfig.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler_types.h",
|
||||
"-D__KERNEL__",
|
||||
"-std=gnu11",
|
||||
"-fshort-wchar",
|
||||
"-funsigned-char",
|
||||
"-fno-common",
|
||||
"-fno-PIE",
|
||||
"-fno-strict-aliasing",
|
||||
"-mno-sse",
|
||||
"-mno-mmx",
|
||||
"-mno-sse2",
|
||||
"-mno-3dnow",
|
||||
"-mno-avx",
|
||||
"-mno-sse4a",
|
||||
"-fcf-protection=branch",
|
||||
"-fno-jump-tables",
|
||||
"-m64",
|
||||
"-falign-jumps=1",
|
||||
"-falign-loops=1",
|
||||
"-mno-80387",
|
||||
"-mno-fp-ret-in-387",
|
||||
"-mskip-rax-setup",
|
||||
"-march=x86-64",
|
||||
"-mtune=generic",
|
||||
"-mno-red-zone",
|
||||
"-mcmodel=kernel",
|
||||
"-mstack-protector-guard-reg=gs",
|
||||
"-mstack-protector-guard-symbol=__ref_stack_chk_guard",
|
||||
"-Wno-sign-compare",
|
||||
"-fno-asynchronous-unwind-tables",
|
||||
"-mindirect-branch-cs-prefix",
|
||||
"-mfunction-return=thunk-extern",
|
||||
"-fno-jump-tables",
|
||||
"-mharden-sls=all",
|
||||
"-fpatchable-function-entry=16,16",
|
||||
"-fno-delete-null-pointer-checks",
|
||||
"-O2",
|
||||
"-fstack-protector-strong",
|
||||
"-fno-builtin-wcslen",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wundef",
|
||||
"-Werror=implicit-function-declaration",
|
||||
"-Werror=implicit-int",
|
||||
"-Werror=return-type",
|
||||
"-Werror=strict-prototypes",
|
||||
"-Wno-format-security",
|
||||
"-Wno-trigraphs",
|
||||
"-Wno-frame-address",
|
||||
"-Wno-address-of-packed-member",
|
||||
"-Wmissing-declarations",
|
||||
"-Wmissing-prototypes",
|
||||
"-Wframe-larger-than=2048",
|
||||
"-Wno-main",
|
||||
"-Wno-dangling-pointer",
|
||||
"-Wvla-larger-than=1",
|
||||
"-Wno-pointer-sign",
|
||||
"-Wcast-function-type",
|
||||
"-Wno-unterminated-string-initialization",
|
||||
"-Wno-array-bounds",
|
||||
"-Wno-stringop-overflow",
|
||||
"-Wno-alloc-size-larger-than",
|
||||
"-Wimplicit-fallthrough=5",
|
||||
"-Werror=date-time",
|
||||
"-Werror=incompatible-pointer-types",
|
||||
"-Werror=designated-init",
|
||||
"-Wenum-conversion",
|
||||
"-Wunused",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-const-variable",
|
||||
"-Wno-packed-not-aligned",
|
||||
"-Wno-format-overflow",
|
||||
"-Wno-format-truncation",
|
||||
"-Wno-stringop-truncation",
|
||||
"-Wno-override-init",
|
||||
"-Wno-missing-field-initializers",
|
||||
"-Wno-type-limits",
|
||||
"-Wno-shift-negative-value",
|
||||
"-Wno-maybe-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-unused-parameter",
|
||||
"-g",
|
||||
"-gdwarf-5",
|
||||
"-DMODULE",
|
||||
"-DKBUILD_BASENAME=\"ch349_driver.mod\"",
|
||||
"-DKBUILD_MODNAME=\"ch349_driver\"",
|
||||
"-D__KBUILD_MODNAME=kmod_ch349_driver",
|
||||
"-c",
|
||||
"-o",
|
||||
"ch349_driver.mod.o",
|
||||
"ch349_driver.mod.c"
|
||||
],
|
||||
"directory": "/home/bob/Projects/rj45toUSB_adapter/driver",
|
||||
"output": "ch349_driver.mod.o"
|
||||
},
|
||||
{
|
||||
"file": "/usr/lib/modules/6.18.7-arch1-1/build/scripts/module-common.c",
|
||||
"arguments": [
|
||||
"gcc",
|
||||
"-Wp,-MMD,./..module-common.o.d",
|
||||
"-nostdinc",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/arch/x86/include/generated/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/uapi",
|
||||
"-I/usr/lib/modules/6.18.7-arch1-1/build/include/generated/uapi",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler-version.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/kconfig.h",
|
||||
"-include",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/include/linux/compiler_types.h",
|
||||
"-D__KERNEL__",
|
||||
"-std=gnu11",
|
||||
"-fshort-wchar",
|
||||
"-funsigned-char",
|
||||
"-fno-common",
|
||||
"-fno-PIE",
|
||||
"-fno-strict-aliasing",
|
||||
"-mno-sse",
|
||||
"-mno-mmx",
|
||||
"-mno-sse2",
|
||||
"-mno-3dnow",
|
||||
"-mno-avx",
|
||||
"-mno-sse4a",
|
||||
"-fcf-protection=branch",
|
||||
"-fno-jump-tables",
|
||||
"-m64",
|
||||
"-falign-jumps=1",
|
||||
"-falign-loops=1",
|
||||
"-mno-80387",
|
||||
"-mno-fp-ret-in-387",
|
||||
"-mskip-rax-setup",
|
||||
"-march=x86-64",
|
||||
"-mtune=generic",
|
||||
"-mno-red-zone",
|
||||
"-mcmodel=kernel",
|
||||
"-mstack-protector-guard-reg=gs",
|
||||
"-mstack-protector-guard-symbol=__ref_stack_chk_guard",
|
||||
"-Wno-sign-compare",
|
||||
"-fno-asynchronous-unwind-tables",
|
||||
"-mindirect-branch-cs-prefix",
|
||||
"-mfunction-return=thunk-extern",
|
||||
"-fno-jump-tables",
|
||||
"-mharden-sls=all",
|
||||
"-fpatchable-function-entry=16,16",
|
||||
"-fno-delete-null-pointer-checks",
|
||||
"-O2",
|
||||
"-fstack-protector-strong",
|
||||
"-ftrivial-auto-var-init=zero",
|
||||
"-fno-stack-clash-protection",
|
||||
"-pg",
|
||||
"-mfentry",
|
||||
"-DCC_USING_FENTRY",
|
||||
"-fstrict-flex-arrays=3",
|
||||
"-fno-strict-overflow",
|
||||
"-fno-stack-check",
|
||||
"-fno-builtin-wcslen",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wundef",
|
||||
"-Werror=implicit-function-declaration",
|
||||
"-Werror=implicit-int",
|
||||
"-Werror=return-type",
|
||||
"-Werror=strict-prototypes",
|
||||
"-Wno-format-security",
|
||||
"-Wno-trigraphs",
|
||||
"-Wno-frame-address",
|
||||
"-Wno-address-of-packed-member",
|
||||
"-Wmissing-declarations",
|
||||
"-Wmissing-prototypes",
|
||||
"-Wframe-larger-than=2048",
|
||||
"-Wno-main",
|
||||
"-Wno-dangling-pointer",
|
||||
"-Wvla-larger-than=1",
|
||||
"-Wno-pointer-sign",
|
||||
"-Wcast-function-type",
|
||||
"-Wno-unterminated-string-initialization",
|
||||
"-Wno-array-bounds",
|
||||
"-Wno-stringop-overflow",
|
||||
"-Wno-alloc-size-larger-than",
|
||||
"-Wimplicit-fallthrough=5",
|
||||
"-Werror=date-time",
|
||||
"-Werror=incompatible-pointer-types",
|
||||
"-Werror=designated-init",
|
||||
"-Wenum-conversion",
|
||||
"-Wunused",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-const-variable",
|
||||
"-Wno-packed-not-aligned",
|
||||
"-Wno-format-overflow",
|
||||
"-Wno-format-truncation",
|
||||
"-Wno-stringop-truncation",
|
||||
"-Wno-override-init",
|
||||
"-Wno-missing-field-initializers",
|
||||
"-Wno-type-limits",
|
||||
"-Wno-shift-negative-value",
|
||||
"-Wno-maybe-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-unused-parameter",
|
||||
"-g",
|
||||
"-gdwarf-5",
|
||||
"-DMODULE",
|
||||
"-DKBUILD_BASENAME=\".module_common\"",
|
||||
"-DKBUILD_MODNAME=\".module_common.o\"",
|
||||
"-D__KBUILD_MODNAME=kmod_.module_common.o",
|
||||
"-c",
|
||||
"-o",
|
||||
".module-common.o",
|
||||
"/usr/lib/modules/6.18.7-arch1-1/build/scripts/module-common.c"
|
||||
],
|
||||
"directory": "/home/bob/Projects/rj45toUSB_adapter/driver",
|
||||
"output": ".module-common.o"
|
||||
}
|
||||
]
|
||||
14
docs/useful_commands.txt
Normal file
14
docs/useful_commands.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
lsmod | grep -i usb -- list loaded drivers with "usb" in the name
|
||||
|
||||
insmod src/driver.ko -- load driver
|
||||
|
||||
rmmod cdc_ether -- deload driver
|
||||
|
||||
dmesg | grep ch349 -- check driver output
|
||||
|
||||
makefile :
|
||||
make -- compile
|
||||
make clean -- clean
|
||||
make install -- build and load driver
|
||||
make uninstall -- deload driver
|
||||
make bear -- use bear to generate compile_commands.json to fix lsp errors
|
||||
@@ -1,7 +0,0 @@
|
||||
obj-m += src/driver.o
|
||||
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* dependencies:
|
||||
*
|
||||
* libusb-dev
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#define CH349_VENDOR_ID 0x1a86
|
||||
#define CH349_PRODUCT_ID 0xe349
|
||||
|
||||
struct ch349_device {
|
||||
struct usb_device *udev;
|
||||
struct usb_interface *interface;
|
||||
struct mutex io_mutex;
|
||||
|
||||
__u8 bulk_in_endpointAddr;
|
||||
__u8 bulk_out_endpointAddr;
|
||||
size_t bulk_in_size;
|
||||
unsigned char *bulk_in_buffer;
|
||||
};
|
||||
|
||||
static const struct usb_device_id ch349_table[] = {
|
||||
{ USB_DEVICE(CH349_VENDOR_ID, CH349_PRODUCT_ID) },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, ch349_table);
|
||||
|
||||
static int ch349_probe(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct ch349_device *dev;
|
||||
struct usb_endpoint_descriptor *endpoint;
|
||||
size_t buffer_size;
|
||||
int i;
|
||||
int retval = -ENOMEM;
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) {
|
||||
dev_err(&interface->dev, "Out of memory\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
mutex_init(&dev->io_mutex);
|
||||
dev->udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
dev->interface = interface;
|
||||
|
||||
for (i = 0; i < interface->cur_altsetting->desc.bNumEndpoints; i++) {
|
||||
endpoint = &interface->cur_altsetting->endpoint[i].desc;
|
||||
|
||||
if (!dev->bulk_in_endpointAddr &&
|
||||
usb_endpoint_is_bulk_in(endpoint)) {
|
||||
buffer_size = usb_endpoint_maxp(endpoint);
|
||||
dev->bulk_in_size = buffer_size;
|
||||
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
|
||||
dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
|
||||
if (!dev->bulk_in_buffer) {
|
||||
dev_err(&interface->dev,
|
||||
"Could not allocate bulk_in_buffer\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev->bulk_out_endpointAddr &&
|
||||
usb_endpoint_is_bulk_out(endpoint)) {
|
||||
dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
|
||||
dev_err(&interface->dev,
|
||||
"Could not find both bulk-in and bulk-out endpoints\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
usb_set_intfdata(interface, dev);
|
||||
|
||||
dev_info(&interface->dev,
|
||||
"CH349 device now attached\n");
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (dev)
|
||||
kfree(dev->bulk_in_buffer);
|
||||
kfree(dev);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void ch349_disconnect(struct usb_interface *interface)
|
||||
{
|
||||
struct ch349_device *dev;
|
||||
|
||||
dev = usb_get_intfdata(interface);
|
||||
usb_set_intfdata(interface, NULL);
|
||||
|
||||
kfree(dev->bulk_in_buffer);
|
||||
usb_put_dev(dev->udev);
|
||||
kfree(dev);
|
||||
|
||||
dev_info(&interface->dev, "CH349 device now disconnected\n");
|
||||
}
|
||||
|
||||
static int ch349_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
{
|
||||
struct ch349_device *dev = usb_get_intfdata(intf);
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&dev->io_mutex);
|
||||
mutex_unlock(&dev->io_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ch349_resume(struct usb_interface *intf)
|
||||
{
|
||||
struct ch349_device *dev = usb_get_intfdata(intf);
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct usb_driver ch349_driver = {
|
||||
.name = "ch349",
|
||||
.probe = ch349_probe,
|
||||
.disconnect = ch349_disconnect,
|
||||
.suspend = ch349_suspend,
|
||||
.resume = ch349_resume,
|
||||
.id_table = ch349_table,
|
||||
.supports_autosuspend = 1,
|
||||
};
|
||||
|
||||
module_usb_driver(ch349_driver);
|
||||
|
||||
MODULE_AUTHOR("Votre Nom");
|
||||
MODULE_DESCRIPTION("Driver USB pour CH349A");
|
||||
MODULE_LICENSE("GPL");
|
||||
176
src/ch349_driver.c
Normal file
176
src/ch349_driver.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* dependencies:
|
||||
*
|
||||
* libusb-dev
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/usb.h>
|
||||
|
||||
#define CH349_VENDOR_ID 0x1a86
|
||||
#define CH349_PRODUCT_ID 0x5397
|
||||
|
||||
struct ch349_device {
|
||||
struct usb_device *udev;
|
||||
struct usb_interface *interface;
|
||||
struct mutex io_mutex;
|
||||
|
||||
__u8 bulk_in_endpointAddr;
|
||||
__u8 bulk_out_endpointAddr;
|
||||
size_t bulk_in_size;
|
||||
unsigned char *bulk_in_buffer;
|
||||
};
|
||||
|
||||
static const struct usb_device_id ch349_table[] = {
|
||||
{ USB_DEVICE_AND_INTERFACE_INFO(CH349_VENDOR_ID, CH349_PRODUCT_ID,
|
||||
USB_CLASS_CDC_DATA, 0, 0) },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, ch349_table);
|
||||
|
||||
static int ch349_probe(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct ch349_device *dev;
|
||||
struct usb_endpoint_descriptor *endpoint;
|
||||
//size_t buffer_size;
|
||||
int i;
|
||||
int retval = -ENOMEM;
|
||||
|
||||
dev_info(&interface->dev, "Probing CH349 device\n");
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) {
|
||||
dev_err(&interface->dev, "Out of memory\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
mutex_init(&dev->io_mutex);
|
||||
dev->udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
dev->interface = interface;
|
||||
|
||||
retval = usb_set_interface(
|
||||
dev->udev, interface->cur_altsetting->desc.bInterfaceNumber, 1);
|
||||
if (retval) {
|
||||
dev_err(&interface->dev, "Cannot set altsetting 1: %d\n",
|
||||
retval);
|
||||
goto error;
|
||||
}
|
||||
|
||||
dev_info(&interface->dev, "Interface obtained\n");
|
||||
|
||||
if (dev->udev->actconfig->desc.bConfigurationValue != 2) {
|
||||
retval = usb_set_configuration(dev->udev, 2);
|
||||
if (retval) {
|
||||
dev_err(&interface->dev,
|
||||
"Cannot set configuration 2\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < interface->cur_altsetting->desc.bNumEndpoints; i++) {
|
||||
endpoint = &interface->cur_altsetting->endpoint[i].desc;
|
||||
|
||||
dev_info(&interface->dev, "Found endpoint 0x%02x\n",
|
||||
endpoint->bEndpointAddress); // Debugging line
|
||||
|
||||
if (!dev->bulk_in_endpointAddr &&
|
||||
usb_endpoint_is_bulk_in(endpoint)) {
|
||||
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
|
||||
dev->bulk_in_size = usb_endpoint_maxp(endpoint);
|
||||
dev->bulk_in_buffer =
|
||||
kmalloc(dev->bulk_in_size, GFP_KERNEL);
|
||||
if (!dev->bulk_in_buffer) {
|
||||
dev_err(&interface->dev,
|
||||
"Could not allocate bulk_in_buffer\n");
|
||||
goto error;
|
||||
}
|
||||
dev_info(&interface->dev,
|
||||
"Bulk IN endpoint found: 0x%02x\n",
|
||||
dev->bulk_in_endpointAddr);
|
||||
}
|
||||
|
||||
if (!dev->bulk_out_endpointAddr &&
|
||||
usb_endpoint_is_bulk_out(endpoint)) {
|
||||
dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
|
||||
dev_info(&interface->dev,
|
||||
"Bulk OUT endpoint found: 0x%02x\n",
|
||||
dev->bulk_out_endpointAddr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
|
||||
dev_err(&interface->dev,
|
||||
"Could not find both bulk-in and bulk-out endpoints\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
usb_set_intfdata(interface, dev);
|
||||
|
||||
dev_info(&interface->dev, "CH349 device now attached\n");
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (dev)
|
||||
kfree(dev->bulk_in_buffer);
|
||||
kfree(dev);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void ch349_disconnect(struct usb_interface *interface)
|
||||
{
|
||||
struct ch349_device *dev;
|
||||
|
||||
dev = usb_get_intfdata(interface);
|
||||
usb_set_intfdata(interface, NULL);
|
||||
|
||||
kfree(dev->bulk_in_buffer);
|
||||
usb_put_dev(dev->udev);
|
||||
kfree(dev);
|
||||
|
||||
dev_info(&interface->dev, "CH349 device now disconnected\n");
|
||||
}
|
||||
|
||||
static int ch349_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
{
|
||||
struct ch349_device *dev = usb_get_intfdata(intf);
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&dev->io_mutex);
|
||||
mutex_unlock(&dev->io_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ch349_resume(struct usb_interface *intf)
|
||||
{
|
||||
struct ch349_device *dev = usb_get_intfdata(intf);
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct usb_driver ch349_driver = {
|
||||
.name = "ch349",
|
||||
.probe = ch349_probe,
|
||||
.disconnect = ch349_disconnect,
|
||||
.suspend = ch349_suspend,
|
||||
.resume = ch349_resume,
|
||||
.id_table = ch349_table,
|
||||
.supports_autosuspend = 1,
|
||||
};
|
||||
|
||||
module_usb_driver(ch349_driver);
|
||||
|
||||
MODULE_AUTHOR("bob industries");
|
||||
MODULE_DESCRIPTION("Driver USB pour CH349A");
|
||||
MODULE_LICENSE("GPL");
|
||||
Reference in New Issue
Block a user