libbsd - USB Host Stack for HID, WirelessLAN

Thomas Kim thomas73.kim at gmail.com
Thu Aug 27 15:41:08 UTC 2015


Dear Ragu,

I am tring to add HID, wireless LAN code from freeBSD 9.2 original code.
Also, my work is manual without freebsd-to-rtems.py.

I want to share my working code for all.
also, I would like to receive a advice from helper.

After I added HID(mouse, keyboard) and WirelessLAN(interface files), I
modifed usb-sysinit.h in testsute/usb01 and rtems-bsd-sysinit.h in
rtemsbsd/include/machine for building usb testesuite for HID only.

< rtems-bsd-sysinit.h >
#define SYSINIT_NEED_USB_MOUSE \
 SYSINIT_DRIVER_REFERENCE(ums, uhub)
#define SYSINIT_NEED_USB_KEYEBOARD \
 SYSINIT_DRIVER_REFERENCE(ukbd, uhub)

< usb-sysinit.h >
SYSINIT_NEED_USB_MOUSE;
SYSINIT_NEED_USB_KEYEBOARD;

At this time, there are undefined reference errors in linking phase about
below functions.
1. ukbd.c : kern_yeild
2. ums.c : usb_fifo_detach, usb_fifo_softc, usb_fifo_free_buffer,
usb_fifo_put_data_linear, usb_fifo_put_bytes_max, usb_fifo_attach,
usb_fifo_reset
3. kbd.c : _bsd__start_set_kbddriver_set, _bsd__stop_set_kbddriver_set

My review until now is below;
1. ukbd.c
  - kern_yeild : It should be implemented for rtems.
2. ums.c
  - usb_dev.c sour include  usb_fifo_detach, usb_fifo_softc,
usb_fifo_free_buffer, usb_fifo_put_data_linear, usb_fifo_put_bytes_max,
usb_fifo_attach, usb_fifo_reset function. also, libbsd.a library include
usb_dev.c.
  - I don't  know why these functions in usb_dev.c are not linked in my
case.
3. kdb.c
  - I think that  _bsd__start_set_kbddriver_set,
_bsd__stop_set_kbddriver_set functions are made
when SYSINIT_DRIVER_REFERENCE(ukbd, uhub) is processed.
  - but, I don't know why these functions is not linked.

Please could you advise me ?

Best Regards,
Thomas

2015-08-27 1:05 GMT+09:00 ragu nath <ragunath3252 at gmail.com>:

> Hi Thomas,
>
> There is no need to manually edit the makefile. You can add whatever
> files you need from freebsd to libbsd.py file.
> I can see, there is already a dev_usb_input module. It is currently
> disabled. You can just enable it & add additional files to it if you
> need.
>
> Then you run the freebsd-to-rtems.py which will make makefile &
> wscript modifications. I was advised to use this method instead of
> manually modifying the makefile.
>
> "python freebsd-to-rtems.py -m" command will make the changes.
>
> I am not sure how to get source files from freebsd using the scripts.
> What I did was, I copied the necessary files to rtems-libbsd/freebsd
> directory. Then I added those files to libbsd.py & ran
> freebsd-to-rtems.py. Now you have the source files & makefile changes.
> Now you can compile & start your porting work. As mentioned by yurii,
> you can see my blog post on
>
> http://ragustechblog.blogspot.in/2015/06/porting-driver-from-freebsd-to-rtems.html
> which has some useful details
>
> Note: If I run the freebsd-to-rtems.py script it is copying all the
> files from freebsd to rtems. I could not import specific file/files.
>
>
> Thanks,
> Ragunath
>
>
> >
> > Message: 1
> > Date: Wed, 26 Aug 2015 15:55:29 +0900
> > From: Thomas Kim <thomas73.kim at gmail.com>
> > To: Yurii Shevtsov <ungetch at gmail.com>
> > Cc: "devel at rtems.org" <devel at rtems.org>
> > Subject: Re: libbsd - USB Host Stack for HID, WirelessLAN
> > Message-ID:
> >         <
> CADY8aTBTD-ZrquRCUfH_7uk9wyZxWcJhEqigHPMdD69-5UGzRA at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Dear Yurii,
> >
> > Thank you for your kindly reply.
> >
> > At this time, I built lastest libbsd successfully.
> > Also, I am tring to add USB input files in freebsd\sys\dev\usb\input.
> >
> > Question 1)
> > As I guess, I think that I should modify Makefile, wscript file. also, I
> > should modify USB input files(atp.c, uep.c, uhid.c, uknd.c, ums.c, etc)
> > according to "Rules for Modifing FreeBSD source".
> > Is it correct ?
> >
> > Question 2)
> > As I test freebsd-to-rtems.py, it just move the ported FreeBSD code only
> > from FreeBSD 9.2 original code to libbsd Freebsd. that is,
> > freebsd-to-rtems.py is not used for changing additional new files from
> > FreeBSD 9.2 original code automatically.
> > Is it correct ?
> >
> > Question 3)
> > As I check libbsd.py file, there is below definitions.
> >   - def dev_usb_input(mm):
> >   - def dev_usb_mouse(mm):
> >
> > Is there how to use libbsd.py for adding new files(source, header files)
> > easily ?
> > Or, I want to know that libbsd.py file is used for which purpose.
> >
> > Best Regards,
> > Thomas
> >
> > 2015-08-25 19:19 GMT+09:00 Yurii Shevtsov <ungetch at gmail.com>:
> >
> >>
> >>
> >> 2015-08-25 12:10 GMT+03:00 Thomas Kim <thomas73.kim at gmail.com>:
> >>
> >>> Dear Yurii,
> >>>
> >>> Thank you very much.
> >>>
> >>> I want to review freeBSD source code.
> >>>
> >>> Please let me know where is libbsd's README file. there is not README
> >>> file in current tree (https://git.rtems.org/rtems-libbsd/tree/).
> >>> I want to check "Rules for Modiying FreeBSD source" in REAME file.
> >>>
> >> https://github.com/RTEMS/rtems-libbsd/blob/master/libbsd.txt
> >>
> >>>
> >>> Also, I want to compare FreeBSD original code and the modified FreeBSD
> >>> code.
> >>> I guess that FreeBSD original code version is 8.x.
> >>>
> >> it's actually 9.2 (from the readme)
> >>
> >>>
> >>> Please let me know how to get FreeBSD original code version which was
> >>> used for libbsd porting work.
> >>>
> >> https://svnweb.freebsd.org/base/release/9.2.0/ It's Subversion
> >> https://www.freebsd.org/doc/handbook/svn.html
> >>
> >>>
> >>> Best Regards,
> >>> Thomas.
> >>>
> >>> 2015-08-21 23:57 GMT+09:00 Yurii Shevtsov <ungetch at gmail.com>:
> >>>
> >>>> Hi)
> >>>>
> >>>> For porting guide check this blogpost
> >>>>
> >>>>
> http://ragustechblog.blogspot.in/2015/06/porting-driver-from-freebsd-to-rtems.html
> >>>> Also read libbsd's README, especially "Rules for Modifying FreeBSD
> >>>> Source"
> >>>>
> >>>> Can't say anything specific about USB HID and WLAN. Definitely WLAN
> will
> >>>> require porting libraries with auth protocols (WPA\WEP). About HID,
> you can
> >>>> try searching how input works in RTEMS. Maybe you can implement API
> in your
> >>>> future HID driver
> >>>>
> >>>>
> >>>>
> >>>
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150828/ba5851f5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtems-libbsd.zip
Type: application/zip
Size: 289363 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150828/ba5851f5/attachment-0001.zip>


More information about the devel mailing list