~ubuntu-branches/ubuntu/wily/slof/wily

« back to all changes in this revision

Viewing changes to slof/fs/usb/usb-kbd-device-support.fs

  • Committer: Package Import Robot
  • Author(s): Aurelien Jarno
  • Date: 2012-09-16 23:05:23 UTC
  • Revision ID: package-import@ubuntu.com-20120916230523-r2ynulqmp2tyu2e5
Tags: upstream-20120217+dfsg
ImportĀ upstreamĀ versionĀ 20120217+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\ *****************************************************************************
 
2
\ * Copyright (c) 2004, 2008 IBM Corporation
 
3
\ * All rights reserved.
 
4
\ * This program and the accompanying materials
 
5
\ * are made available under the terms of the BSD License
 
6
\ * which accompanies this distribution, and is available at
 
7
\ * http://www.opensource.org/licenses/bsd-license.php
 
8
\ *
 
9
\ * Contributors:
 
10
\ *     IBM Corporation - initial implementation
 
11
\ ****************************************************************************/
 
12
 
 
13
 
 
14
: rw-endpoint
 
15
  s" rw-endpoint" $call-parent ;
 
16
 
 
17
: controlxfer
 
18
  s" controlxfer" $call-parent ;
 
19
 
 
20
: control-std-get-device-descriptor
 
21
  s" control-std-get-device-descriptor" $call-parent ;
 
22
 
 
23
: control-std-get-configuration-descriptor
 
24
  s" control-std-get-configuration-descriptor" $call-parent ;
 
25
 
 
26
: control-std-set-configuration
 
27
  s" control-std-set-configuration" $call-parent ;
 
28
 
 
29
: control-cls-set-protocol ( reportvalue FuncAddr -- TRUE|FALSE )
 
30
  to temp1
 
31
  to temp2
 
32
  210b000000000100 kbd-buf kb>setup-packet ! 
 
33
  temp2 kbd-buf kb>data l!-le
 
34
  1 kbd-buf kb>data 1 kbd-buf kb>setup-packet
 
35
  DEFAULT-CONTROL-MPS temp1 controlxfer  
 
36
;
 
37
 
 
38
: control-cls-set-idle ( reportvalue FuncAddr -- TRUE|FALSE )
 
39
  to temp1
 
40
  to temp2
 
41
  210a000000000000 kbd-buf kb>setup-packet ! 
 
42
  temp2 kbd-buf kb>data l!-le
 
43
  0 kbd-buf kb>data 0 kbd-buf kb>setup-packet
 
44
  DEFAULT-CONTROL-MPS temp1 controlxfer  
 
45
;
 
46
 
 
47
: control-std-get-report-descriptor ( data-buffer data-len MPS FuncAddr -- TRUE|FALSE )
 
48
  to temp1
 
49
  to temp2
 
50
  to temp3
 
51
  8106002200000000 kbd-buf kb>setup-packet ! 
 
52
  temp3 kbd-buf kb>setup-packet 6 + w!-le
 
53
  0 swap temp3 kbd-buf kb>setup-packet
 
54
  temp2 temp1 controlxfer  
 
55
;
 
56
 
 
57
: kbd-init
 
58
    s" Starting to initialize keyboard" usb-debug-print
 
59
    s" MPS-INTIN" get-my-property
 
60
    if
 
61
        s" not possible" usb-debug-print
 
62
    else
 
63
        decode-int nip nip to mps-int-in
 
64
    then
 
65
    s" INT-IN-EP-ADDR" get-my-property
 
66
    if
 
67
        s" not possible" usb-debug-print
 
68
    else
 
69
        decode-int nip nip to int-in-ep
 
70
    then
 
71
 
 
72
   kbd-buf kb>cfg 12 8 kbd-addr           \ get device descriptor
 
73
   control-std-get-device-descriptor
 
74
   drop
 
75
   \ s" dev_desc=" type cfg-buffer 12 dump cr
 
76
 
 
77
   kbd-buf kb>cfg 9 8 kbd-addr            \ get config descriptor  
 
78
   control-std-get-configuration-descriptor
 
79
   drop
 
80
   \ s" cfg_desc=" type cfg-buffer 9 dump cr
 
81
 
 
82
   kbd-buf kb>cfg 5 + c@ kbd-addr         \ set configuration  
 
83
   control-std-set-configuration
 
84
   drop
 
85
   s" KBDS: Set config returned" usb-debug-print 
 
86
 
 
87
   0 kbd-addr control-cls-set-idle drop       \ set idle  
 
88
   s" KBDS: Set idle returned" usb-debug-print
 
89
 
 
90
   kbd-buf kb>cfg 3f 8 kbd-addr           \ get report descriptor
 
91
   control-std-get-report-descriptor
 
92
   drop
 
93
   \ s" report_desc=" type cfg-buffer 3f dump cr
 
94
 
 
95
   s" Finished initializing keyboard" usb-debug-print 
 
96
;