libbsd - USB Host Stack for HID, WirelessLAN
Thomas Kim
thomas73.kim at gmail.com
Tue Sep 1 08:28:45 UTC 2015
Dear Sir,
I would like to update my working status.
As I check, most of functions in usb_dev.c is not built due to
USB_HAVE_UGEN option of opt_usb.h in rtemsbsd/include/rtems/bsd/local.
After I changed USE_HAVE_UGEN from 0 to 1, I revised usb_dev.c and
usb_device.c. I attached usb_dev.c and usb_device.c. I commented "Thomas
Kim" in these sources about my modified location.
After this work is done, undefined reference linking error about
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 is resolved.
but, after this work is done, there is still linking error in below;
./libbsd.a(ukbd.c.16.o): In function `ukbd_do_poll':
../../freebsd/sys/dev/usb/input/ukbd.c:442: undefined reference to
`kern_yield'
./libbsd.a(usb_device.c.16.o): In function `_bsd_usb_alloc_device':
../../freebsd/sys/dev/usb/usb_device.c:1646: undefined reference to
`make_dev_alias'
./libbsd.a(kbd.c.16.o): In function `kbd_get_switch':
../../freebsd/sys/dev/kbd/kbd.c:301: undefined reference to
`_bsd__start_set_kbddriver_set'
../../freebsd/sys/dev/kbd/kbd.c:301: undefined reference to
`_bsd__stop_set_kbddriver_set'
./libbsd.a(kbd.c.16.o): In function `kbd_register':
../../freebsd/sys/dev/kbd/kbd.c:237: undefined reference to
`_bsd__start_set_kbddriver_set'
../../freebsd/sys/dev/kbd/kbd.c:237: undefined reference to
`_bsd__stop_set_kbddriver_set'
./libbsd.a(kbd.c.16.o): In function `kbd_configure':
../../freebsd/sys/dev/kbd/kbd.c:454: undefined reference to
`_bsd__start_set_kbddriver_set'
../../freebsd/sys/dev/kbd/kbd.c:454: undefined reference to
`_bsd__stop_set_kbddriver_set'
1. ukbd.c
kern_yield() function is defined in kern_synch.c. but, because all
functions of kern_synth.c is not built, there is undefined reference
linking error about kern_yield().
Please could you advise me for modifing kern_synth.c for using kern_yield()
function ?
2. usb_device.c
As I check in bpf.c, there is a patch using RTEMS IMFS API.
Please could you advise how to modify _bsd_usb_alloc_device() for using
RTEMS IMFS API ?
3. kbd.c
I think that this error is related with SET_DECLARE(kbddriver_set, const
keyboard_driver_t).
But, I don't know how to modify kbd.c for using keyboard driver.
Please advise me.
Best Regards,
Thomas Kim
2015-08-28 0:41 GMT+09:00 Thomas Kim <thomas73.kim at gmail.com>:
> 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/20150901/4791295b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb_dev.c
Type: text/x-csrc
Size: 53084 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150901/4791295b/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb_device.c
Type: text/x-csrc
Size: 72618 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150901/4791295b/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kbd.c
Type: text/x-csrc
Size: 34077 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150901/4791295b/attachment-0005.bin>
More information about the devel
mailing list