Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
f212ad5e
Commit
f212ad5e
authored
May 31, 2012
by
Samuel Ortiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFC: Set the NFC device RF mode appropriately
Signed-off-by:
Samuel Ortiz
<
sameo@linux.intel.com
>
parent
fc40a8c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
include/linux/nfc.h
include/linux/nfc.h
+1
-0
include/net/nfc/nfc.h
include/net/nfc/nfc.h
+1
-1
net/nfc/core.c
net/nfc/core.c
+10
-4
No files found.
include/linux/nfc.h
View file @
f212ad5e
...
...
@@ -146,6 +146,7 @@ enum nfc_attrs {
/* NFC RF modes */
#define NFC_RF_INITIATOR 0
#define NFC_RF_TARGET 1
#define NFC_RF_NONE 2
/* NFC protocols masks used in bitsets */
#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
...
...
include/net/nfc/nfc.h
View file @
f212ad5e
...
...
@@ -100,10 +100,10 @@ struct nfc_dev {
int
targets_generation
;
struct
device
dev
;
bool
dev_up
;
u8
rf_mode
;
bool
polling
;
struct
nfc_target
*
active_target
;
bool
dep_link_up
;
u32
dep_rf_mode
;
struct
nfc_genl_data
genl_data
;
u32
supported_protocols
;
...
...
net/nfc/core.c
View file @
f212ad5e
...
...
@@ -144,8 +144,10 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols)
}
rc
=
dev
->
ops
->
start_poll
(
dev
,
im_protocols
,
tm_protocols
);
if
(
!
rc
)
if
(
!
rc
)
{
dev
->
polling
=
true
;
dev
->
rf_mode
=
NFC_RF_NONE
;
}
error:
device_unlock
(
&
dev
->
dev
);
...
...
@@ -235,8 +237,10 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode)
}
rc
=
dev
->
ops
->
dep_link_up
(
dev
,
target
,
comm_mode
,
gb
,
gb_len
);
if
(
!
rc
)
if
(
!
rc
)
{
dev
->
active_target
=
target
;
dev
->
rf_mode
=
NFC_RF_INITIATOR
;
}
error:
device_unlock
(
&
dev
->
dev
);
...
...
@@ -264,7 +268,7 @@ int nfc_dep_link_down(struct nfc_dev *dev)
goto
error
;
}
if
(
dev
->
dep_
rf_mode
==
NFC_RF_TARGET
)
{
if
(
dev
->
rf_mode
==
NFC_RF_TARGET
)
{
rc
=
-
EOPNOTSUPP
;
goto
error
;
}
...
...
@@ -286,7 +290,6 @@ int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
u8
comm_mode
,
u8
rf_mode
)
{
dev
->
dep_link_up
=
true
;
dev
->
dep_rf_mode
=
rf_mode
;
nfc_llcp_mac_is_up
(
dev
,
target_idx
,
comm_mode
,
rf_mode
);
...
...
@@ -330,6 +333,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
rc
=
dev
->
ops
->
activate_target
(
dev
,
target
,
protocol
);
if
(
!
rc
)
{
dev
->
active_target
=
target
;
dev
->
rf_mode
=
NFC_RF_INITIATOR
;
if
(
dev
->
ops
->
check_presence
)
mod_timer
(
&
dev
->
check_pres_timer
,
jiffies
+
...
...
@@ -470,6 +474,8 @@ int nfc_tm_activated(struct nfc_dev *dev, u32 protocol, u8 comm_mode,
goto
out
;
}
dev
->
rf_mode
=
NFC_RF_TARGET
;
if
(
protocol
==
NFC_PROTO_NFC_DEP_MASK
)
nfc_dep_link_is_up
(
dev
,
0
,
comm_mode
,
NFC_RF_TARGET
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment