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
Kirill Smelkov
linux
Commits
6f83ab76
Commit
6f83ab76
authored
Aug 30, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: es1-ap-usb: more init framework added.
parent
f1eec30a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
drivers/staging/greybus/es1-ap-usb.c
drivers/staging/greybus/es1-ap-usb.c
+41
-4
No files found.
drivers/staging/greybus/es1-ap-usb.c
View file @
6f83ab76
...
@@ -18,19 +18,31 @@ static const struct usb_device_id id_table[] = {
...
@@ -18,19 +18,31 @@ static const struct usb_device_id id_table[] = {
};
};
MODULE_DEVICE_TABLE
(
usb
,
id_table
);
MODULE_DEVICE_TABLE
(
usb
,
id_table
);
struct
es1_ap_dev
{
struct
usb_device
*
usb_dev
;
struct
usb_interface
*
usb_intf
;
__u8
ap_in_endpoint
;
__u8
ap_out_endpoint
;
u8
*
ap_buffer
;
};
/*
/*
* Hack, we "know" we will only have one of these at any one time, so only
* Hack, we "know" we will only have one of these at any one time, so only
* create one static structure pointer.
* create one static structure pointer.
*/
*/
struct
es1_ap_dev
{
static
struct
es1_ap_dev
*
es1_ap_dev
;
struct
usb_interface
*
usb_intf
;
}
*
es1_ap_dev
;
static
int
ap_probe
(
struct
usb_interface
*
interface
,
static
int
ap_probe
(
struct
usb_interface
*
interface
,
const
struct
usb_device_id
*
id
)
const
struct
usb_device_id
*
id
)
{
{
struct
usb_host_interface
*
iface_desc
;
struct
usb_endpoint_descriptor
*
endpoint
;
size_t
buffer_size
;
int
i
;
if
(
es1_ap_dev
)
{
if
(
es1_ap_dev
)
{
dev_err
(
&
interface
->
dev
,
"Already have a es1_ap_dev???
\n
"
);
dev_err
(
&
interface
->
dev
,
"Already have a es1_ap_dev???
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -39,7 +51,30 @@ static int ap_probe(struct usb_interface *interface,
...
@@ -39,7 +51,30 @@ static int ap_probe(struct usb_interface *interface,
if
(
!
es1_ap_dev
)
if
(
!
es1_ap_dev
)
return
-
ENOMEM
;
return
-
ENOMEM
;
// FIXME
// figure out endpoint for talking to the AP.
iface_desc
=
interface
->
cur_altsetting
;
for
(
i
=
0
;
i
<
iface_desc
->
desc
.
bNumEndpoints
;
++
i
)
{
endpoint
=
&
iface_desc
->
endpoint
[
i
].
desc
;
if
(
usb_endpoint_is_bulk_in
(
endpoint
))
{
buffer_size
=
usb_endpoint_maxp
(
endpoint
);
// FIXME - Save buffer_size?
es1_ap_dev
->
ap_in_endpoint
=
endpoint
->
bEndpointAddress
;
}
if
(
usb_endpoint_is_bulk_out
(
endpoint
))
{
// FIXME - anything else about this we need?
es1_ap_dev
->
ap_out_endpoint
=
endpoint
->
bEndpointAddress
;
}
// FIXME - properly exit once found the AP endpoint
// FIXME - set up cport endpoints
}
// FIXME - allocate buffer
// FIXME = start up talking, then create the gb "devices" based on what the AP tells us.
es1_ap_dev
->
usb_intf
=
interface
;
es1_ap_dev
->
usb_intf
=
interface
;
es1_ap_dev
->
usb_dev
=
usb_get_dev
(
interface_to_usbdev
(
interface
));
usb_set_intfdata
(
interface
,
es1_ap_dev
);
usb_set_intfdata
(
interface
,
es1_ap_dev
);
return
0
;
return
0
;
}
}
...
@@ -50,6 +85,8 @@ static void ap_disconnect(struct usb_interface *interface)
...
@@ -50,6 +85,8 @@ static void ap_disconnect(struct usb_interface *interface)
/* Tear down everything! */
/* Tear down everything! */
usb_put_dev
(
es1_ap_dev
->
usb_dev
);
kfree
(
es1_ap_dev
->
ap_buffer
);
kfree
(
es1_ap_dev
);
kfree
(
es1_ap_dev
);
es1_ap_dev
=
NULL
;
es1_ap_dev
=
NULL
;
...
...
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